fix(cc11): unmute realtime dung effective list thay vi ref stale
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user