diff --git a/main/src/domain/midi_types.rs b/main/src/domain/midi_types.rs index 5571131ac..f30775b42 100644 --- a/main/src/domain/midi_types.rs +++ b/main/src/domain/midi_types.rs @@ -1,4 +1,4 @@ -use reaper_medium::{Hz, MidiFrameOffset}; +use reaper_medium::{Hz, MIDI_INPUT_FRAME_RATE}; #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct MidiEvent { @@ -30,8 +30,8 @@ pub struct SampleOffset(u64); impl SampleOffset { pub const ZERO: SampleOffset = SampleOffset(0); - pub fn from_frame_offset(frame_offset: MidiFrameOffset, sample_rate: Hz) -> Self { - let offset_in_secs = frame_offset.get() as f64 / 1024000.0; + pub fn from_midi_input_frame_offset(frame_offset: u32, sample_rate: Hz) -> Self { + let offset_in_secs = frame_offset as f64 / MIDI_INPUT_FRAME_RATE.get(); let offset_in_samples = (offset_in_secs * sample_rate.get()).round() as u64; SampleOffset(offset_in_samples) } diff --git a/main/src/domain/real_time_processor.rs b/main/src/domain/real_time_processor.rs index 91cd32390..783cb1b54 100644 --- a/main/src/domain/real_time_processor.rs +++ b/main/src/domain/real_time_processor.rs @@ -1702,7 +1702,7 @@ impl<'a> MidiEvent> { ) -> Result { let msg = IncomingMidiMessage::from_reaper(e.message())?; // Frame offset is given in 1/1024000 of a second, *not* sample frames! - let offset = SampleOffset::from_frame_offset(e.frame_offset(), sample_rate); + let offset = SampleOffset::from_midi_input_frame_offset(e.frame_offset(), sample_rate); Ok(MidiEvent::new(offset, msg)) } } diff --git a/playtime-clip-engine b/playtime-clip-engine index 19d3160b4..f553fdb46 160000 --- a/playtime-clip-engine +++ b/playtime-clip-engine @@ -1 +1 @@ -Subproject commit 19d3160b4d02fb98c3f1f92021834b162a9fc10c +Subproject commit f553fdb46955b69bf571386ab248b5359480afa0