MIDI recording

This commit is contained in:
Skyler Lehmkuhl
2025-10-29 01:50:45 -04:00
parent 6e7e90fe57
commit dc32fc4200
19 changed files with 1470 additions and 132 deletions
+3 -2
View File
@@ -6,7 +6,7 @@ use std::path::Path;
pub fn load_midi_file<P: AsRef<Path>>(
path: P,
clip_id: MidiClipId,
sample_rate: u32,
_sample_rate: u32,
) -> Result<MidiClip, String> {
// Read the MIDI file
let data = fs::read(path.as_ref()).map_err(|e| format!("Failed to read MIDI file: {}", e))?;
@@ -109,7 +109,8 @@ pub fn load_midi_file<P: AsRef<Path>>(
accumulated_time += delta_time;
last_tick = tick;
let timestamp = (accumulated_time * sample_rate as f64) as u64;
// Store timestamp in seconds (sample-rate independent)
let timestamp = accumulated_time;
match message {
midly::MidiMessage::NoteOn { key, vel } => {