pub struct Pitch {
pub letter: NoteLetter,
pub accidental: i8,
}
Fields§
§letter: NoteLetter
§accidental: i8
Implementations§
Source§impl Pitch
impl Pitch
Sourcepub fn new(letter: NoteLetter, accidental: i8) -> Self
pub fn new(letter: NoteLetter, accidental: i8) -> Self
Create a pitch with a given note letter and accidental
Sourcepub fn from_u8(val: u8) -> Self
pub fn from_u8(val: u8) -> Self
Create a pitch from an integer, where 0 is C and everything climbs up from there, looping back around once it reaches 12.
Sourcepub fn from_u8_with_scale_context(
val: u8,
mode: Option<Mode>,
direction: Direction,
) -> Self
pub fn from_u8_with_scale_context( val: u8, mode: Option<Mode>, direction: Direction, ) -> Self
Create a pitch from an integer with a preferred spelling based on mode and scale type
Sourcepub fn from_u8_with_direction(val: u8, direction: Direction) -> Self
pub fn from_u8_with_direction(val: u8, direction: Direction) -> Self
Create a pitch from an integer with a preferred spelling based on direction
Sourcepub fn into_u8(self) -> u8
pub fn into_u8(self) -> u8
Convert the pitch into its corresponding integer, where 0 is C and 11 is B.
Sourcepub fn from_interval(pitch: Self, interval: Interval) -> Self
pub fn from_interval(pitch: Self, interval: Interval) -> Self
Create a pitch by moving up the given pitch by an interval.
Sourcepub fn from_interval_down(pitch: Self, interval: Interval) -> Self
pub fn from_interval_down(pitch: Self, interval: Interval) -> Self
Create a pitch by moving down the given pitch by an interval.
Sourcepub fn from_interval_with_context(
pitch: Self,
interval: Interval,
mode: Option<Mode>,
direction: Direction,
) -> Self
pub fn from_interval_with_context( pitch: Self, interval: Interval, mode: Option<Mode>, direction: Direction, ) -> Self
Create a pitch by moving up the given pitch by an interval with scale context.
Sourcepub fn from_interval_down_with_context(
pitch: Self,
interval: Interval,
mode: Option<Mode>,
direction: Direction,
) -> Self
pub fn from_interval_down_with_context( pitch: Self, interval: Interval, mode: Option<Mode>, direction: Direction, ) -> Self
Create a pitch by moving down the given pitch by an interval with scale context.
Trait Implementations§
Source§impl From<PitchSymbol> for Pitch
impl From<PitchSymbol> for Pitch
Source§fn from(symbol: PitchSymbol) -> Self
fn from(symbol: PitchSymbol) -> Self
Converts to this type from the input type.
impl Copy for Pitch
impl Eq for Pitch
impl StructuralPartialEq for Pitch
Auto Trait Implementations§
impl Freeze for Pitch
impl RefUnwindSafe for Pitch
impl Send for Pitch
impl Sync for Pitch
impl Unpin for Pitch
impl UnwindSafe for Pitch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more