[−][src]Struct libatm::midi_note::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
Implementations
impl MIDINote
[src]
pub fn new(note_type: MIDINoteType, octave: u32) -> Self
[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!(60, note.convert());
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)
The empty note (A.K.A. silence) is represented as u32::max_value()
.
The MIDI Tuning Standard only represents pitches up to 127, but instead
of choosing some arbitrary number larger than 127, u32::max_value()
is easily
distinguishable.
Trait Implementations
impl Clone for MIDINote
[src]
impl Copy for MIDINote
[src]
impl Debug for MIDINote
[src]
impl Eq for MIDINote
[src]
impl FromIterator<MIDINote> for MIDINoteVec
[src]
fn from_iter<I: IntoIterator<Item = MIDINote>>(iter: I) -> Self
[src]
impl<'a> FromStr for MIDINote
[src]
type Err = ParseMIDINoteError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for MIDINote
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for MIDINote
[src]
fn cmp(&self, other: &MIDINote) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<MIDINote> for MIDINote
[src]
impl PartialOrd<MIDINote> for MIDINote
[src]
fn partial_cmp(&self, other: &MIDINote) -> Option<Ordering>
[src]
fn lt(&self, other: &MIDINote) -> bool
[src]
fn le(&self, other: &MIDINote) -> bool
[src]
fn gt(&self, other: &MIDINote) -> bool
[src]
fn ge(&self, other: &MIDINote) -> bool
[src]
impl StructuralEq for MIDINote
[src]
impl StructuralPartialEq for MIDINote
[src]
Auto Trait Implementations
impl RefUnwindSafe for MIDINote
impl Send for MIDINote
impl Sync for MIDINote
impl Unpin for MIDINote
impl UnwindSafe for MIDINote
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,