[−][src]Struct libatm::MIDINote
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: MIDINoteType
octave: u32
Methods
impl MIDINote
[src]
pub fn new(note_type: MIDINoteType, octave: u32) -> MIDINote
[src]
Create new MIDINote
Arguments
note_type
: MIDINoteTypeoctave
: integer between -1 and 9
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(&self) -> 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]
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]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,