rstmt_core/note/
impl_note_repr.rs

1use crate::note::NoteBase;
2use crate::octave::Octave;
3use crate::pitch::{Flat, Natural, PitchClass, RawPitchClass, Sharp};
4
5impl<P> NoteBase<P>
6where
7    P: RawPitchClass,
8{
9    /// returns a new natural note of the given class and octave
10    pub fn natural(class: P, octave: Octave) -> NoteBase<P, Natural>
11    where
12        P: RawPitchClass<Tag = Natural>,
13    {
14        NoteBase::new(PitchClass::natural(class), octave)
15    }
16    /// returns a new sharp note of the given class and octave
17    pub fn sharp(class: P, octave: Octave) -> NoteBase<P, Sharp>
18    where
19        P: RawPitchClass<Tag = Sharp>,
20    {
21        NoteBase::new(PitchClass::sharp(class), octave)
22    }
23    /// returns a new flat note of the given class and octave
24    pub fn flat(class: P, octave: Octave) -> NoteBase<P, Flat>
25    where
26        P: RawPitchClass<Tag = Flat>,
27    {
28        NoteBase::new(PitchClass::flat(class), octave)
29    }
30}