Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17410
Modified Files: Tag: desiredata s_audio.c Log Message: cleanup and hide some globals
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16.2.20.2.20 retrieving revision 1.5.4.16.2.20.2.21 diff -C2 -d -r1.5.4.16.2.20.2.20 -r1.5.4.16.2.20.2.21 *** s_audio.c 10 Jul 2007 16:36:03 -0000 1.5.4.16.2.20.2.20 --- s_audio.c 10 Jul 2007 21:50:05 -0000 1.5.4.16.2.20.2.21 *************** *** 64,72 **** }
! static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, ! int devdescsize);
! /* these are set in this file when opening audio, but then may be reduced, ! even to zero, in the system dependent open_audio routines. */ int sys_inchannels; int sys_outchannels; --- 64,71 ---- }
! static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
! /* these are set in this file when opening audio, but then may be reduced, ! even to zero, in the system dependent open_audio routines. */ int sys_inchannels; int sys_outchannels; *************** *** 77,94 **** #endif int sys_audioapi = API_DEFAULT; - int sys_dacblocksize; int sys_schedblocksize; - int sys_meters; /* true if we're metering */ ! float sys_inmax; /* max input amplitude */ ! float sys_outmax; /* max output amplitude */ ! ! /* exported variables */ int sys_schedadvance; /* scheduler advance in microseconds */
! /* the "state" is normally one if we're open and zero otherwise; ! but if the state is one, we still haven't necessarily opened the ! audio hardware; see audio_isopen() below. */ static int audio_state;
--- 76,88 ---- #endif int sys_audioapi = API_DEFAULT; int sys_dacblocksize; int sys_schedblocksize; int sys_meters; /* true if we're metering */ ! static float sys_inmax; /* max input amplitude */ ! static float sys_outmax; /* max output amplitude */ int sys_schedadvance; /* scheduler advance in microseconds */
! /* the "state" is normally one if we're open and zero otherwise; but if the state is one, ! we still haven't necessarily opened the audio hardware; see audio_isopen() below. */ static int audio_state;
*************** *** 107,113 ****
static int audio_isopen() { ! return audio_state ! && ((audio_in.ndev > 0 && audio_in.chdev[0] > 0) ! || (audio_out.ndev > 0 && audio_out.chdev[0] > 0)); }
--- 101,106 ----
static int audio_isopen() { ! return audio_state && ((audio_in.ndev > 0 && audio_in.chdev[0] > 0) ! || (audio_out.ndev > 0 && audio_out.chdev[0] > 0)); }
*************** *** 371,387 **** void sys_reportidle() {}
! static void audio_getdevs(char *indevlist, int *nindevs, ! char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { audio_init(); if (sys_audio()) sys_audio()->getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); ! else { ! /* this shouldn't happen once all the above get filled in. */ ! *nindevs = *noutdevs = 3; ! for (int i=0; i<3; i++) { ! sprintf(indevlist + i * devdescsize, "input device #%d", i+1); ! sprintf(outdevlist + i * devdescsize, "output device #%d", i+1); ! } ! *canmulti = 0; ! } }
--- 364,371 ---- void sys_reportidle() {}
! static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { audio_init(); if (sys_audio()) sys_audio()->getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); ! else {*nindevs = *noutdevs = 0;} }
*************** *** 668,677 **** }
void glob_audio_getaudioindevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { - /* these are the devices you're using: */ t_audiodevs in,out; int rate, dacblocksize, advance, scheduler; - /* these are all the devices on your system: */ - char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; int nindevs = 0, noutdevs = 0, canmulti = 0; t_atom argv[MAXNDEV]; --- 652,659 ---- }
+ /* t_audiodevs are the ones you're using; char[] are all the devices available. */ void glob_audio_getaudioindevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { t_audiodevs in,out; int rate, dacblocksize, advance, scheduler; int nindevs = 0, noutdevs = 0, canmulti = 0; t_atom argv[MAXNDEV]; *************** *** 679,686 **** t_symbol *selector = gensym("audioindev"); t_symbol *pd = gensym("pd"); audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&in,&out, &rate, &dacblocksize, &advance, &scheduler); if (f < 0) { ! for (int i=0; i<nindevs ;++i) SETSTRING(argv+i,indevlist + i * DEVDESCSIZE); typedmess(pd->s_thing, selector, nindevs, argv); } else if (f < nindevs) { --- 661,669 ---- t_symbol *selector = gensym("audioindev"); t_symbol *pd = gensym("pd"); + char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&in,&out, &rate, &dacblocksize, &advance, &scheduler); if (f < 0) { ! for (int i=0; i<nindevs; i++) SETSTRING(argv+i,indevlist+i*DEVDESCSIZE); typedmess(pd->s_thing, selector, nindevs, argv); } else if (f < nindevs) { *************** *** 689,699 **** } } - void glob_audio_getaudiooutdevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { - /* these are the devices you're using: */ t_audiodevs in,out; int rate, dacblocksize, advance, scheduler; - /* these are all the devices on your system: */ - char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; int nindevs = 0, noutdevs = 0, canmulti = 0; t_atom argv[MAXNDEV]; --- 672,678 ---- *************** *** 701,709 **** t_symbol *selector = gensym("audiooutdev"); t_symbol *pd = gensym("pd"); audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&in,&out, &rate, &dacblocksize, &advance, &scheduler); if (f < 0) { int i; ! for (i = 0; i != noutdevs ;++i) SETSYMBOL(argv+i, gensym(outdevlist + i * DEVDESCSIZE)); typedmess(pd->s_thing, selector, noutdevs, argv); } else if (f < noutdevs) { --- 680,689 ---- t_symbol *selector = gensym("audiooutdev"); t_symbol *pd = gensym("pd"); + char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&in,&out, &rate, &dacblocksize, &advance, &scheduler); if (f < 0) { int i; ! for (int i=0; i<noutdevs; i++) SETSYMBOL(argv+i, gensym(outdevlist+i*DEVDESCSIZE)); typedmess(pd->s_thing, selector, noutdevs, argv); } else if (f < noutdevs) {