Struct musical_note::Octave
source · pub struct Octave { /* private fields */ }Implementations
sourceimpl Octave
impl Octave
sourcepub fn new(octave: u8) -> Self
pub fn new(octave: u8) -> Self
octave number should be raw: like
let middle_c = 60u8;
let octave = Octave::new(middle_c/12);pub fn raw(&self) -> u8
sourcepub fn as_midi(&self) -> i8
pub fn as_midi(&self) -> i8
can be negative. Here middle-c considered as C3. So, function return would be in range of -2..9
pub fn from_midi(midi: u8) -> Self
sourcepub fn split_midi(midi: u8) -> (u8, Self)
pub fn split_midi(midi: u8) -> (u8, Self)
Get note index (C=0, D=2, D#=3, B=11) and octave.
sourcepub fn apply_to_midi_note(&self, note_idx: u8) -> u8
pub fn apply_to_midi_note(&self, note_idx: u8) -> u8
Return raw midi byte.
Trait Implementations
sourceimpl PartialOrd<Octave> for Octave
impl PartialOrd<Octave> for Octave
sourcefn partial_cmp(&self, other: &Octave) -> Option<Ordering>
fn partial_cmp(&self, other: &Octave) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Octave
impl Eq for Octave
impl StructuralEq for Octave
impl StructuralPartialEq for Octave
Auto Trait Implementations
impl RefUnwindSafe for Octave
impl Send for Octave
impl Sync for Octave
impl Unpin for Octave
impl UnwindSafe for Octave
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more