Struct MonoMidiReceiver

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

A Monophonic MIDI receiver is represented here.

Implementations§

Source§

impl MonoMidiReceiver

Source

pub fn new(channel: u8) -> Self

MonoMidiReceiver::new(c) is a new Monophonic MIDI receiver which accepts messages on MIDI channel c

§Arguments
  • channel - The zero-based MIDI channel to listen to in [0..15]. All other MIDI channels are ignored.

The channel is clamped to [0..15]

Source

pub fn parse(&mut self, byte: u8)

mr.parse(b) parses incoming MIDI data in the form of sequential bytes b and updates its internal state

It is expected to call this function every time a new MIDI byte is received.

§Examples
use synth_utils::mono_midi_receiver::MonoMidiReceiver;

let mut mr = MonoMidiReceiver::new(1);
mr.parse(0x91); // note-on on channel 1
mr.parse(42); // note number 42
mr.parse(127); // max velocity

assert_eq!(mr.note_num(), 42);
assert_eq!(mr.velocity(), 1.0);
Source

pub fn note_num(&self) -> u8

mr.note_num() is the current MIDI note number held by the MIDI receiver

Source

pub fn pitch_bend(&self) -> f32

mr.pitch_bend() is the current MIDI pitch-bend value held by the MIDI receiver, in [-1.0, 1.0]

Typically a value of -1 means “bend 2 semitones down”, 0 means “don’t bend at all”, and +1 means “bend 2 semitones up”, but this behavior can be tweaked by the end user.

Source

pub fn velocity(&self) -> f32

mr.velocity() is the current MIDI velocity value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn mod_wheel(&self) -> f32

mr.mod_wheel() is the current MIDI mod-wheel value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn volume(&self) -> f32

mr.volume() is the current MIDI volume value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn vcf_cutoff(&self) -> f32

mr.vcf_cutoff() is the current MIDI VCF-cutoff value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn vcf_resonance(&self) -> f32

mr.vcf_resonance() is the current MIDI VCF-resonance value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn portamento_time(&self) -> f32

mr.portamento_time() is the current MIDI portamento-time value held by the MIDI receiver, in [0.0, 1.0]

Source

pub fn portamento_enabled(&self) -> bool

mr.portamento_enabled() is true if MIDI portamento is currently enabled

Source

pub fn sustain_enabled(&self) -> bool

mr.sustain_enabled() is true if MIDI sustain is currently enabled

Source

pub fn gate(&self) -> bool

mr.gate() is true if any MIDI notes are currently being played

Source

pub fn rising_gate(&mut self) -> bool

mr.rising_gate() is true if a new note has been triggered. Self clearing.

When retrigger is not allowed a rising gate is only triggered when a new note is played after all other notes have been lifted.

When retrigger is allowed a rising gate is triggered any time a new note-on message is received.

Source

pub fn falling_gate(&mut self) -> bool

mr.falling_gate() is true if all notes have been released after at least one note was played. Self clearing.

Source

pub fn set_retrigger_mode(&mut self, mode: RetriggerMode)

mr.set_retrigger_mode(m) sets the retrigger mode to the given mode m

Source

pub fn set_note_priority(&mut self, priority: NotePriority)

mr.set_note_priority(p) sets the note priority to p

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.