use crate::pitch::{Pitch, Pitches};
use crate::Octave;
pub trait ASPN {
fn aspn(&self) -> String {
format!("{}.{}", self.pitch_class(), self.octave())
}
fn octave(&self) -> Octave;
fn pitch(&self) -> Pitch;
fn pitch_class(&self) -> Pitches {
self.pitch().class()
}
}
pub trait Notable: Copy + Sized + core::fmt::Display {
fn pitch(&self) -> Pitch;
fn pitch_class(&self) -> Pitches {
self.pitch().class()
}
}
impl Notable for Pitch {
fn pitch_class(&self) -> Pitches {
self.class()
}
fn pitch(&self) -> Pitch {
*self
}
}
impl Notable for Pitches {
fn pitch_class(&self) -> Pitches {
*self
}
fn pitch(&self) -> Pitch {
Pitch(self.pitch_class().value())
}
}
impl Notable for crate::Note {
fn pitch(&self) -> Pitch {
*self.pitch()
}
}
impl Notable for crate::PitchTy {
fn pitch(&self) -> Pitch {
Pitch(*self)
}
}