fix(cc11): unmute realtime dung effective list thay vi ref stale

This commit is contained in:
2026-08-26 18:40:15 +07:00
parent b95c63e7db
commit 2e996af102
3 changed files with 19 additions and 3 deletions
+12 -1
View File
@@ -18775,7 +18775,18 @@ const App = () => {
startAudioTimeRef.current = ctx.currentTime;
startBufferOffsetRef.current = resumeAt;
setIsPlaying(true);
startTrackPlayback(resumeAt);
// V22: activeTracksRef.current vẫn STALE (React chưa re-render trong
// click handler) → track vừa unmute vẫn thấy muted=true → bị skip ở
// startTrackPlayback (isPlayable) → câm + CC11 không chạy. Dùng
// `effective` (đã patch mute/solo) làm nguồn restart; ref tự phục hồi
// ở render kế tiếp (activeTracksRef.current = activeTracks).
const _prevActiveTracks = activeTracksRef.current;
activeTracksRef.current = effective;
try {
startTrackPlayback(resumeAt);
} finally {
activeTracksRef.current = _prevActiveTracks;
}
} catch (e) {
console.warn('mute/solo resume error:', e);
}
+6 -1
View File
@@ -1273,7 +1273,12 @@ if(isMidiSoundTrack(t)){try{sendMidiVolumeCC7(t,effective,audible);}catch(e){}}i
// from the current playhead — the same approach toggleTrackSoloEvaluate
// already uses for solo.
if(becameAudible&&isPlaying&&recordingStateRef.current!=='RECORDING'&&activeTracksRef.current&&activeTracksRef.current.length){try{fxRtKeepForRestart=true;// restart/resume — giữ session FX realtime
stopAllPlayback();const ctx=getAudioContext();const resumeAt=currentTimeRef.current||0;startOffsetTimeRef.current=resumeAt;startAudioTimeRef.current=ctx.currentTime;startBufferOffsetRef.current=resumeAt;setIsPlaying(true);startTrackPlayback(resumeAt);}catch(e){console.warn('mute/solo resume error:',e);}}updateSfRouting();};window.__applyTrackMuteSolo=applyAllTrackMuteSolo;window.__toggleMediaExplorerRef=function(){setShowMediaExplorer(function(p){const next=!p;if(next)setShowMixerRef.current(false);return next;});};const[mixerHeight,setMixerHeight]=useState(function(){var saved=localStorage.getItem('studio_mixer_height');return saved?parseInt(saved):200;}());const[mediaExplorerPanelHeight,setMediaExplorerPanelHeight]=useState(function(){var saved=localStorage.getItem('studio_media_explorer_height');return saved?parseInt(saved):240;}());const[masterVolume,setMasterVolume]=useState(0);// dB (legacy single fader)
stopAllPlayback();const ctx=getAudioContext();const resumeAt=currentTimeRef.current||0;startOffsetTimeRef.current=resumeAt;startAudioTimeRef.current=ctx.currentTime;startBufferOffsetRef.current=resumeAt;setIsPlaying(true);// V22: activeTracksRef.current vẫn STALE (React chưa re-render trong
// click handler) → track vừa unmute vẫn thấy muted=true → bị skip ở
// startTrackPlayback (isPlayable) → câm + CC11 không chạy. Dùng
// `effective` (đã patch mute/solo) làm nguồn restart; ref tự phục hồi
// ở render kế tiếp (activeTracksRef.current = activeTracks).
const _prevActiveTracks=activeTracksRef.current;activeTracksRef.current=effective;try{startTrackPlayback(resumeAt);}finally{activeTracksRef.current=_prevActiveTracks;}}catch(e){console.warn('mute/solo resume error:',e);}}updateSfRouting();};window.__applyTrackMuteSolo=applyAllTrackMuteSolo;window.__toggleMediaExplorerRef=function(){setShowMediaExplorer(function(p){const next=!p;if(next)setShowMixerRef.current(false);return next;});};const[mixerHeight,setMixerHeight]=useState(function(){var saved=localStorage.getItem('studio_mixer_height');return saved?parseInt(saved):200;}());const[mediaExplorerPanelHeight,setMediaExplorerPanelHeight]=useState(function(){var saved=localStorage.getItem('studio_media_explorer_height');return saved?parseInt(saved):240;}());const[masterVolume,setMasterVolume]=useState(0);// dB (legacy single fader)
const[masterVolL,setMasterVolL]=useState(0);// dB - master L fader
const[masterVolR,setMasterVolR]=useState(0);// dB - master R fader
const[masterLink,setMasterLink]=useState(true);// LINK L/R
+1 -1
View File
@@ -51,7 +51,7 @@
<script src="/static/js/services/promptTemplateManager.js?v=202607281039"></script>
<script src="/static/js/services/undoRedoEngine.js?v=202607290941"></script>
<script src="/static/js/services/chordTheory.js?v=202608211300"></script>
<script src="/static/js/app.precompiled.js?v=202608311100" defer></script>
<script src="/static/js/app.precompiled.js?v=202608311200" defer></script>
<link rel="stylesheet" href="/static/css/styles.css?v=202607271016">
<style>
:root {