55 lines
919 B
C
55 lines
919 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include <stdarg.h>
|
|
#include <errno.h>
|
|
|
|
#include "strings.h"
|
|
|
|
uint32_t tick = 0;
|
|
|
|
void mid_log(char *format, ...) {
|
|
va_list ap;
|
|
va_start(ap, format);
|
|
char msg[1024];
|
|
msg[0] = 0;
|
|
vsprintf(msg, format, ap);
|
|
printf("[%08d] %s\n", tick, msg);
|
|
va_end(ap);
|
|
}
|
|
|
|
void mid_dlog(char *format, ...) {
|
|
mid_log(format);
|
|
}
|
|
|
|
void mid_tlog(int type, char *text) {
|
|
mid_log(STR_MID_TEXT, type, text);
|
|
}
|
|
|
|
#define MID_NOEVT
|
|
|
|
#include "midi.h"
|
|
#define ARGPARSE_DE
|
|
#include "argparse.h"
|
|
|
|
int main(int argc, char **argv) {
|
|
char *midname = NULL;
|
|
|
|
argp_t *argspec = arg_alloc(1);
|
|
arg_add_nstr(argspec, STR_ARGS_MIDI, true, &midname);
|
|
if(arg_parse(argspec, argc, argv) ^ 1) {
|
|
return 1;
|
|
}
|
|
|
|
mid_handle mid;
|
|
if(mid_read(&mid, midname) ^ 1) {
|
|
return 1;
|
|
}
|
|
while(mid_tick(&mid)) {
|
|
tick++;
|
|
}
|
|
mid_free(&mid);
|
|
return 0;
|
|
}
|