Add AM modulation support to parser and exporter
This commit is contained in:
@@ -181,6 +181,7 @@ function buildInstrument(node) {
|
||||
volumes: null,
|
||||
timbre: null,
|
||||
fmModulations: [],
|
||||
amModulations: [],
|
||||
rawChildren: [],
|
||||
};
|
||||
|
||||
@@ -201,6 +202,9 @@ function buildInstrument(node) {
|
||||
case 'FM.modulation':
|
||||
instr.fmModulations.push({ ...child.props });
|
||||
break;
|
||||
case 'AM.modulation':
|
||||
instr.amModulations.push({ ...child.props });
|
||||
break;
|
||||
default:
|
||||
instr.rawChildren.push(buildGeneric(child));
|
||||
}
|
||||
@@ -253,6 +257,7 @@ function buildBasicProperties(node) {
|
||||
A: null, S: null, R: null,
|
||||
oscillator: null,
|
||||
fmModulations: [],
|
||||
amModulations: [],
|
||||
rawChildren: [],
|
||||
};
|
||||
|
||||
@@ -271,6 +276,11 @@ function buildBasicProperties(node) {
|
||||
const envChild = child.children.find(c => c.slot === 'shape');
|
||||
if (envChild) fm.shape = buildShape(envChild);
|
||||
bp.fmModulations.push(fm);
|
||||
} else if (child.parentSlot === 'AM' && child.slot === 'modulation') {
|
||||
const am = { ...child.props };
|
||||
const envChild = child.children.find(c => c.slot === 'shape');
|
||||
if (envChild) am.shape = buildShape(envChild);
|
||||
bp.amModulations.push(am);
|
||||
} else {
|
||||
bp.rawChildren.push(buildGeneric(child));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user