Rename serializeFm to serializeModulation
This commit is contained in:
parent
923aa5d41a
commit
e4b5cf6887
@ -23,7 +23,7 @@ function serializeShape(shape) {
|
|||||||
// ── FM / AM modulation ─────────────────────────────────────────────────────
|
// ── FM / AM modulation ─────────────────────────────────────────────────────
|
||||||
// RFC §3.2.1.1.6-7: FM = FREQUENCY ["f"/"F"] ["@" OSC] ["[" SHAPE "]"] ";" MOD ":" BASE
|
// RFC §3.2.1.1.6-7: FM = FREQUENCY ["f"/"F"] ["@" OSC] ["[" SHAPE "]"] ";" MOD ":" BASE
|
||||||
|
|
||||||
function serializeFm(fm) {
|
function serializeModulation(fm) {
|
||||||
let s = String(fm.frequency ?? '');
|
let s = String(fm.frequency ?? '');
|
||||||
if (fm.factor) s += fm.factor;
|
if (fm.factor) s += fm.factor;
|
||||||
if (fm.osc) s += `@${fm.osc}`;
|
if (fm.osc) s += `@${fm.osc}`;
|
||||||
@ -46,8 +46,8 @@ function basicPropLines(bp) {
|
|||||||
if (s) lines.push(`S: "${s}"`);
|
if (s) lines.push(`S: "${s}"`);
|
||||||
const r = serializeShape(bp.R);
|
const r = serializeShape(bp.R);
|
||||||
if (r) lines.push(`R: "${r}"`);
|
if (r) lines.push(`R: "${r}"`);
|
||||||
for (const fm of (bp.fmModulations ?? [])) lines.push(`FM: "${serializeFm(fm)}"`);
|
for (const fm of (bp.fmModulations ?? [])) lines.push(`FM: "${serializeModulation(fm)}"`);
|
||||||
for (const am of (bp.amModulations ?? [])) lines.push(`AM: "${serializeFm(am)}"`);
|
for (const am of (bp.amModulations ?? [])) lines.push(`AM: "${serializeModulation(am)}"`);
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ function variationLines(v) {
|
|||||||
if (vol) lines.push(`VOLUMES: "${vol}"`);
|
if (vol) lines.push(`VOLUMES: "${vol}"`);
|
||||||
const timbre = serializeShape(v.timbre);
|
const timbre = serializeShape(v.timbre);
|
||||||
if (timbre) lines.push(`TIMBRE: "${timbre}"`);
|
if (timbre) lines.push(`TIMBRE: "${timbre}"`);
|
||||||
for (const fm of (v.fmModulations ?? [])) lines.push(`FM: "${serializeFm(fm)}"`);
|
for (const fm of (v.fmModulations ?? [])) lines.push(`FM: "${serializeModulation(fm)}"`);
|
||||||
for (const am of (v.amModulations ?? [])) lines.push(`AM: "${serializeFm(am)}"`);
|
for (const am of (v.amModulations ?? [])) lines.push(`AM: "${serializeModulation(am)}"`);
|
||||||
for (const sv of (v.subvariations ?? [])) lines.push(...variationLines(sv));
|
for (const sv of (v.subvariations ?? [])) lines.push(...variationLines(sv));
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user