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') {
|
if (subId === 'TNGE') {
|
||||||
const raw = listData.subarray(subOffset + 8, subOffset + 8 + subSize);
|
const raw = listData.subarray(subOffset + 8, subOffset + 8 + subSize);
|
||||||
const jsonStr = new TextDecoder('ascii')
|
const jsonStr = new TextDecoder('ascii').decode(raw).replace(/\0/g, '').trim();
|
||||||
.decode(raw)
|
|
||||||
.replace(/\0/g, '')
|
|
||||||
.trim();
|
|
||||||
try {
|
try {
|
||||||
teMeta = JSON.parse(jsonStr);
|
teMeta = JSON.parse(jsonStr);
|
||||||
} catch {
|
} catch {
|
||||||
@@ -252,9 +249,7 @@ function getSoundsInfoFromProject(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const source of sources) {
|
for (const source of sources) {
|
||||||
const pad = data.pads[pattern.group]?.find(
|
const pad = data.pads[pattern.group]?.find((candidate) => candidate.pad === source + 1);
|
||||||
(candidate) => candidate.pad === source + 1,
|
|
||||||
);
|
|
||||||
if (pad?.soundId) {
|
if (pad?.soundId) {
|
||||||
usedSoundIds.add(pad.soundId);
|
usedSoundIds.add(pad.soundId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user