mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-19 14:50:38 -07:00
Implement audio channel management features
- Added new components for managing audio channels, including creation, updating, and deletion of channels. - Introduced a new AudioTab for channel management and integrated it into the main application layout. - Updated the API client to support audio channel operations and added corresponding backend endpoints. - Enhanced the player store to handle audio playback routing through assigned channels. - Refactored existing components to accommodate the new audio channel functionality, including updates to the HistoryTable and GenerationForm for profile-channel associations. - Improved sidebar navigation to include new tabs for Voices and Audio management.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
|
||||
export interface AudioChannel {
|
||||
id: string;
|
||||
name: string;
|
||||
is_default: boolean;
|
||||
device_ids: string[];
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
interface AudioChannelStore {
|
||||
channels: AudioChannel[];
|
||||
setChannels: (channels: AudioChannel[]) => void;
|
||||
addChannel: (channel: AudioChannel) => void;
|
||||
updateChannel: (id: string, channel: Partial<AudioChannel>) => void;
|
||||
removeChannel: (id: string) => void;
|
||||
}
|
||||
|
||||
export const useAudioChannelStore = create<AudioChannelStore>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
channels: [],
|
||||
setChannels: (channels) => set({ channels }),
|
||||
addChannel: (channel) =>
|
||||
set((state) => ({
|
||||
channels: [...state.channels, channel],
|
||||
})),
|
||||
updateChannel: (id, updates) =>
|
||||
set((state) => ({
|
||||
channels: state.channels.map((ch) =>
|
||||
ch.id === id ? { ...ch, ...updates } : ch,
|
||||
),
|
||||
})),
|
||||
removeChannel: (id) =>
|
||||
set((state) => ({
|
||||
channels: state.channels.filter((ch) => ch.id !== id),
|
||||
})),
|
||||
}),
|
||||
{
|
||||
name: 'voicebox-audio-channels',
|
||||
},
|
||||
),
|
||||
);
|
||||
Reference in New Issue
Block a user