forked from flow/vue3js-app-proposal-for-sdk-claude
Fix serializeModulation field names; add mod:base test assertion
This commit is contained in:
parent
e4b5cf6887
commit
89198ec37e
@ -23,12 +23,12 @@ function serializeShape(shape) {
|
||||
// ── FM / AM modulation ─────────────────────────────────────────────────────
|
||||
// RFC §3.2.1.1.6-7: FM = FREQUENCY ["f"/"F"] ["@" OSC] ["[" SHAPE "]"] ";" MOD ":" BASE
|
||||
|
||||
function serializeModulation(fm) {
|
||||
let s = String(fm.frequency ?? '');
|
||||
if (fm.factor) s += fm.factor;
|
||||
if (fm.osc) s += `@${fm.osc}`;
|
||||
if (fm.shape) s += `[${serializeShape(fm.shape)}]`;
|
||||
s += `;${fm.mod ?? ''}:${fm.base ?? ''}`;
|
||||
function serializeModulation(m) {
|
||||
let s = String(m.frequency ?? '');
|
||||
if (m.oscillator) s += `@${m.oscillator}`;
|
||||
if (m.shape) s += `[${serializeShape(m.shape)}]`;
|
||||
s += `;${m.mod_share ?? ''}:${m.base_share ?? ''}`;
|
||||
if (m.init_phase != null) s += m.init_phase >= 0 ? `+${m.init_phase}` : String(m.init_phase);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@ -243,6 +243,7 @@ ok('FM shape start', fm?.shape?.start === '6' || fm?.shape?.start === 6);
|
||||
fmInstr.isDirty = true;
|
||||
const fmOut = exportInstrument(fmInstr);
|
||||
ok('FM exported with [shape]', /FM:.*\[.*\]/.test(fmOut));
|
||||
ok('FM exported with mod:base', /FM:.*;\d+:\d+/.test(fmOut));
|
||||
|
||||
// ── Summary ────────────────────────────────────────────────────────────────
|
||||
console.log(`\n══ ${pass} passed, ${fail} failed ══\n`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user