fix: _fluid_synth_all_sounds_off + log noteoff return code
- Dùng _fluid_synth_all_sounds_off thay vì CC120 - Log return value của _fluid_synth_noteoff (0=OK, -1=fail) - Log ch+pitch trong stopNote - Sửa printErr filter (bỏ check 'stderr')
This commit is contained in:
@@ -88,7 +88,7 @@
|
|||||||
},
|
},
|
||||||
TOTAL_MEMORY: TOTAL_MEMORY,
|
TOTAL_MEMORY: TOTAL_MEMORY,
|
||||||
printErr: function (msg) {
|
printErr: function (msg) {
|
||||||
if (msg.indexOf('stderr') === -1) console.warn('[FluidSynth:err]', msg);
|
console.warn('[FluidSynth:err]', msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -305,8 +305,14 @@
|
|||||||
stopNote: function (channel, pitch) {
|
stopNote: function (channel, pitch) {
|
||||||
if (channel < 0 || channel > 15) return;
|
if (channel < 0 || channel > 15) return;
|
||||||
if (_initialized && _fluidModule) {
|
if (_initialized && _fluidModule) {
|
||||||
try { _fluidModule._fluid_synth_noteoff(_synthPtr, channel, pitch); } catch (e) {}
|
console.log("[SonicSF] stopNote ch:", channel, "pitch:", pitch);
|
||||||
try { _fluidModule._fluid_synth_cc(_synthPtr, channel, 120, 0); } catch (e) {}
|
try {
|
||||||
|
var r = _fluidModule._fluid_synth_noteoff(_synthPtr, channel, pitch);
|
||||||
|
if (r !== 0) console.warn("[SonicSF] noteoff returned:", r);
|
||||||
|
} catch (e) { console.warn("[SonicSF] noteoff error:", e); }
|
||||||
|
try {
|
||||||
|
_fluidModule._fluid_synth_all_sounds_off(_synthPtr, channel);
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user