midifile: fix CLAMP range of minor/mayor keys

This commit is contained in:
Wim Taymans 2020-05-20 15:21:20 +02:00
parent 6a689b3c7f
commit 08ffc507c0

View file

@ -676,8 +676,8 @@ int midi_file_dump_event(FILE *out, const struct midi_event *ev)
fprintf(out, "Key Signature: %d %s: %s", abs(sf), fprintf(out, "Key Signature: %d %s: %s", abs(sf),
sf > 0 ? "sharps" : "flats", sf > 0 ? "sharps" : "flats",
ev->data[4] == 0 ? ev->data[4] == 0 ?
major_keys[SPA_CLAMP(sf + 9, 0, 19)] : major_keys[SPA_CLAMP(sf + 9, 0, 18)] :
minor_keys[SPA_CLAMP(sf + 9, 0, 19)]); minor_keys[SPA_CLAMP(sf + 9, 0, 18)]);
break; break;
} }
case 0x7f: case 0x7f: