Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23765
Modified Files: Tag: devel_0_39 m_glob.c s_audio.c Log Message: cleaner message-based audio device listing
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16.2.8 retrieving revision 1.5.4.16.2.9 diff -C2 -d -r1.5.4.16.2.8 -r1.5.4.16.2.9 *** s_audio.c 24 Mar 2006 21:36:40 -0000 1.5.4.16.2.8 --- s_audio.c 27 Mar 2006 12:08:57 -0000 1.5.4.16.2.9 *************** *** 1235,1242 ****
! void glob_audio_getaudioindevices(t_pd * dummy, t_float f) { ! float flongform = 0; ! char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; /* these are the devices you're using: */ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; --- 1235,1242 ----
! void glob_audio_getaudioindevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { ! float flongform = 0; ! char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; /* these are the devices you're using: */ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; *************** *** 1254,1261 **** outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
! char str[DEVDESCSIZE];
t_atom argv[MAXNDEV]; ! t_symbol * selector = gensym("audioindevice"); t_symbol * pd = gensym("pd");
--- 1254,1263 ---- outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
! char str[DEVDESCSIZE];
t_atom argv[MAXNDEV]; ! t_float f = ac ? atom_getfloatarg(0,ac,av) : -1; ! ! t_symbol * selector = gensym("audioindev"); t_symbol * pd = gensym("pd");
*************** *** 1263,1271 **** MAXNDEV, DEVDESCSIZE);
! sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler);
! if (f <= 0) { int i; --- 1265,1273 ---- MAXNDEV, DEVDESCSIZE);
! sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler);
! if (f < 0) { int i; *************** *** 1280,1297 **** typedmess(pd->s_thing, selector, nindevs, argv); } ! else if (f <= (float) nindevs && f > 0) ! { t_symbol * sym; ! strcpy(str, indevlist + ((int)f - 1) * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv+1+(int)(f), sym); typedmess(pd->s_thing, selector, 1, argv); ! } }
! void glob_audio_getaudiooutdevices(t_pd * dummy, float f) { ! float flongform = 0; ! char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; /* these are the devices you're using: */ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; --- 1282,1299 ---- typedmess(pd->s_thing, selector, nindevs, argv); } ! else if (f < (float) nindevs) ! { t_symbol * sym; ! strcpy(str, indevlist + (int)f * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv, sym); typedmess(pd->s_thing, selector, 1, argv); ! } }
! void glob_audio_getaudiooutdevices(t_pd * dummy, t_symbol *s, int ac, t_atom *av) { ! float flongform = 0; ! char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; /* these are the devices you're using: */ int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; *************** *** 1309,1316 **** outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
! char str[DEVDESCSIZE];
t_atom argv[MAXNDEV]; ! t_symbol * selector = gensym("audiooutdevices"); t_symbol * pd = gensym("pd");
--- 1311,1320 ---- outdevliststring[MAXNDEV*(DEVDESCSIZE+4)+80];
! char str[DEVDESCSIZE];
t_atom argv[MAXNDEV]; ! t_float f = ac ? atom_getfloatarg(0,ac,av) : -1; ! ! t_symbol * selector = gensym("audiooutdev"); t_symbol * pd = gensym("pd");
*************** *** 1318,1326 **** MAXNDEV, DEVDESCSIZE);
! sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler);
! if (f == 0) { int i; --- 1322,1330 ---- MAXNDEV, DEVDESCSIZE);
! sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler);
! if (f < 0) { int i; *************** *** 1335,1346 **** typedmess(pd->s_thing, selector, noutdevs, argv); } ! else if (f <= (float) noutdevs && f > 0) ! { t_symbol * sym; ! strcpy(str, outdevlist + ((int)f - 1) * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv+1+(int)(f), sym); typedmess(pd->s_thing, selector, 1, argv); ! } }
--- 1339,1350 ---- typedmess(pd->s_thing, selector, noutdevs, argv); } ! else if (f < (float) noutdevs) ! { t_symbol * sym; ! strcpy(str, outdevlist + (int)f * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv, sym); typedmess(pd->s_thing, selector, 1, argv); ! } }
Index: m_glob.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v retrieving revision 1.4.4.2.2.3 retrieving revision 1.4.4.2.2.4 diff -C2 -d -r1.4.4.2.2.3 -r1.4.4.2.2.4 *** m_glob.c 24 Mar 2006 21:36:40 -0000 1.4.4.2.2.3 --- m_glob.c 27 Mar 2006 12:08:57 -0000 1.4.4.2.2.4 *************** *** 66,72 **** int i; char str[80]; ! if (s == gensym("audioindevices")) return; ! if (s == gensym("audiooutdevices")) return;
--- 66,72 ---- int i; char str[80]; ! if (s == gensym("audioindev")) return; ! if (s == gensym("audiooutdev")) return;
*************** *** 149,155 **** gensym("audio-device-out"), A_GIMME, 0); class_addmethod(glob_pdobject, (t_method)glob_audio_getaudioindevices, ! gensym("getaudioindev"), A_DEFFLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_audio_getaudiooutdevices, ! gensym("getaudiooutdev"), A_DEFFLOAT, 0); /* tb } */ #ifdef UNIX --- 149,155 ---- gensym("audio-device-out"), A_GIMME, 0); class_addmethod(glob_pdobject, (t_method)glob_audio_getaudioindevices, ! gensym("getaudioindev"), A_GIMME, 0); class_addmethod(glob_pdobject, (t_method)glob_audio_getaudiooutdevices, ! gensym("getaudiooutdev"), A_GIMME, 0); /* tb } */ #ifdef UNIX