Add virtual piano

This commit is contained in:
Skyler Lehmkuhl
2025-11-30 11:01:07 -05:00
parent c943f7bfe6
commit 8f1934ab59
7 changed files with 537 additions and 4 deletions
+10
View File
@@ -534,6 +534,10 @@ impl Engine {
// Notify UI about the new MIDI track
let _ = self.event_tx.push(AudioEvent::TrackCreated(track_id, false, name));
}
Command::AddMidiClipToPool(clip) => {
// Add the clip to the pool without placing it on any track
self.project.midi_clip_pool.add_existing_clip(clip);
}
Command::CreateMidiClip(track_id, start_time, duration) => {
// Get the next MIDI clip ID from the atomic counter
let clip_id = self.next_midi_clip_id_atomic.fetch_add(1, Ordering::Relaxed);
@@ -2083,6 +2087,12 @@ impl EngineController {
let _ = self.command_tx.push(Command::CreateMidiTrack(name));
}
/// Add a MIDI clip to the pool without placing it on any track
/// This is useful for importing MIDI files into a clip library
pub fn add_midi_clip_to_pool(&mut self, clip: MidiClip) {
let _ = self.command_tx.push(Command::AddMidiClipToPool(clip));
}
/// Create a new audio track synchronously (waits for creation to complete)
pub fn create_audio_track_sync(&mut self, name: String) -> Result<TrackId, String> {
if let Err(_) = self.query_tx.push(Query::CreateAudioTrackSync(name)) {