Add a function for retrieving the next note event
This commit is contained in:
parent
0e67c61be0
commit
fdfd1b01c2
2 changed files with 13 additions and 0 deletions
|
@ -24,6 +24,8 @@ mod linux;
|
||||||
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
|
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
|
||||||
pub(crate) use linux::LinuxEventLoop as OsEventLoop;
|
pub(crate) use linux::LinuxEventLoop as OsEventLoop;
|
||||||
|
|
||||||
|
use crate::plugin::NoteEvent;
|
||||||
|
|
||||||
pub(crate) const TASK_QUEUE_CAPACITY: usize = 512;
|
pub(crate) const TASK_QUEUE_CAPACITY: usize = 512;
|
||||||
|
|
||||||
// TODO: ProcessContext for parameter automation and sending events
|
// TODO: ProcessContext for parameter automation and sending events
|
||||||
|
@ -41,6 +43,13 @@ pub trait ProcessContext {
|
||||||
/// this may cause audio playback to be restarted.
|
/// this may cause audio playback to be restarted.
|
||||||
fn set_latency_samples(&self, samples: u32);
|
fn set_latency_samples(&self, samples: u32);
|
||||||
|
|
||||||
|
/// Return the next note event, if there is one. The event contains the timing
|
||||||
|
///
|
||||||
|
/// TODO: Rethink this API, both in terms of ergonomics, and if we can do this in a way that
|
||||||
|
/// doesn't require locks (because of the thread safe-ness, which we don't really need
|
||||||
|
/// here)
|
||||||
|
fn next_midi_event(&self) -> Option<NoteEvent>;
|
||||||
|
|
||||||
// // TODO: Add this next
|
// // TODO: Add this next
|
||||||
// fn set_parameter<P>(&self, param: &P, value: P::Plain)
|
// fn set_parameter<P>(&self, param: &P, value: P::Plain)
|
||||||
// where
|
// where
|
||||||
|
|
|
@ -331,6 +331,10 @@ impl<P: Plugin> ProcessContext for WrapperInner<'_, P> {
|
||||||
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
nih_debug_assert!(task_posted, "The task queue is full, dropping task...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn next_midi_event(&self) -> Option<NoteEvent> {
|
||||||
|
self.input_events.write().pop_front()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<P: Plugin> IPluginBase for Wrapper<'_, P> {
|
impl<P: Plugin> IPluginBase for Wrapper<'_, P> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue