mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-17 05:40:42 -07:00
- Introduced the FloatingGenerateBox component for audio generation, enhancing user interaction with voice profiles. - Updated App component to integrate FloatingGenerateBox and removed the GenerationForm component. - Enhanced the layout for better responsiveness and added functionality to manage audio playback state. - Updated UpdateStatus component to include new update handling logic and improved UI feedback for update readiness.
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
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',
|
|
},
|
|
),
|
|
);
|