1
0
Fork 0

Rename next_midi_event() to next_event()

This commit is contained in:
Robbert van der Helm 2022-04-11 18:14:25 +02:00
parent eb5b81fcac
commit e4606918e7
4 changed files with 7 additions and 10 deletions

View file

@ -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

View file

@ -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<NoteEvent>;
/// 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<NoteEvent>;
/// Update the current latency of the plugin. If the plugin is currently processing audio, then
/// this may cause audio playback to be restarted.

View file

@ -95,7 +95,7 @@ impl<P: ClapPlugin> ProcessContext for WrapperProcessContext<'_, P> {
&self.transport
}
fn next_midi_event(&mut self) -> Option<NoteEvent> {
fn next_event(&mut self) -> Option<NoteEvent> {
self.input_events_guard.pop_front()
}

View file

@ -104,7 +104,7 @@ impl<P: Vst3Plugin> ProcessContext for WrapperProcessContext<'_, P> {
&self.transport
}
fn next_midi_event(&mut self) -> Option<NoteEvent> {
fn next_event(&mut self) -> Option<NoteEvent> {
self.input_events_guard.pop_front()
}