Enhanced visual design: - Improved device rack container with darker background and inner shadow - Device cards now have rounded corners, shadows, and colored indicators - Better visual separation between enabled/disabled effects - Active devices highlighted with accent border Complete automation infrastructure (Phase 9): - Created comprehensive type system for automation lanes and points - Implemented AutomationPoint component with drag-and-drop editing - Implemented AutomationHeader with mode controls (Read/Write/Touch/Latch) - Implemented AutomationLane with canvas-based curve rendering - Integrated automation lanes into Track component below effects - Created automation playback engine with real-time interpolation - Added automation data persistence to localStorage Automation features: - Add/remove automation points by clicking/double-clicking - Drag points to change time and value - Multiple automation modes (Read, Write, Touch, Latch) - Linear and step curve types (bezier planned) - Adjustable lane height (60-180px) - Show/hide automation per lane - Real-time value display at playhead - Color-coded lanes by parameter type - Keyboard delete support (Delete/Backspace) Track type updates: - Added automation field to Track interface - Updated track creation to initialize empty automation - Updated localStorage save/load to include automation data Files created: - components/automation/AutomationPoint.tsx - components/automation/AutomationHeader.tsx - components/automation/AutomationLane.tsx - lib/audio/automation/utils.ts (helper functions) - lib/audio/automation/playback.ts (playback engine) - types/automation.ts (complete type system) Files modified: - components/effects/EffectDevice.tsx (Ableton-style visual improvements) - components/tracks/Track.tsx (automation lanes integration) - types/track.ts (automation field added) - lib/audio/track-utils.ts (automation initialization) - lib/hooks/useMultiTrack.ts (automation persistence) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
1.4 KiB
TypeScript
72 lines
1.4 KiB
TypeScript
/**
|
|
* Multi-track types and interfaces
|
|
*/
|
|
|
|
import type { EffectChain } from '@/lib/audio/effects/chain';
|
|
import type { Selection } from './selection';
|
|
import type { AutomationLane } from './automation';
|
|
|
|
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;
|
|
|
|
// Automation
|
|
automation: {
|
|
lanes: AutomationLane[];
|
|
showAutomation: boolean; // Master show/hide toggle
|
|
};
|
|
|
|
// 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 = 180;
|
|
export const MIN_TRACK_HEIGHT = 60;
|
|
export const MAX_TRACK_HEIGHT = 300;
|