fix: pause button while recording should stop recoding

This commit is contained in:
Xiaohan-Tian
2026-05-02 23:02:37 -07:00
parent 9f536d9687
commit 7a6e7558ce
5 changed files with 71 additions and 13 deletions
+9 -1
View File
@@ -137,6 +137,7 @@ interface ProjectState {
setAutoScrollEnabled: (enabled: boolean) => void;
startPlaying: () => Promise<void>;
stopPlaying: () => Promise<void>;
stopTransport: () => Promise<void>;
toggleLoop: () => void;
toggleMetronome: () => void;
setBpm: (bpm: number) => void;
@@ -821,6 +822,14 @@ export const useProjectStore = create<ProjectState>((set, get) => {
set({ isPlaying: false });
},
stopTransport: async () => {
if (get().isRecording) {
await get().stopRecording();
return;
}
await get().stopPlaying();
},
startRecording: async () => {
const { activeRegionId, timeSignature, playheadPosition, setPlayheadPosition } = get();
@@ -1242,4 +1251,3 @@ export const useProjectStore = create<ProjectState>((set, get) => {