fix: track VU meter stays idle when track not audible (solo/mute)

This commit is contained in:
2026-07-31 10:33:14 +07:00
parent c47eb5d718
commit 24ac703d4d
2 changed files with 9 additions and 3 deletions
+8 -2
View File
@@ -18452,8 +18452,14 @@ const App = () => {
const canvas = trackVuRefs.current[key];
if (!canvas) return;
// Only animate when real audio actually passes through the track (solo/mute aware)
var vuTracks = activeTracksRef.current || [];
var anySoloVU = vuTracks.some(function(t) { return t.solo; });
var vuTrack = vuTracks.find(function(t) { return t.id === trackId; });
var isAudible = vuTrack ? (anySoloVU ? !!vuTrack.solo : !vuTrack.muted) : true;
let audioPeak = 0;
if (node && node.analyserNode) {
if (isAudible && node && node.analyserNode) {
const analyser = node.analyserNode;
const data = new Uint8Array(128);
analyser.getByteTimeDomainData(data);
@@ -18463,7 +18469,7 @@ const App = () => {
}
}
let midiPeak = isPlaying ? (midiVuActivityRef.current[trackId] || 0) : 0;
let midiPeak = isPlaying && isAudible ? (midiVuActivityRef.current[trackId] || 0) : 0;
if (midiPeak > 0) {
midiVuActivityRef.current[trackId] = midiPeak * 0.90;
if (midiVuActivityRef.current[trackId] < 0.01) {
File diff suppressed because one or more lines are too long