Commit Graph

12 Commits

Author SHA1 Message Date
Skyler Lehmkuhl 8ed2320dca Type AudioClip duration by clip kind; fix MIDI clips growing too fast
The MIDI-clip-end-grows-too-fast bug was a units confusion: AudioClip.duration
is documented "seconds" but MIDI clips store their length in BEATS (they share
the AudioClip struct with sampled clips). The timeline's effective_clip_duration
read it as raw seconds, so at 120 BPM a MIDI clip rendered ~2x too long. The old
backend-snapshot display had hidden this by forcing timeline_duration in beats.

Root fix — make the domain explicit and unforgeable:
- `duration` is now a private field. Reading it in the wrong unit is impossible
  because access goes through typed accessors: AudioClip::content_duration() ->
  ClipDuration (a Seconds|Beats enum tagged by clip_type) and
  set_content_duration(). serde still serializes the private field, so the .beam
  format is unchanged (bare number).
- ClipDuration::to_seconds(tempo_map) for display/sizing; ::native() for code
  that already works in the clip's native domain (trim math shares it).
- get_clip_duration + the timeline-endpoint calc go through to_seconds, so MIDI
  is converted correctly; effective_clip_duration delegates to get_clip_duration.
- Recording mirrors (audio/MIDI progress + finalize) write via set_content_duration
  (debug-asserts the value's domain matches the clip type).

Every former raw read/write of the field (core actions, timeline, piano roll,
infopanel, asset library, recording handlers) now goes through the accessors.
Whole workspace compiles; 299 core tests pass.
2026-07-11 19:23:37 -04:00
Skyler Lehmkuhl fa40173562 Add automatable volume and pan control to default instruments 2026-03-23 23:27:05 -04:00
Skyler Lehmkuhl 7a3f522735 Give metatracks explicit node graphs 2026-03-10 20:20:46 -04:00
Skyler Lehmkuhl cbdd277184 Add audio export 2025-11-24 01:03:31 -05:00
Skyler Lehmkuhl 06314dbf57 Add MIDI input 2025-11-03 06:16:17 -05:00
Skyler Lehmkuhl 1ee86af94d File save/load for audio projects 2025-11-03 02:46:43 -05:00
Skyler Lehmkuhl 2e9699b524 Add sampler nodes and startup screen 2025-10-28 01:32:51 -04:00
Skyler Lehmkuhl e57ae51397 Fix preset loading, add LFO, noise, pan and splitter nodes 2025-10-25 07:29:14 -04:00
Skyler Lehmkuhl 16f4a2a359 Add audio node graph editing 2025-10-25 03:29:54 -04:00
Skyler Lehmkuhl 48ec738027 add recording and reset function 2025-10-22 20:06:02 -04:00
Skyler Lehmkuhl 7ef562917a midi import in daw backend 2025-10-18 21:46:40 -04:00
Skyler Lehmkuhl 9414bdcd74 Work on daw backend 2025-10-18 18:09:07 -04:00