Skip to main content

MpeEngine

Struct MpeEngine 

Source
pub struct MpeEngine { /* private fields */ }
Expand description

MPE engine for managing per-note expression.

Implementations§

Source§

impl MpeEngine

Source

pub fn new() -> Self

Creates a new MPE engine with default configuration.

Source

pub fn with_config(config: MpeConfig) -> Self

Creates a new MPE engine with custom configuration.

Source

pub fn config(&self) -> &MpeConfig

Gets the current MPE configuration.

Source

pub fn set_config(&mut self, config: MpeConfig)

Sets the MPE configuration.

Source

pub fn note_on(&mut self, note: u8, velocity: u8) -> NoteExpression

Handles a note-on event.

Assigns the note to an available channel and creates a NoteExpression.

§Arguments
  • note - MIDI note number (0-127)
  • velocity - Note velocity (0-127)
§Returns

The NoteExpression for this note.

Source

pub fn note_off(&mut self, note: u8) -> Option<NoteExpression>

Handles a note-off event.

§Arguments
  • note - MIDI note number (0-127)
§Returns

The NoteExpression that was removed, or None if note wasn’t active.

Source

pub fn pitch_bend(&mut self, channel: u8, value: u16)

Handles a pitch bend event for a specific channel.

§Arguments
  • channel - MIDI channel (1-16)
  • value - Pitch bend value (0-16383, 8192 = center)
Source

pub fn channel_pressure(&mut self, channel: u8, value: u8)

Handles a channel pressure (aftertouch) event.

§Arguments
  • channel - MIDI channel (1-16)
  • value - Pressure value (0-127)
Source

pub fn timbre(&mut self, channel: u8, value: u8)

Handles a CC74 (timbre/brightness) event.

§Arguments
  • channel - MIDI channel (1-16)
  • value - CC74 value (0-127)
Source

pub fn get_note_expression(&self, note: u8) -> Option<&NoteExpression>

Gets the expression data for a specific note.

§Arguments
  • note - MIDI note number (0-127)
§Returns

The NoteExpression for this note, or None if not active.

Source

pub fn active_notes(&self) -> impl Iterator<Item = &NoteExpression>

Gets all active note expressions.

Source

pub fn active_note_count(&self) -> usize

Gets the number of active notes.

Source

pub fn clear_all_notes(&mut self)

Clears all active notes (panic button / all notes off).

Trait Implementations§

Source§

impl Default for MpeEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.