FIX: Piano roll tab không xuất âm thanh qua mastering chain được recovery

This commit is contained in:
2026-08-05 12:30:42 +07:00
parent 8a9d6b3c27
commit d37f4e7557
5 changed files with 82 additions and 21 deletions
+10 -1
View File
@@ -680,6 +680,11 @@ function initMasterBus(ctx) {
// masteringSettings effect for subsequent changes see useEffect).
if (window.currentMasteringSettings) {
try {
// Reset sig-cache: chain MI (biquad/maximizer node mi) gi giá tr
// INIT (gain 0, width 100) applyMasteringSettings early-return vì
// _lastMasteringSig không đi (module-level, persist qua recreation)
// chain FLAT ("spectrum hin th nhưng không x lí âm thanh").
_lastMasteringSig = null;
toggleMasteringOnMaster(window.currentMasteringSettings.masterConnected, window.currentMasteringSettings.isBypassed);
applyMasteringSettings(window.currentMasteringSettings);
} catch (e) {
@@ -17813,7 +17818,11 @@ const App = () => {
for (let i = 0; i < f.length; i++) { if (!isFinite(f[i])) { nanOut = true; break; } }
} catch (e) {}
}
if (pk < 0.001 || (isPianoRoll && nanOut)) {
// PIANO_ROLL: CH rebuild khi output NaN (chain chết state-bad).
// pk<0.001 (im lng) KHÔNG trigger cho piano roll rests t nhiên
// gia các note > 750ms là BÌNH THƯNG false-positive = recovery
// hy play + restart notes (glitch) đúng chui log recovery trưc.
if ((isPianoRoll ? nanOut : (pk < 0.001 || nanOut))) {
masterSilenceFramesRef.current++;
const sinceRebuild = performance.now() - (lastMasterRebuildTimeRef.current || 0);
if (masterSilenceFramesRef.current > 45 && sinceRebuild > 3000) {