use super::{Degree, Scale, ScaleIntervals};
pub type DiatonicScale<T> = Scale<T, Diatonic<T, ScaleIntervals>>;
impl<T> DiatonicScale<T>
where
T: Degree + Clone,
{
pub fn major(root: T) -> Self {
Self::diatonic(root, ScaleIntervals::major())
}
pub fn natural_minor(root: T) -> Self {
Self::diatonic(root, ScaleIntervals::natural_minor())
}
pub fn harmonic_minor(root: T) -> Self {
Self::diatonic(root, ScaleIntervals::harmonic_minor())
}
pub fn melodic_minor(root: T) -> Self {
Self::diatonic(root, ScaleIntervals::melodic_minor())
}
pub fn dorian(root: T) -> Self {
Self::diatonic(root, ScaleIntervals::dorian())
}
}
#[derive(Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Diatonic<T: Degree, U> {
pub state: T::State,
pub intervals: U,
}
impl<T, U> Diatonic<T, U>
where
T: Degree,
{
pub fn new(root: T, intervals: U) -> Self {
Self {
state: root.state(),
intervals,
}
}
}