fix: ruler click 200ms timeout + default instrument attackTime 0.03 + safe ramp

This commit is contained in:
2026-07-26 11:51:50 +07:00
parent 523a754949
commit 1ffdec68c6
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -5881,7 +5881,7 @@ const beatSec = 60.0 / (parseInt(bpm) || 120);
setTimeout(() => { setTimeout(() => {
setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime } : s)); setSubTabs(prev => prev.map(s => s.id === st.id ? { ...s, currentTime: clickTime } : s));
onPlayPause(); onPlayPause();
}, 40); }, 200);
} }
} }
const snappedStartBeat = getSnapBeat(clickBeat, snapVal); const snappedStartBeat = getSnapBeat(clickBeat, snapVal);
File diff suppressed because one or more lines are too long
+4 -3
View File
@@ -53,11 +53,11 @@
// Default settings // Default settings
let oscType = 'triangle'; let oscType = 'triangle';
let attackTime = 0.01; let attackTime = 0.03;
let decayTime = 0.1; let decayTime = 0.1;
let sustainLevel = 0.5; let sustainLevel = 0.5;
let releaseTime = 0.2; let releaseTime = 0.2;
let volFactor = 0.3; let volFactor = 0.25;
const prog = program !== undefined ? parseInt(program) : 0; const prog = program !== undefined ? parseInt(program) : 0;
if (prog >= 0 && prog <= 7) { // Pianos if (prog >= 0 && prog <= 7) { // Pianos
@@ -140,7 +140,8 @@
const releaseStart = startAt + Math.max(attackTime + decayTime, durSec); const releaseStart = startAt + Math.max(attackTime + decayTime, durSec);
noteGain.gain.setValueAtTime(targetGain * sustainLevel, releaseStart); noteGain.gain.setValueAtTime(targetGain * sustainLevel, releaseStart);
noteGain.gain.exponentialRampToValueAtTime(0.001, releaseStart + releaseTime); const rampEnd = Math.max(0.001, targetGain * sustainLevel * 0.01);
noteGain.gain.exponentialRampToValueAtTime(rampEnd, releaseStart + releaseTime);
osc.connect(noteGain); osc.connect(noteGain);