cleanup: bỏ dead code stopNote + debug log _playNoteFluid
This commit is contained in:
@@ -322,21 +322,11 @@
|
|||||||
if (_initialized && _fluidModule) {
|
if (_initialized && _fluidModule) {
|
||||||
var key = channel + ':' + pitch;
|
var key = channel + ':' + pitch;
|
||||||
var mappedChs = _activeNotes[key];
|
var mappedChs = _activeNotes[key];
|
||||||
if (mappedChs === undefined) {
|
|
||||||
if (_activeNotes['_' + key]) mappedChs = _activeNotes['_' + key];
|
|
||||||
}
|
|
||||||
if (mappedChs === undefined) mappedChs = [channel];
|
if (mappedChs === undefined) mappedChs = [channel];
|
||||||
if (!Array.isArray(mappedChs)) mappedChs = [mappedChs];
|
|
||||||
for (var i = 0; i < mappedChs.length; i++) {
|
for (var i = 0; i < mappedChs.length; i++) {
|
||||||
try { _fluidModule._fluid_synth_noteoff(_synthPtr, mappedChs[i], pitch); } catch (e) {}
|
try { _fluidModule._fluid_synth_noteoff(_synthPtr, mappedChs[i], pitch); } catch (e) {}
|
||||||
}
|
}
|
||||||
delete _activeNotes[key];
|
delete _activeNotes[key];
|
||||||
try {
|
|
||||||
var r1 = _fluidModule._fluid_synth_noteoff(_synthPtr, mappedCh, pitch);
|
|
||||||
if (r1 !== 0) {
|
|
||||||
r1 = _fluidModule._fluid_synth_noteon(_synthPtr, mappedCh, pitch, 0);
|
|
||||||
}
|
|
||||||
} catch (e) { console.warn("[SonicSF] stopNote error:", e); }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -360,7 +350,6 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
_playNoteFluid: function (note, velocity, durationMs, startTime, program, channel, synthEngine) {
|
_playNoteFluid: function (note, velocity, durationMs, startTime, program, channel, synthEngine) {
|
||||||
console.log("[SonicSF] _playNoteFluid chParam:", channel, "synthEngine:", synthEngine ? synthEngine.soundfont_id + ':' + synthEngine.soundfont_bank + ':' + synthEngine.soundfont_program : 'null');
|
|
||||||
var midiPitch = Math.min(127, Math.max(0, parseInt(note) || 60));
|
var midiPitch = Math.min(127, Math.max(0, parseInt(note) || 60));
|
||||||
var midiVel = Math.min(127, Math.max(1, Math.floor(
|
var midiVel = Math.min(127, Math.max(1, Math.floor(
|
||||||
typeof velocity === 'number' ? (velocity > 1 ? velocity : velocity * 127) : 100
|
typeof velocity === 'number' ? (velocity > 1 ? velocity : velocity * 127) : 100
|
||||||
|
|||||||
Reference in New Issue
Block a user