Skip to content

Commit

Permalink
#405 Remove lag when generating MIDI messages to FX output (via "MIDI…
Browse files Browse the repository at this point in the history
…: Send message" target)

by respecting and forwarding sample offset of incoming event
  • Loading branch information
helgoboss committed Jul 16, 2021
1 parent 482c070 commit ec3540c
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 70 deletions.
14 changes: 7 additions & 7 deletions main/src/domain/midi_types.rs
@@ -1,26 +1,26 @@
use reaper_medium::{Hz, MidiFrameOffset};

#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct MidiEvent<T> {
pub struct Event<T> {
offset: SampleOffset,
msg: T,
payload: T,
}

impl<T: Copy> MidiEvent<T> {
impl<T: Copy> Event<T> {
pub fn without_offset(msg: T) -> Self {
Self::new(SampleOffset::ZERO, msg)
}

pub fn new(offset: SampleOffset, msg: T) -> Self {
Self { offset, msg }
pub fn new(offset: SampleOffset, payload: T) -> Self {
Self { offset, payload }
}

pub fn offset(&self) -> SampleOffset {
self.offset
}

pub fn msg(&self) -> T {
self.msg
pub fn payload(&self) -> T {
self.payload
}
}

Expand Down

0 comments on commit ec3540c

Please sign in to comment.