rstmt_core/pitch/
mod.rs

1/*
2    Appellation: pitches <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5#[doc(inline)]
6pub use self::{kinds::*, pitch::Pitch};
7
8pub(crate) mod kinds;
9pub(crate) mod pitch;
10
11#[doc(hidden)]
12pub mod signs;
13
14mod impls {
15    mod pitch_ops;
16}
17
18pub(crate) mod prelude {
19    pub use super::kinds::{Flat, Natural, Pitches, Sharp};
20    pub use super::pitch::Pitch;
21    pub use super::{IntoPitch, PitchClass, PitchTy};
22}
23
24lazy_static::lazy_static! {
25    static ref FLAT_SYMBOLS: [char; 3] = ['♭', 'f', 'F'];
26    static ref SHARP_SYMBOLS: [char; 3] = ['#', 's', 'S'];
27}
28/// A type alias for an integer representing a particular pitch of a note
29pub type PitchTy = i8;
30/// A trait for converting a type into a [Pitch](Pitch) instance.
31pub trait IntoPitch {
32    fn into_pitch(self) -> Pitch;
33}
34/// Used to denote a particular pitch class; pitch classes are symbolic
35/// representations of pre-defined frequencies.
36pub trait PitchClass {
37    private!();
38
39    fn pitch(&self) -> PitchTy;
40}
41
42/*
43 ************* Implementations *************
44*/
45impl<S> IntoPitch for S
46where
47    S: Into<Pitch>,
48{
49    fn into_pitch(self) -> Pitch {
50        self.into()
51    }
52}