feat: complete Phase 9.3 - automation recording with write/touch/latch modes

Implemented comprehensive automation recording system for volume, pan, and effect parameters:

- Added automation recording modes:
  - Write: Records continuously during playback when values change
  - Touch: Records only while control is being touched/moved
  - Latch: Records from first touch until playback stops

- Implemented value change detection (0.001 threshold) to prevent infinite loops
- Fixed React setState-in-render errors by:
  - Using queueMicrotask() to defer state updates
  - Moving lane creation logic to useEffect
  - Properly memoizing touch handlers with useMemo

- Added proper value ranges for effect parameters:
  - Frequency: 20-20000 Hz
  - Q: 0.1-20
  - Gain: -40-40 dB

- Enhanced automation lane auto-creation with parameter-specific ranges
- Added touch callbacks to all parameter controls (volume, pan, effects)
- Implemented throttling (100ms) to avoid excessive automation points

Technical improvements:
- Used tracksRef and onRecordAutomationRef to ensure latest values in animation loops
- Added proper cleanup on playback stop
- Optimized recording to only trigger when values actually change

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-18 23:29:18 +01:00
parent a1f230a6e6
commit c54d5089c5
13 changed files with 1040 additions and 70 deletions

23
PLAN.md
View File

@@ -643,15 +643,21 @@ audio-ui/
- [ ] Copy/Paste automation
- [ ] Bezier curves
#### 9.3 Automation Playback
#### 9.3 Automation Playback & Recording
- [x] Real-time automation during playback
- [x] Automation for volume and pan
- [x] Automation for effect parameters
- [x] Continuous evaluation via requestAnimationFrame
- [x] Proper parameter range conversion
- [ ] Automation recording (write mode)
- [x] Automation recording (write mode) - Volume, Pan, Effect Parameters
- [x] Automation editing modes UI (read/write/touch/latch)
- [ ] Automation modes recording implementation (write/touch/latch)
- [x] Automation modes recording implementation (write/touch/latch)
- [x] Touch/latch mode tracking with control interaction
- [x] Throttled automation point creation (every ~100ms)
- [x] Parameter touch callbacks for volume and pan controls
- [x] Parameter touch callbacks for effect parameter sliders
- [x] Touch/latch modes for effect parameters (frequency, Q, gain, etc.)
- [x] Proper prop passing through EffectDevice → EffectParameters → Slider
### Phase 10: Analysis Tools
@@ -684,18 +690,21 @@ audio-ui/
### Phase 11: Export & Import
#### 11.1 Export Formats
- [ ] WAV export (PCM, various bit depths)
- [x] WAV export (PCM, various bit depths: 16/24/32-bit)
- [x] Export dialog with settings UI
- [x] Export button in header
- [x] Mix all tracks before export
- [ ] MP3 export (using lamejs)
- [ ] OGG Vorbis export
- [ ] FLAC export (using fflate)
- [ ] Format selection UI
#### 11.2 Export Settings
- [x] Bit depth selection (16/24/32-bit)
- [x] Normalization before export (with 1% headroom)
- [x] Filename customization
- [ ] Sample rate conversion
- [ ] Bit depth selection
- [ ] Quality/bitrate settings (for lossy formats)
- [ ] Dithering options
- [ ] Normalization before export
#### 11.3 Export Regions
- [ ] Export entire project