- 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;