6 static int au_callback(void *buffer, int size, void *cls);
8 static signed char *snd_click;
9 static int snd_click_size;
11 int main(int argc, char **argv)
15 if(!(fp = fopen("click.pcm", "rb"))) {
16 fprintf(stderr, "failed to open click.pcm\n");
19 fseek(fp, 0, SEEK_END);
20 snd_click_size = ftell(fp);
22 if(!(snd_click = malloc(snd_click_size))) {
23 fprintf(stderr, "failed to allocate sound sample\n");
26 fread(snd_click, 1, snd_click_size, fp);
30 audio_set_callback(au_callback, 0);
37 /* snd_click_size is < 65536 so we can just throw it all at once in there */
38 static int au_callback(void *buffer, int size, void *cls)
40 memcpy(buffer, snd_click, snd_click_size);
41 return snd_click_size;