struct { int pitches[4]; const char *name; } sevenths[] = {
{ {0, 4, 8, 11}, "Augmented/major 7" },
+ { {0, 4, 8, 10}, "Augmented 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" },
+ { {0, 3, 6, 10}, "Half-diminished 7" },
+ { {0, 3, 6, 9}, "Diminished 7" }
};
if (scherzo->chord) {
}
}
- for (i = 0; i < ARRAY_SIZE (octaves); i++) {
- if (_chord_signature_matches (notes, num_notes, octaves[i].pitches, 1))
- chord_name = octaves[i].name;
- }
-
- for (i = 0; i < ARRAY_SIZE (intervals); i++) {
- if (_chord_signature_matches (notes, num_notes, intervals[i].pitches, 2))
- chord_name = intervals[i].name;
- }
-
- for (i = 0; i < ARRAY_SIZE (triads); i++) {
- if (_chord_signature_matches (notes, num_notes, triads[i].pitches, 3))
- chord_name = triads[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;
+ switch (num_notes) {
+ case 1:
+ for (i = 0; i < ARRAY_SIZE (octaves); i++) {
+ if (_chord_signature_matches (notes, num_notes, octaves[i].pitches, 1))
+ chord_name = octaves[i].name;
+ }
+ break;
+ case 2:
+ for (i = 0; i < ARRAY_SIZE (intervals); i++) {
+ if (_chord_signature_matches (notes, num_notes, intervals[i].pitches, 2))
+ chord_name = intervals[i].name;
+ }
+ break;
+ case 3:
+ for (i = 0; i < ARRAY_SIZE (triads); i++) {
+ if (_chord_signature_matches (notes, num_notes, triads[i].pitches, 3))
+ chord_name = triads[i].name;
+ }
+ break;
+ case 4:
+ for (i = 0; i < ARRAY_SIZE(sevenths); i++) {
+ if (_chord_signature_matches (notes, num_notes, sevenths[i].pitches, 4))
+ chord_name = sevenths[i].name;
+ }
+ break;
}
if (chord_name)