Update sound source collection logic in utils.ts
This commit is contained in:
@@ -241,13 +241,21 @@ function getSoundsInfoFromProject(
|
||||
|
||||
if (keepUnusedPatterns) {
|
||||
for (const pattern of data.groupPatterns) {
|
||||
for (const [source, notes] of Object.entries(pattern.notes)) {
|
||||
if (notes.length === 0) {
|
||||
continue;
|
||||
const sources = new Set(
|
||||
Object.entries(pattern.notes)
|
||||
.filter(([, notes]) => notes.length > 0)
|
||||
.map(([source]) => Number(source)),
|
||||
);
|
||||
|
||||
for (const event of pattern.events) {
|
||||
if (event.type === 'midi' && event.source >= 0 && event.source < 12) {
|
||||
sources.add(event.source);
|
||||
}
|
||||
}
|
||||
|
||||
for (const source of sources) {
|
||||
const pad = data.pads[pattern.group]?.find(
|
||||
(candidate) => candidate.pad === Number(source) + 1,
|
||||
(candidate) => candidate.pad === source + 1,
|
||||
);
|
||||
if (pad?.soundId) {
|
||||
usedSoundIds.add(pad.soundId);
|
||||
|
||||
Reference in New Issue
Block a user