Small utility library for MIDI functions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
903 B

  1. #include <stdio.h>
  2. #include <assert.h>
  3. #include "midi-utils.h"
  4. int main(void) {
  5. FILE* f = fopen("cases.txt", "r");
  6. if (!f) {
  7. return -1;
  8. }
  9. char read_note_name[255] = "";
  10. unsigned int read_note_value;
  11. while (!feof(f)) {
  12. fscanf(f, "%s %d\n", read_note_name, &read_note_value);
  13. unsigned int actual_note_value = MIDI_GetNoteFromName(read_note_name);
  14. printf("MIDI_GetNoteFromName(\"%s\")...", read_note_name);
  15. printf("(%d == %d) ", read_note_value, actual_note_value);
  16. assert(read_note_value == actual_note_value);
  17. printf("OK!\n");
  18. if (read_note_value != 255u || !strcmp(read_note_name, "D#21")) {
  19. printf("MIDI_GetNoteName(%d)...", read_note_value);
  20. char* actual_note_name = MIDI_GetNoteName(read_note_value);
  21. printf("(%s == %s) ", read_note_name, actual_note_name);
  22. assert(!strcmp(read_note_name, actual_note_name));
  23. printf("OK!\n");
  24. }
  25. }
  26. fclose(f);
  27. return 0;
  28. }