Files
audio-ui/types/track.ts
Sebastian Krüger 74879a42cf feat: implement multi-track waveform selection and editing with undo/redo
Added comprehensive selection and editing capabilities to multi-track editor:
- Visual selection overlay with Shift+drag interaction on waveforms
- Multi-track edit commands (cut, copy, paste, delete, duplicate)
- Full keyboard shortcut support (Ctrl+X/C/V/D, Delete, Ctrl+Z/Y)
- Complete undo/redo integration via command pattern
- Per-track selection state with localStorage persistence
- Audio buffer manipulation utilities (extract, insert, delete, duplicate segments)
- Toast notifications for all edit operations
- Red playhead to distinguish from blue selection overlay

All edit operations are fully undoable and integrated with the existing
history manager system.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:05:05 +01:00

65 lines
1.3 KiB
TypeScript

/**
* Multi-track types and interfaces
*/
import type { EffectChain } from '@/lib/audio/effects/chain';
import type { Selection } from './selection';
export interface Track {
id: string;
name: string;
color: string;
height: number;
audioBuffer: AudioBuffer | null;
// Track controls
volume: number; // 0-1
pan: number; // -1 (left) to 1 (right)
mute: boolean;
solo: boolean;
recordEnabled: boolean;
// Effects
effectChain: EffectChain;
// UI state
collapsed: boolean;
selected: boolean;
// Selection (for editing operations)
selection: Selection | null;
}
export interface TrackState {
tracks: Track[];
selectedTrackId: string | null;
soloedTracks: Set<string>;
}
export type TrackColor =
| 'red'
| 'orange'
| 'yellow'
| 'green'
| 'blue'
| 'indigo'
| 'purple'
| 'pink'
| 'gray';
export const TRACK_COLORS: Record<TrackColor, string> = {
red: 'rgb(239, 68, 68)',
orange: 'rgb(249, 115, 22)',
yellow: 'rgb(234, 179, 8)',
green: 'rgb(34, 197, 94)',
blue: 'rgb(59, 130, 246)',
indigo: 'rgb(99, 102, 241)',
purple: 'rgb(168, 85, 247)',
pink: 'rgb(236, 72, 153)',
gray: 'rgb(156, 163, 175)',
};
export const DEFAULT_TRACK_HEIGHT = 120;
export const MIN_TRACK_HEIGHT = 60;
export const MAX_TRACK_HEIGHT = 300;