]> git.cworth.org Git - scherzo/commitdiff
Add recognition of 7th chords
authorCarl Worth <cworth@cworth.org>
Tue, 17 Sep 2013 21:34:55 +0000 (14:34 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 17 Sep 2013 21:34:55 +0000 (14:34 -0700)
There's still no recognition of chords in anything but root position,
(and the accidentals are still not yet drawn on the staff).

scherzo.c

index 9b0e2d9ced96bc43dfcf5f8c388d373549c8923f..7296280302ddbb53e3d4bff04d0a5176c6a92f1f 100644 (file)
--- a/scherzo.c
+++ b/scherzo.c
@@ -417,6 +417,18 @@ scherzo_analyze_chord (scherzo_t *scherzo)
        { {0, 3, 6}, "Diminished triad" }
     };
 
+    struct { int pitches[4]; const char *name; } sevenths[] = {
+       { {0, 4, 8, 11}, "Augmented/major 7" },
+       { {0, 4, 7, 11}, "Major 7" },
+       { {0, 4, 7, 10}, "Dominant 7" },
+       { {0, 3, 7, 11}, "Minor/major 7" },
+       { {0, 3, 7, 10}, "Minor 7" },
+       { {0, 3, 6, 10}, "Half-diminished 7" },
+       { {0, 3, 6, 9},  "Diminished 7" },
+       { {0, 4, 8, 10}, "Augmented 7" },
+       { {0, 3, 6, 11}, "Diminished/major 7" },
+    };
+
     if (scherzo->chord) {
        score_remove_chord (scherzo->chord);
        scherzo->chord = NULL;
@@ -451,12 +463,10 @@ scherzo_analyze_chord (scherzo_t *scherzo)
            chord_name = triads[i].name;
     }
 
-/*
-    for (i = 0; i < num_sevenths; i++) {
-       if (_chord_signature_matches (notes, num_notes, seventh[i].pitches, 4))
-           chord_name = seventh[i].name;
+    for (i = 0; i < ARRAY_SIZE(sevenths); i++) {
+       if (_chord_signature_matches (notes, num_notes, sevenths[i].pitches, 4))
+           chord_name = sevenths[i].name;
     }
-*/
 
     if (chord_name)
        scherzo->chord = score_add_chord (scherzo->treble, chord_name);