X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dos_sbtest;a=blobdiff_plain;f=src%2Fmain.c;h=c7630e57e1d304b3c2614ee89cfe2e496e0051b2;hp=1e32b61f55460ce049bb8a868b19cf110a17ef93;hb=01a545fde6dc446fe626382f8bba50b9b7c1a35b;hpb=d08178b30de9363c1fda1de3499f541faf520924 diff --git a/src/main.c b/src/main.c index 1e32b61..c7630e5 100644 --- a/src/main.c +++ b/src/main.c @@ -5,12 +5,27 @@ static int au_callback(void *buffer, int size, void *cls); -/* defined in ausamples.s */ -extern signed char snd_click[]; -extern int snd_click_size; +static signed char *snd_click; +static int snd_click_size; int main(int argc, char **argv) { + FILE *fp; + + if(!(fp = fopen("click.pcm", "rb"))) { + fprintf(stderr, "failed to open click.pcm\n"); + return 1; + } + fseek(fp, 0, SEEK_END); + snd_click_size = ftell(fp); + rewind(fp); + if(!(snd_click = malloc(snd_click_size))) { + fprintf(stderr, "failed to allocate sound sample\n"); + return 1; + } + fread(snd_click, 1, snd_click_size, fp); + fclose(fp); + audio_init(); audio_set_callback(au_callback, 0);