summaryrefslogtreecommitdiff
path: root/tools/mq_editor/app.js
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-19 00:32:54 +0100
committerskal <pascal.massimino@gmail.com>2026-02-19 00:32:54 +0100
commitc804808870cf3775362c02e40ea7d3d082ed0d91 (patch)
tree51b12188515b71cd369f0d682eb50c8ef01d599d /tools/mq_editor/app.js
parentdb5c023acd237d7015933bd21a5a6dbe5755841d (diff)
fix(mq_editor): jitter + central spectrum invalidationHEADmain
mq_synth.js: - jitter was only used as a static initial phase offset (inaudible); now drives per-sample LCG frequency perturbation (±jitter fraction of instantaneous freq) in both sinusoidal (integratePhase path) and resonator modes (separate jitterSeed, independent from noise excitation) - disableJitter option now correctly gates jitter to 0 in both modes (was never read before) viewer.js / app.js: - remove invalidatePartialSpectrum() and onResonatorParamChange callback; replace with viewer.onGetSynthOpts callback, called inside _computePartialSpectrum to pull fresh synthOpts at compute time - all UI changes (resonator r/gain, forceResonator, globalR/gain, forceRGain, sinusoidal params) now use viewer.render() as the single invalidation path — no more split between render() and invalidatePartialSpectrum() handoff(Gemini): jitter active on both synth modes; spectrum always sees fresh synthOpts via onGetSynthOpts; viewer.render() is the only invalidation path needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools/mq_editor/app.js')
-rw-r--r--tools/mq_editor/app.js18
1 files changed, 6 insertions, 12 deletions
diff --git a/tools/mq_editor/app.js b/tools/mq_editor/app.js
index 380bb12..1c6d548 100644
--- a/tools/mq_editor/app.js
+++ b/tools/mq_editor/app.js
@@ -46,27 +46,20 @@ document.getElementById('hpK2').addEventListener('input', function() {
document.getElementById('hpK2Val').textContent = k >= 1.0 ? 'bypass' : fmtHz(f);
});
-function invalidatePartialSpectrum() {
- if (!viewer) return;
- viewer.synthOpts = getSynthParams().opts;
- viewer._partialSpecCache = null;
- viewer.renderPartialSpectrum(viewer.spectrumTime, true);
-}
-
// Show/hide global resonator params when forceResonator toggled
document.getElementById('forceResonator').addEventListener('change', function() {
document.getElementById('globalResParams').style.display = this.checked ? '' : 'none';
- invalidatePartialSpectrum();
+ if (viewer) viewer.render();
});
document.getElementById('globalR').addEventListener('input', function() {
document.getElementById('globalRVal').textContent = parseFloat(this.value).toFixed(4);
- invalidatePartialSpectrum();
+ if (viewer) viewer.render();
});
document.getElementById('globalGain').addEventListener('input', function() {
document.getElementById('globalGainVal').textContent = parseFloat(this.value).toFixed(2);
- invalidatePartialSpectrum();
+ if (viewer) viewer.render();
});
-document.getElementById('forceRGain').addEventListener('change', invalidatePartialSpectrum);
+document.getElementById('forceRGain').addEventListener('change', () => { if (viewer) viewer.render(); });
let audioBuffer = null;
let viewer = null;
@@ -207,7 +200,8 @@ function loadAudioBuffer(buffer, label) {
document.getElementById('exploreBtn').disabled = false;
document.getElementById('contourBtn').disabled = false;
editor.setViewer(viewer);
- viewer.onPartialSelect = (i) => editor.onPartialSelect(i);
+ viewer.onGetSynthOpts = () => getSynthParams().opts;
+ viewer.onPartialSelect = (i) => editor.onPartialSelect(i);
viewer.onRender = () => editor.onRender();
viewer.onBeforeChange = pushUndo;
viewer.onExploreMove = (time, freq) => {