initial commit
This commit is contained in:
commit
36ca6059c1
49 changed files with 5290 additions and 0 deletions
55
mididump.c
Normal file
55
mididump.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
#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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue