chordcalc/modes/
extended.rs1use core::fmt::Display;
2
3#[derive(Debug, Copy, Clone, PartialEq)]
4pub enum Mode {
5 DominantNinth,
6 DominantEleventh,
7 DominantThirteenth,
8}
9
10impl crate::Mode for Mode {
11 fn make_chord(&self, tonality: crate::notes::MusicalNote) -> crate::chords::Chord {
12 let root = tonality;
13 match self {
14 Mode::DominantNinth => [root, root + 4, root + 7, root + 10, root + 14].into(),
15 Mode::DominantEleventh => {
16 [root, root + 4, root + 7, root + 10, root + 14, root + 17].into()
17 }
18 Mode::DominantThirteenth => [
19 root,
20 root + 4,
21 root + 7,
22 root + 10,
23 root + 14,
24 root + 17,
25 root + 21,
26 ]
27 .into(),
28 }
29 }
30}
31impl Display for Mode {
32 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
33 match self {
34 Mode::DominantNinth => write!(f, "⁹"),
35 Mode::DominantEleventh => write!(f, "¹¹"),
36 Mode::DominantThirteenth => write!(f, "¹³"),
37 }
38 }
39}