feat: added waveform view for audio regions
This commit is contained in:
@@ -176,6 +176,25 @@ describe('projectStore piano roll state', () => {
|
||||
expect(state.pianoRollViewRequestVersion).toBe(1);
|
||||
});
|
||||
|
||||
it('opens an audio region in waveform view and clears hybrid state', async () => {
|
||||
const { useProjectStore } = await import('./projectStore');
|
||||
|
||||
act(() => {
|
||||
useProjectStore.getState().openHybridMode('midi-a', 'audio-a');
|
||||
});
|
||||
|
||||
act(() => {
|
||||
useProjectStore.getState().openAudioWaveformViewer('audio-b');
|
||||
});
|
||||
|
||||
const state = useProjectStore.getState();
|
||||
expect(state.showPianoRoll).toBe(true);
|
||||
expect(state.pianoRollMode).toBe('audio-waveform');
|
||||
expect(state.activeRegionId).toBe('audio-b');
|
||||
expect(state.hybridAudioRegionId).toBeNull();
|
||||
expect(state.requestedSheetMusicViewEnabled).toBe(false);
|
||||
});
|
||||
|
||||
it('tracks playback preparation around startPlaying success', async () => {
|
||||
let resolveStart: (() => void) | null = null;
|
||||
mockCore.startPlaying.mockImplementationOnce(() => new Promise<void>((resolve) => {
|
||||
|
||||
@@ -109,7 +109,7 @@ interface ProjectState {
|
||||
// Piano roll state
|
||||
showPianoRoll: boolean;
|
||||
activeRegionId: string | null;
|
||||
pianoRollMode: 'midi-edit' | 'spectrogram' | 'hybrid';
|
||||
pianoRollMode: 'midi-edit' | 'audio-waveform' | 'spectrogram' | 'hybrid';
|
||||
hybridAudioRegionId: string | null;
|
||||
requestedSheetMusicViewEnabled: boolean;
|
||||
pianoRollViewRequestVersion: number;
|
||||
@@ -211,6 +211,7 @@ interface ProjectState {
|
||||
setActiveRegionId: (regionId: string | null) => void;
|
||||
openMidiPianoRoll: (regionId: string) => void;
|
||||
openMidiPianoRollWithSheetMusicView: (regionId: string, sheetMusicViewEnabled: boolean) => void;
|
||||
openAudioWaveformViewer: (regionId: string) => void;
|
||||
openSpectrogramViewer: (regionId: string) => void;
|
||||
openHybridMode: (midiRegionId: string, audioRegionId: string) => void;
|
||||
bumpAutomationRedrawVersion: () => void;
|
||||
@@ -1625,6 +1626,16 @@ export const useProjectStore = create<ProjectState>((set, get) => {
|
||||
}));
|
||||
},
|
||||
|
||||
openAudioWaveformViewer: (regionId: string) => {
|
||||
set({
|
||||
showPianoRoll: true,
|
||||
activeRegionId: regionId,
|
||||
pianoRollMode: 'audio-waveform',
|
||||
hybridAudioRegionId: null,
|
||||
requestedSheetMusicViewEnabled: false,
|
||||
});
|
||||
},
|
||||
|
||||
openSpectrogramViewer: (regionId: string) => {
|
||||
set({
|
||||
showPianoRoll: true,
|
||||
|
||||
Reference in New Issue
Block a user