fix: reduce MIDI playback crackling (no per-note prog reload, underrun-proof render loop, gentle stopAll)
This commit is contained in:
@@ -29,14 +29,10 @@ class FluidSynthBridge extends AudioWorkletProcessor {
|
||||
si++;
|
||||
if (si >= qL[fi].length) { fi++; si = 0; }
|
||||
}
|
||||
if (fi > 0) { this.leftQ.splice(0, fi); this.rightQ.splice(0, fi); }
|
||||
if (this.called % 50 === 0) {
|
||||
var pk = 0;
|
||||
for (var j = 0; j < len; j++) {
|
||||
var v = out[0][j] > 0 ? out[0][j] : -out[0][j];
|
||||
if (v > pk) pk = v;
|
||||
}
|
||||
if (pk > 0) console.log('[FluidSynth:bridge] process #' + this.called + ' peak:' + pk.toFixed(6) + ' q:' + qL.length);
|
||||
if (fi > 0) {
|
||||
this.leftQ.splice(0, fi);
|
||||
this.rightQ.splice(0, fi);
|
||||
this.port.postMessage({ type: 'CONSUMED', n: fi });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user