2025-11-18 08:09:49 +01:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import * as React from 'react';
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
import { ChevronLeft, ChevronRight, Power, X } from 'lucide-react';
|
2025-11-18 08:09:49 +01:00
|
|
|
import { Button } from '@/components/ui/Button';
|
|
|
|
|
import { cn } from '@/lib/utils/cn';
|
|
|
|
|
import type { ChainEffect } from '@/lib/audio/effects/chain';
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
import { EffectParameters } from './EffectParameters';
|
2025-11-18 08:09:49 +01:00
|
|
|
|
|
|
|
|
export interface EffectDeviceProps {
|
|
|
|
|
effect: ChainEffect;
|
|
|
|
|
onToggleEnabled?: () => void;
|
|
|
|
|
onRemove?: () => void;
|
|
|
|
|
onUpdateParameters?: (parameters: any) => void;
|
2025-11-18 18:13:38 +01:00
|
|
|
onToggleExpanded?: () => void;
|
2025-11-18 23:29:18 +01:00
|
|
|
trackId?: string;
|
|
|
|
|
isPlaying?: boolean;
|
|
|
|
|
onParameterTouched?: (trackId: string, laneId: string, touched: boolean) => void;
|
|
|
|
|
automationLanes?: Array<{ id: string; parameterId: string; mode: string }>;
|
2025-11-18 08:09:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function EffectDevice({
|
|
|
|
|
effect,
|
|
|
|
|
onToggleEnabled,
|
|
|
|
|
onRemove,
|
|
|
|
|
onUpdateParameters,
|
2025-11-18 18:13:38 +01:00
|
|
|
onToggleExpanded,
|
2025-11-18 23:29:18 +01:00
|
|
|
trackId,
|
|
|
|
|
isPlaying,
|
|
|
|
|
onParameterTouched,
|
|
|
|
|
automationLanes,
|
2025-11-18 08:09:49 +01:00
|
|
|
}: EffectDeviceProps) {
|
2025-11-18 18:13:38 +01:00
|
|
|
const isExpanded = effect.expanded || false;
|
2025-11-18 08:09:49 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
2025-11-18 18:13:38 +01:00
|
|
|
'flex-shrink-0 flex flex-col h-full transition-all duration-200 overflow-hidden rounded-md',
|
2025-11-18 16:30:01 +01:00
|
|
|
effect.enabled
|
2025-11-18 18:13:38 +01:00
|
|
|
? 'bg-card border-l border-r border-b border-border'
|
|
|
|
|
: 'bg-card/40 border-l border-r border-b border-border/50 opacity-60 hover:opacity-80',
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
isExpanded ? 'min-w-96' : 'w-10'
|
2025-11-18 08:09:49 +01:00
|
|
|
)}
|
|
|
|
|
>
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
{!isExpanded ? (
|
2025-11-18 16:30:01 +01:00
|
|
|
/* Collapsed State */
|
|
|
|
|
<>
|
|
|
|
|
{/* Colored top indicator */}
|
|
|
|
|
<div className={cn('h-0.5 w-full', effect.enabled ? 'bg-primary' : 'bg-muted-foreground/20')} />
|
|
|
|
|
|
|
|
|
|
<button
|
2025-11-18 18:13:38 +01:00
|
|
|
onClick={onToggleExpanded}
|
2025-11-18 16:30:01 +01:00
|
|
|
className="w-full h-full flex flex-col items-center justify-between py-1 hover:bg-primary/10 transition-colors group"
|
|
|
|
|
title={`Expand ${effect.name}`}
|
2025-11-18 08:09:49 +01:00
|
|
|
>
|
2025-11-18 16:30:01 +01:00
|
|
|
<ChevronRight className="h-3 w-3 flex-shrink-0 text-muted-foreground group-hover:text-primary transition-colors" />
|
|
|
|
|
<span
|
|
|
|
|
className="flex-1 text-xs font-medium whitespace-nowrap text-muted-foreground group-hover:text-primary transition-colors"
|
|
|
|
|
style={{
|
|
|
|
|
writingMode: 'vertical-rl',
|
|
|
|
|
textOrientation: 'mixed',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{effect.name}
|
|
|
|
|
</span>
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
'w-1.5 h-1.5 rounded-full flex-shrink-0 mb-1',
|
|
|
|
|
effect.enabled ? 'bg-primary shadow-sm shadow-primary/50' : 'bg-muted-foreground/30'
|
|
|
|
|
)}
|
|
|
|
|
title={effect.enabled ? 'Enabled' : 'Disabled'}
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
</>
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
) : (
|
|
|
|
|
<>
|
2025-11-18 16:30:01 +01:00
|
|
|
{/* Colored top indicator */}
|
|
|
|
|
<div className={cn('h-0.5 w-full', effect.enabled ? 'bg-primary' : 'bg-muted-foreground/20')} />
|
|
|
|
|
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
{/* Full-Width Header Row */}
|
2025-11-18 16:30:01 +01:00
|
|
|
<div className="flex items-center gap-1 px-2 py-1.5 border-b border-border/50 bg-muted/30 flex-shrink-0">
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon-sm"
|
2025-11-18 18:13:38 +01:00
|
|
|
onClick={onToggleExpanded}
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
title="Collapse device"
|
|
|
|
|
className="h-5 w-5 flex-shrink-0"
|
|
|
|
|
>
|
|
|
|
|
<ChevronLeft className="h-3 w-3" />
|
|
|
|
|
</Button>
|
|
|
|
|
<span className="text-xs font-semibold flex-1 min-w-0 truncate">{effect.name}</span>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon-sm"
|
|
|
|
|
onClick={onToggleEnabled}
|
|
|
|
|
title={effect.enabled ? 'Disable effect' : 'Enable effect'}
|
|
|
|
|
className="h-5 w-5 flex-shrink-0"
|
|
|
|
|
>
|
|
|
|
|
<Power
|
|
|
|
|
className={cn(
|
|
|
|
|
'h-3 w-3',
|
|
|
|
|
effect.enabled ? 'text-primary' : 'text-muted-foreground'
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="icon-sm"
|
|
|
|
|
onClick={onRemove}
|
|
|
|
|
title="Remove effect"
|
|
|
|
|
className="h-5 w-5 flex-shrink-0"
|
|
|
|
|
>
|
|
|
|
|
<X className="h-3 w-3 text-destructive" />
|
|
|
|
|
</Button>
|
2025-11-18 08:09:49 +01:00
|
|
|
</div>
|
|
|
|
|
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
{/* Device Body */}
|
2025-11-18 16:30:01 +01:00
|
|
|
<div className="flex-1 min-h-0 overflow-y-auto custom-scrollbar p-3 bg-card/50">
|
2025-11-18 23:29:18 +01:00
|
|
|
<EffectParameters
|
|
|
|
|
effect={effect}
|
|
|
|
|
onUpdateParameters={onUpdateParameters}
|
|
|
|
|
trackId={trackId}
|
|
|
|
|
isPlaying={isPlaying}
|
|
|
|
|
onParameterTouched={onParameterTouched}
|
|
|
|
|
automationLanes={automationLanes}
|
|
|
|
|
/>
|
feat: complete Phase 7.4 - real-time track effects system
Implemented comprehensive real-time effect processing for multi-track audio:
Core Features:
- Per-track effect chains with drag-and-drop reordering
- Effect bypass/enable toggle per effect
- Real-time parameter updates (filters, dynamics, time-based, distortion, bitcrusher, pitch, timestretch)
- Add/remove effects during playback without interruption
- Effect chain persistence via localStorage
- Automatic playback stop when tracks are deleted
Technical Implementation:
- Effect processor with dry/wet routing for bypass functionality
- Real-time effect parameter updates using AudioParam setValueAtTime
- Structure change detection for add/remove/reorder operations
- Stale closure fix using refs for latest track state
- ScriptProcessorNode for bitcrusher, pitch shifter, and time stretch
- Dual-tap delay line for pitch shifting
- Overlap-add synthesis for time stretching
UI Components:
- EffectBrowser dialog with categorized effects
- EffectDevice component with parameter controls
- EffectParameters for all 19 real-time effect types
- Device rack with horizontal scrolling (Ableton-style)
Removed offline-only effects (normalize, fadeIn, fadeOut, reverse) as they don't fit the real-time processing model.
Completed all items in Phase 7.4:
- [x] Per-track effect chain
- [x] Effect rack UI
- [x] Effect bypass per track
- [x] Real-time effect processing during playback
- [x] Add/remove effects during playback
- [x] Real-time parameter updates
- [x] Effect chain persistence
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:08:33 +01:00
|
|
|
</div>
|
|
|
|
|
</>
|
2025-11-18 08:09:49 +01:00
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|