Skip to content

Instantly share code, notes, and snippets.

@jpcima
Created January 29, 2019 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/adde9f5d25fe339e97e472de43ac08a0 to your computer and use it in GitHub Desktop.
Save jpcima/adde9f5d25fe339e97e472de43ac08a0 to your computer and use it in GitHub Desktop.
libsmf test case
#include "smf.h"
#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc != 2)
return 1;
smf_t *smf = smf_load(argv[1]);
if (!smf) {
fprintf(stderr, "cannot load\n");
return 0;
}
// if (char *dec = smf_decode(smf)) {
// printf("%s\n", dec);
// free(dec);
// }
unsigned trackno = 1;
while (smf_track_t *track = smf_get_track_by_number(smf, trackno)) {
unsigned evno = 1;
while (smf_event_t *ev = smf_track_get_event_by_number(track, evno)) {
// if (char *dec = smf_event_decode(ev)) {
// printf("%s\n", dec);
// free(dec);
// }
evno++;
}
++trackno;
}
smf_delete(smf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment