fix: external audio drop creates sample track instead of Quick Sampler#918
fix: external audio drop creates sample track instead of Quick Sampler#918
Conversation
When dropping an external audio file on the empty timeline area, it was creating a Quick Sampler (piano roll) track instead of a sample track. The audio was invisible because Quick Sampler doesn't render waveform clips on the timeline. Now defaults to importAudioFile() which creates a proper sample track with visible waveform. Alt+Drop still creates Quick Sampler for users who want that workflow. Fixes both the main timeline drop zone and the empty track slot drop. Closes #916 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adjusts timeline drag/drop importing so external audio drops create a visible waveform sample track by default, while preserving Alt+Drop for Quick Sampler creation.
Changes:
- Timeline empty-area drop now imports audio as a sample track by default (Alt+Drop -> Quick Sampler).
- Empty track-slot drop handler updated to follow the same default behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (wantsQuickSampler) { | ||
| await importAudioFileAsNewQuickSampler(file); | ||
| } else { | ||
| await importAudioFile(file); |
There was a problem hiding this comment.
In EmptyTrackRow's drop handler, the non-Alt path calls importAudioFile(file), but importAudioFile always creates a new sample track at the end and always places the clip at startTime: 0. This ignores the computed startTime (based on the drop X position) and the slotIndex insertion semantics for an empty slot, so the resulting clip/track placement won’t match where the user dropped. Consider creating the new sample track with { order: slotIndex + 1 }, setting its display name, and then importing the file into that track at startTime (e.g., via the existing importAudioToTrack/buffer-to-track path).
| await importAudioFile(file); | |
| await importAudioFile(file, { | |
| startTime, | |
| trackOrder: slotIndex + 1, | |
| displayName: file.name, | |
| }); |
| // Audio files -> sample track (Alt+Drop -> Quick Sampler), MIDI files -> piano roll tracks | ||
| const wantsQuickSampler = e.altKey; | ||
| const files = e.dataTransfer.files; | ||
| if (files.length > 0) { | ||
| for (const file of Array.from(files)) { | ||
| if (file.type.startsWith('audio/') || /\.(wav|mp3|ogg|flac|aac|m4a|webm)$/i.test(file.name)) { | ||
| await importAudioFileAsNewQuickSampler(file); | ||
| if (wantsQuickSampler) { | ||
| await importAudioFileAsNewQuickSampler(file); | ||
| } else { |
There was a problem hiding this comment.
The drop behavior changed (audio drop => sample track, Alt+Drop => Quick Sampler) in both the main timeline drop zone and the empty-slot drop handler, but there doesn’t appear to be any unit test coverage for these paths. Please add a Timeline drag/drop test (similar to the existing timeline/TrackLane tests) that asserts importAudioFile is called for normal drops and importAudioFileAsNewQuickSampler is called when altKey is true.
|
Generated by Claude Code |
Summary
Root Cause
Timeline.tsxcalledimportAudioFileAsNewQuickSampler()for all external audio drops, which creates an invisible piano roll track. Changed toimportAudioFile()which creates a proper sample track with waveform rendering.Test plan
.wav/.mp3file from Finder onto the empty timeline area → should create a sample track with visible waveformCloses #916
🤖 Generated with Claude Code