pub struct OctaveSpace {
pub divisions: NonZeroU16,
}Expand description
A positive modular division count for octave-like pitch spaces.
PitchClass and Pitch remain fixed to the canonical 12-class,
MIDI-compatible pitch identity. OctaveSpace is for algorithms that need
floor decomposition or circular distance in another positive division count.
§Examples
use sim_lib_pitch_core::{split_floor, OctaveSpace};
let twelve = OctaveSpace::new(12).unwrap();
assert_eq!(split_floor(-13, twelve), (-2, 11));Fields§
§divisions: NonZeroU16Positive divisions in one octave-like cycle.
Implementations§
Source§impl OctaveSpace
impl OctaveSpace
Sourcepub fn new(divisions: u16) -> Result<Self, PitchError>
pub fn new(divisions: u16) -> Result<Self, PitchError>
Constructs an octave space, rejecting zero-sized spaces.
Sourcepub fn twelve_tone() -> Self
pub fn twelve_tone() -> Self
Returns the canonical 12-division semitone space.
Sourcepub fn is_empty(self) -> bool
pub fn is_empty(self) -> bool
Returns true because an OctaveSpace is always non-empty.
Trait Implementations§
Source§impl Clone for OctaveSpace
impl Clone for OctaveSpace
Source§fn clone(&self) -> OctaveSpace
fn clone(&self) -> OctaveSpace
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OctaveSpace
Source§impl Debug for OctaveSpace
impl Debug for OctaveSpace
impl Eq for OctaveSpace
Source§impl Hash for OctaveSpace
impl Hash for OctaveSpace
Source§impl PartialEq for OctaveSpace
impl PartialEq for OctaveSpace
impl StructuralPartialEq for OctaveSpace
Auto Trait Implementations§
impl Freeze for OctaveSpace
impl RefUnwindSafe for OctaveSpace
impl Send for OctaveSpace
impl Sync for OctaveSpace
impl Unpin for OctaveSpace
impl UnsafeUnpin for OctaveSpace
impl UnwindSafe for OctaveSpace
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