2019-10-23 22:17:57 +11:00
|
|
|
/*
|
|
|
|
* NcLooper test des fonctions audio
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2019-10-24 03:46:27 +11:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <ao/ao.h>
|
2019-10-23 22:17:57 +11:00
|
|
|
|
|
|
|
#include "ao_output.h"
|
2019-10-24 03:46:27 +11:00
|
|
|
#include "playfile.h"
|
2019-10-23 22:17:57 +11:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
|
2019-10-24 03:46:27 +11:00
|
|
|
int verbosity;
|
|
|
|
|
2019-10-24 04:01:22 +11:00
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
void help(int k)
|
|
|
|
{
|
|
|
|
}
|
2019-10-23 22:17:57 +11:00
|
|
|
/* --------------------------------------------------------------------- */
|
2019-11-04 04:58:21 +11:00
|
|
|
int envoyer_du_son(char *fname, int k)
|
|
|
|
{
|
|
|
|
ao_device *device;
|
|
|
|
int foo;
|
|
|
|
|
|
|
|
device = init_ao_output(44100);
|
2019-12-24 03:55:31 +11:00
|
|
|
if (verbosity) fprintf(stderr, "AO init -> %p\n", device);
|
2019-11-04 04:58:21 +11:00
|
|
|
|
|
|
|
switch (k) {
|
|
|
|
case 0:
|
|
|
|
foo = blast_this_file(fname, device, 1);
|
|
|
|
fprintf(stderr, "blast file -> %d\n", foo);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
foo = play_some_stuff(device, 0);
|
|
|
|
fprintf(stderr, "play stuff -> %d\n", foo);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
foo = close_ao_output(device);
|
2019-12-24 03:55:31 +11:00
|
|
|
if (verbosity) fprintf(stderr, "AO close -> %d\n", foo);
|
2019-11-04 04:58:21 +11:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
2019-10-23 22:17:57 +11:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2019-10-24 04:01:22 +11:00
|
|
|
int opt;
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
|
|
|
switch(opt) {
|
|
|
|
case 'h': help(0); break;
|
|
|
|
case 'v': verbosity++; break;
|
|
|
|
}
|
|
|
|
}
|
2019-10-23 22:17:57 +11:00
|
|
|
|
2019-10-24 04:01:22 +11:00
|
|
|
#if DEBUG_LEVEL
|
|
|
|
fprintf(stderr, "argc = %d, optind = %d\n", argc, optind);
|
|
|
|
#endif
|
2019-10-23 22:17:57 +11:00
|
|
|
|
2019-11-04 04:58:21 +11:00
|
|
|
envoyer_du_son("AK14V-ORDRES.wav", 0);
|
2019-10-23 22:17:57 +11:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|