T6: scheduler items qua router - note-on/off TIMELINE_SCHEDULER (startTime audio clock support trong router+TrackInstrument); 8 site scheduler (timeline/section/local/piano-roll/ghost) route UnifiedMidiRouter, fallback SonicSF, tracker doi xung qua note-off setTimeout
This commit is contained in:
@@ -33,12 +33,12 @@ window.TrackInstrument = window.TrackInstrument || {};
|
||||
}
|
||||
};
|
||||
|
||||
TrackInstrument.prototype.playNote = function (pitch, velocity, durationMs) {
|
||||
TrackInstrument.prototype.playNote = function (pitch, velocity, durationMs, startTime) {
|
||||
try {
|
||||
if (!window.SonicSF || !window.SonicSF.playNote) return;
|
||||
this._ensure();
|
||||
var dur = (durationMs != null ? durationMs : 500) || 500;
|
||||
window.SonicSF.playNote(pitch, velocity != null ? velocity : 0.8, dur, undefined, this.program, this.dest, this.ch, this.synthEngine);
|
||||
window.SonicSF.playNote(pitch, velocity != null ? velocity : 0.8, dur, startTime, this.program, this.dest, this.ch, this.synthEngine);
|
||||
} catch (e) {
|
||||
console.warn('[TrackInstrument] playNote error:', e);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ window.SonicUnifiedMidiRouter = window.SonicUnifiedMidiRouter || {};
|
||||
// Chỉ trigger âm ở note-on đầu tiên; các note-on trùng key chỉ tăng
|
||||
// count (sustain lặp) — note-off cuối cùng mới tắt voice.
|
||||
if (cur.count === 1 && engine && engine.playNote) {
|
||||
try { engine.playNote(pitch, vel, evt.durationMs || 500); } catch (e) {}
|
||||
try { engine.playNote(pitch, vel, evt.durationMs || 500, evt.startTime); } catch (e) {}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user