diff --git a/plugins/examples/sine/src/lib.rs b/plugins/examples/sine/src/lib.rs index 7d7a8b1e..a597fad4 100644 --- a/plugins/examples/sine/src/lib.rs +++ b/plugins/examples/sine/src/lib.rs @@ -139,7 +139,7 @@ impl Plugin for Sine { } fn process(&mut self, buffer: &mut Buffer, context: &mut impl ProcessContext) -> ProcessStatus { - let mut next_event = context.next_midi_event(); + let mut next_event = context.next_event(); for (sample_id, channel_samples) in buffer.iter_samples().enumerate() { // Smoothing is optionally built into the parameters themselves let gain = self.params.gain.smoothed.next(); @@ -168,7 +168,7 @@ impl Plugin for Sine { _ => break 'midi_events, } - next_event = context.next_midi_event(); + next_event = context.next_event(); } // This gain envelope prevents clicks with new notes and with released notes diff --git a/src/context.rs b/src/context.rs index cbbd263d..e0cb950c 100644 --- a/src/context.rs +++ b/src/context.rs @@ -19,12 +19,9 @@ pub trait ProcessContext { /// Get information about the current transport position and status. fn transport(&self) -> &Transport; - /// 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(&mut self) -> Option; + /// Return the next note event, if there is one. Use [`NoteEvent::timing()`] to get the event's + /// timing within the buffer. + fn next_event(&mut self) -> Option; /// Update the current latency of the plugin. If the plugin is currently processing audio, then /// this may cause audio playback to be restarted. diff --git a/src/wrapper/clap/context.rs b/src/wrapper/clap/context.rs index ea24d50b..0f9527e1 100644 --- a/src/wrapper/clap/context.rs +++ b/src/wrapper/clap/context.rs @@ -95,7 +95,7 @@ impl ProcessContext for WrapperProcessContext<'_, P> { &self.transport } - fn next_midi_event(&mut self) -> Option { + fn next_event(&mut self) -> Option { self.input_events_guard.pop_front() } diff --git a/src/wrapper/vst3/context.rs b/src/wrapper/vst3/context.rs index beeae62d..1ea594c5 100644 --- a/src/wrapper/vst3/context.rs +++ b/src/wrapper/vst3/context.rs @@ -104,7 +104,7 @@ impl ProcessContext for WrapperProcessContext<'_, P> { &self.transport } - fn next_midi_event(&mut self) -> Option { + fn next_event(&mut self) -> Option { self.input_events_guard.pop_front() }