[][src]Struct libatm::MIDINote

pub struct MIDINote {
    pub note_type: MIDINoteType,
    pub octave: u32,
}

MIDI note

Represents key on a piano, combining a note type with an octave. For example, middle C would be represented as MIDINote { note_type: MIDINoteType::C, octave: 4 }. For a detailed table of MIDI notes and octave numbers, see document here: https://www.cs.cmu.edu/~music/cmsip/readings/Standard-MIDI-file-format-updated.pdf.

Fields

note_type: MIDINoteTypeoctave: u32

Methods

impl MIDINote[src]

pub fn new(note_type: MIDINoteType, octave: u32) -> MIDINote[src]

Create new MIDINote

Arguments

Examples

// Middle C
let note = libatm::MIDINote::new(libatm::MIDINoteType::C, 4);
assert_eq!(note.convert(), 60);

Notes

The octave parameter is not validated, but must be between -1 and 9 in order to represent a valid MIDI note.

pub fn convert(&self) -> u32[src]

Convert MIDI note to an integer representation (MIDI note number)

Trait Implementations

impl Clone for MIDINote[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<MIDINote> for MIDINote[src]

impl Copy for MIDINote[src]

impl Debug for MIDINote[src]

impl FromStr for MIDINote[src]

type Err = ()

The associated error which can be returned from parsing.

Auto Trait Implementations

impl Send for MIDINote

impl Unpin for MIDINote

impl Sync for MIDINote

impl UnwindSafe for MIDINote

impl RefUnwindSafe for MIDINote

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]