'use client'; import * as React from 'react'; import { X, Download } from 'lucide-react'; import { Button } from '@/components/ui/Button'; import { cn } from '@/lib/utils/cn'; export interface ExportSettings { format: 'wav' | 'mp3'; scope: 'project' | 'selection' | 'tracks'; // Export scope bitDepth: 16 | 24 | 32; bitrate: number; // For MP3: 128, 192, 256, 320 kbps normalize: boolean; filename: string; } export interface ExportDialogProps { open: boolean; onClose: () => void; onExport: (settings: ExportSettings) => void; isExporting?: boolean; hasSelection?: boolean; // Whether any track has a selection } export function ExportDialog({ open, onClose, onExport, isExporting, hasSelection }: ExportDialogProps) { const [settings, setSettings] = React.useState({ format: 'wav', scope: 'project', bitDepth: 16, bitrate: 192, // Default MP3 bitrate normalize: true, filename: 'mix', }); const handleExport = () => { onExport(settings); }; if (!open) return null; return (
{/* Header */}

Export Audio

{/* Settings */}
{/* Filename */}
setSettings({ ...settings, filename: e.target.value })} className="w-full px-3 py-2 bg-background border border-border rounded text-foreground focus:outline-none focus:ring-2 focus:ring-primary" disabled={isExporting} />

.{settings.format} will be added automatically

{/* Format */}
{/* Export Scope */}

{settings.scope === 'project' && 'Mix all tracks into a single file'} {settings.scope === 'selection' && 'Export only the selected region'} {settings.scope === 'tracks' && 'Export each track as a separate file'}

{/* Bit Depth (WAV only) */} {settings.format === 'wav' && (
{[16, 24, 32].map((depth) => ( ))}
)} {/* MP3 Bitrate */} {settings.format === 'mp3' && (
{[128, 192, 256, 320].map((rate) => ( ))}
)} {/* Normalize */}

Prevents clipping by adjusting peak levels

{/* Actions */}
); }