Improve parsing of WAV metadata by simplifying string handling
This commit is contained in:
@@ -130,10 +130,7 @@ export function parseWavMetadata(wavData: Uint8Array) {
|
||||
|
||||
if (subId === 'TNGE') {
|
||||
const raw = listData.subarray(subOffset + 8, subOffset + 8 + subSize);
|
||||
const jsonStr = new TextDecoder('ascii')
|
||||
.decode(raw)
|
||||
.replace(/\0/g, '')
|
||||
.trim();
|
||||
const jsonStr = new TextDecoder('ascii').decode(raw).replace(/\0/g, '').trim();
|
||||
try {
|
||||
teMeta = JSON.parse(jsonStr);
|
||||
} catch {
|
||||
@@ -252,9 +249,7 @@ function getSoundsInfoFromProject(
|
||||
}
|
||||
|
||||
for (const source of sources) {
|
||||
const pad = data.pads[pattern.group]?.find(
|
||||
(candidate) => candidate.pad === source + 1,
|
||||
);
|
||||
const pad = data.pads[pattern.group]?.find((candidate) => candidate.pad === source + 1);
|
||||
if (pad?.soundId) {
|
||||
usedSoundIds.add(pad.soundId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user