summaryrefslogtreecommitdiff
path: root/tools/mq_editor/editor.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/mq_editor/editor.js')
-rw-r--r--tools/mq_editor/editor.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/tools/mq_editor/editor.js b/tools/mq_editor/editor.js
index 98c92e5..07312d5 100644
--- a/tools/mq_editor/editor.js
+++ b/tools/mq_editor/editor.js
@@ -86,6 +86,38 @@ class PartialEditor {
muteBtn.textContent = partial.muted ? 'Unmute' : 'Mute';
muteBtn.style.color = partial.muted ? '#fa4' : '';
+ // Mode toggle (quick sine/resonator switch, no tab required)
+ const modeToggle = document.getElementById('synthModeToggle');
+ if (modeToggle) {
+ modeToggle.innerHTML = '';
+ const isRes = !!(partial.resonator && partial.resonator.enabled);
+ const resDefaults = { r: 0.995, gainComp: 1.0 };
+ const btnS = document.createElement('button');
+ btnS.textContent = 'Sine';
+ btnS.className = 'tab-btn' + (isRes ? '' : ' active');
+ btnS.style.cssText = 'padding:2px 8px;font-size:11px;margin:0;';
+ const btnR = document.createElement('button');
+ btnR.textContent = 'Res';
+ btnR.className = 'tab-btn' + (isRes ? ' active' : '');
+ btnR.style.cssText = 'padding:2px 8px;font-size:11px;margin:0;';
+ btnS.onclick = () => {
+ if (!this.partials || !this.partials[index]) return;
+ if (!this.partials[index].resonator) this.partials[index].resonator = {...resDefaults};
+ this.partials[index].resonator.enabled = false;
+ this._updatePropPanel(index);
+ if (this.viewer) this.viewer.render();
+ };
+ btnR.onclick = () => {
+ if (!this.partials || !this.partials[index]) return;
+ if (!this.partials[index].resonator) this.partials[index].resonator = {...resDefaults};
+ this.partials[index].resonator.enabled = true;
+ this._updatePropPanel(index);
+ if (this.viewer) this.viewer.render();
+ };
+ modeToggle.appendChild(btnS);
+ modeToggle.appendChild(btnR);
+ }
+
this._buildCurveGrid(this._freqGrid, partial, 'freqCurve', 'f', index);
this._buildCurveGrid(this._ampGrid, partial, 'freqCurve', 'a', index, 'a');
this._buildSynthGrid(partial, index);