/* * ifao.c (libao interface) * ------ */ #include #include #include #include #include "ecoute.h" /*==------------------------------------------------------------------==*/ /* * privates variables of this module. MUST be static ! */ #define TBUF 100 static int isactive; static char devname[TBUF+1]; static ao_sample_format AOSF; /*==------------------------------------------------------------------==*/ /* */ int setup_sound_output(int splr, int nbch) { #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %d %d )\n", __func__, splr, nbch); #endif if (splr) AOSF.rate = splr; if (nbch) AOSF.channels = nbch; return 0; } /*==------------------------------------------------------------------==*/ /* * initialisation of this module who MUST be called * before any use of this module ! */ int init_sound_output(char *device, int k) { #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, device, k); #endif /* some default values */ AOSF.rate = 44100; AOSF.channels = 2; AOSF.bits = 16; AOSF.byte_format = AO_FMT_LITTLE; /* XXX ??? */ /* XXX see the libao documentation for exact syntax */ if (TBUF < strlen(device)) { fprintf(stderr, "buffer overflow in %s\n", __func__); exit(1); } strcpy(devname, device); return 0; } /*==------------------------------------------------------------------==*/ int start_sound_output(int k) { #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %d )\n", __func__, k); #endif return -1; } /*==------------------------------------------------------------------==*/ int stop_sound_output(int k) { #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %d )\n", __func__, k); #endif return -1; } /*==------------------------------------------------------------------==*/ int infos_sound_output(char *title) { if (NULL==title) { abort(); } fprintf(stderr, " +------ snd out infos (%s)\n", title); fprintf(stderr, " | device name '%s'\n", devname); fprintf(stderr, " | sample rate %d\n", AOSF.rate); fprintf(stderr, " | channels %d\n", AOSF.channels ); fprintf(stderr, " | bits/smpl %d\n", AOSF.bits ); fprintf(stderr, " | is active ? %s\n", isactive ? "yes" : "no"); return -1; } /*==------------------------------------------------------------------==*/ void infos_driver_son(void) { int foo; WINDOW *popup; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( )\n", __func__); #endif #define VID_INV 0 popup = newwin(12, 60, L_POPUP, C_POPUP); bordure(popup, 1); #if VID_INV wstandout(popup); #endif mvwaddstr(popup, 0, 2, "{{ sound driver }}"); #if VID_INV wstandend(popup); #endif wrefresh(popup); foo = start_sound_output(0); if (foo) { fprintf(stderr, " %s: start_sound_output -> %d\n", __func__, foo); } foo = stop_sound_output(0); if (foo) { fprintf(stderr, " %s: stop_sound_output -> %d\n", __func__, foo); } mvwaddstr(popup, 4, 9, "* function not implemented *"); mvwaddstr(popup, 11, 2, "{{ hit any key to reboot }}"); wrefresh(popup); getch(); delwin(popup); touchwin(stdscr); refresh(); } /*==------------------------------------------------------------------==*/