Skip to content

Commit d3a0cf7

Browse files
committed
fix: route ended callbacks by active backend
1 parent 213c1af commit d3a0cf7

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/hooks/useTransport.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ export function useTransport() {
269269
const { stopRecording, onLoopCycle } = useRecording();
270270
const mainView = useUIStore((s) => s.mainView);
271271
const scrubClipsRef = useRef<TimelineScrubClip[]>([]);
272-
const lastEndedAtRef = useRef(0);
273272

274273
const play = useCallback(async (fromTime?: number) => {
275274
const engine = getAudioEngine();
@@ -1095,9 +1094,6 @@ export function useTransport() {
10951094
const engine = getAudioEngine();
10961095
const bridge = getAudioBridge(engine);
10971096
const onEnded = () => {
1098-
const now = Date.now();
1099-
if (now - lastEndedAtRef.current < 250) return;
1100-
lastEndedAtRef.current = now;
11011097
const {
11021098
loopEnabled,
11031099
isRecording,
@@ -1120,7 +1116,10 @@ export function useTransport() {
11201116
useTransportStore.getState().stop();
11211117
}
11221118
};
1123-
engine.setOnEndedCallback(onEnded);
1119+
engine.setOnEndedCallback(() => {
1120+
if (bridge.backend === 'tauri' && getTauriPlaybackClockOwner() === 'native') return;
1121+
onEnded();
1122+
});
11241123
if (bridge.backend === 'tauri') {
11251124
bridge.setOnEndedCallback(onEnded);
11261125
}

0 commit comments

Comments
 (0)