refactor(28-02): route VU data to external store

- Import vuStore in useMixerStore.js
- Replace mixerHelper.updateVU call with vuStore.updateLevel
- VU data now flows to external store instead of React state
- Native bridge still calls at 50-70/sec but updates are buffered

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-03-03 20:25:08 +05:30
parent 344ef27ae0
commit 96d8f97175
1 changed files with 8 additions and 13 deletions

View File

@ -13,6 +13,7 @@ import { putTrackSyncChange } from '../helpers/rest';
import useVuHelpers from './useVuHelpers';
import { useJamServerContext } from '../context/JamServerContext';
import { useMixersContext } from '../context/MixersContext';
import { vuStore } from '../stores/vuStore';
@ -169,21 +170,15 @@ export default function useMixerStore() {
// TODO - no guarantee range will be -80 to 20. Get from the
// GetControlState for this mixer which returns min/max
// value is a DB value from -80 to 20. Convert to float from 0.0-1.0
//console.log('handleBridgeCallback@mixers',@mixers)
// Use ref to get current mixerHelper (fixes stale closure issue)
const currentMixerHelper = mixerHelperRef.current;
// Convert dB to 0.0-1.0 range (existing logic)
const normalizedLevel = (leftValue + 80) / 80;
if (currentMixerHelper?.isReady.current) {
currentMixerHelper.updateVU(
mixerId,
mode,
(leftValue + 80) / 80,
leftClipping,
(rightValue + 80) / 80,
rightClipping
);
}
// Create qualified ID matching existing pattern
const fqId = (mode ? 'M' : 'P') + mixerId;
// Route to external store instead of mixerHelper
vuStore.updateLevel(fqId, normalizedLevel, leftClipping);
}
}