mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-18 06:10:43 -07:00
Adds a full effects pipeline powered by Spotify's pedalboard library, enabling users to apply professional DSP effects (flanger, reverb, delay, compressor, pitch shift, filters, gain) to generated audio. Key features: - Effects chain editor with drag-and-drop reordering (dnd-kit) - Generation versions: clean copy always saved, processed versions created on top - Built-in presets (Robotic, Radio, Echo Chamber, Deep Voice) + custom user presets - Per-profile default effects chain (auto-applied to new generations) - Per-generation effects override from the generation form - Apply effects to existing generations from history (creates new version) - Ephemeral preview endpoint for auditioning effects without persisting - Dedicated Effects sidebar tab with preset management and live preview - Version switcher in history cards with expandable panel - Backward-compatible: existing generations backfilled as clean versions
150 lines
3.9 KiB
TypeScript
150 lines
3.9 KiB
TypeScript
import { createRootRoute, createRoute, createRouter, Outlet } from '@tanstack/react-router';
|
|
import { AppFrame } from '@/components/AppFrame/AppFrame';
|
|
import { AudioTab } from '@/components/AudioTab/AudioTab';
|
|
import { EffectsTab } from '@/components/EffectsTab/EffectsTab';
|
|
import { MainEditor } from '@/components/MainEditor/MainEditor';
|
|
import { ModelsTab } from '@/components/ModelsTab/ModelsTab';
|
|
import { ServerTab } from '@/components/ServerTab/ServerTab';
|
|
import { Sidebar } from '@/components/Sidebar';
|
|
import { StoriesTab } from '@/components/StoriesTab/StoriesTab';
|
|
import { Toaster } from '@/components/ui/toaster';
|
|
import { VoicesTab } from '@/components/VoicesTab/VoicesTab';
|
|
import { useGenerationProgress } from '@/lib/hooks/useGenerationProgress';
|
|
import { useModelDownloadToast } from '@/lib/hooks/useModelDownloadToast';
|
|
import { MODEL_DISPLAY_NAMES, useRestoreActiveTasks } from '@/lib/hooks/useRestoreActiveTasks';
|
|
|
|
// Simple platform check that works in both web and Tauri
|
|
const isMacOS = () => navigator.platform.toLowerCase().includes('mac');
|
|
|
|
// Root layout component
|
|
function RootLayout() {
|
|
// Monitor active downloads/generations and show toasts for them
|
|
const activeDownloads = useRestoreActiveTasks();
|
|
|
|
// Subscribe to SSE for pending generations — handles completion, auto-play, and history refresh
|
|
useGenerationProgress();
|
|
|
|
return (
|
|
<AppFrame>
|
|
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
<Sidebar isMacOS={isMacOS()} />
|
|
|
|
<main className="flex-1 ml-20 overflow-hidden flex flex-col">
|
|
<div className="container mx-auto px-8 max-w-[1800px] h-full overflow-hidden flex flex-col">
|
|
<Outlet />
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
{/* Show download toasts for any active downloads (from anywhere) */}
|
|
{activeDownloads.map((download) => {
|
|
const displayName = MODEL_DISPLAY_NAMES[download.model_name] || download.model_name;
|
|
return (
|
|
<DownloadToastRestorer
|
|
key={download.model_name}
|
|
modelName={download.model_name}
|
|
displayName={displayName}
|
|
/>
|
|
);
|
|
})}
|
|
|
|
<Toaster />
|
|
</AppFrame>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Component that restores a download toast for a specific model.
|
|
*/
|
|
function DownloadToastRestorer({
|
|
modelName,
|
|
displayName,
|
|
}: {
|
|
modelName: string;
|
|
displayName: string;
|
|
}) {
|
|
// Use the download toast hook to restore the toast
|
|
useModelDownloadToast({
|
|
modelName,
|
|
displayName,
|
|
enabled: true,
|
|
});
|
|
|
|
return null;
|
|
}
|
|
|
|
// Root route with layout
|
|
const rootRoute = createRootRoute({
|
|
component: RootLayout,
|
|
});
|
|
|
|
// Index route (main/generate)
|
|
const indexRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/',
|
|
component: MainEditor,
|
|
});
|
|
|
|
// Stories route
|
|
const storiesRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/stories',
|
|
component: StoriesTab,
|
|
});
|
|
|
|
// Voices route
|
|
const voicesRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/voices',
|
|
component: VoicesTab,
|
|
});
|
|
|
|
// Audio route
|
|
const audioRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/audio',
|
|
component: AudioTab,
|
|
});
|
|
|
|
// Effects route
|
|
const effectsRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/effects',
|
|
component: EffectsTab,
|
|
});
|
|
|
|
// Models route
|
|
const modelsRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/models',
|
|
component: ModelsTab,
|
|
});
|
|
|
|
// Server route
|
|
const serverRoute = createRoute({
|
|
getParentRoute: () => rootRoute,
|
|
path: '/server',
|
|
component: ServerTab,
|
|
});
|
|
|
|
// Route tree
|
|
const routeTree = rootRoute.addChildren([
|
|
indexRoute,
|
|
storiesRoute,
|
|
voicesRoute,
|
|
audioRoute,
|
|
effectsRoute,
|
|
modelsRoute,
|
|
serverRoute,
|
|
]);
|
|
|
|
// Create router
|
|
export const router = createRouter({ routeTree });
|
|
|
|
// Register router for type safety
|
|
declare module '@tanstack/react-router' {
|
|
interface Register {
|
|
router: typeof router;
|
|
}
|
|
}
|