Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28402
Modified Files: Tag: desiredata s_audio.c Log Message: cleanup
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16.2.20.2.16 retrieving revision 1.5.4.16.2.20.2.17 diff -C2 -d -r1.5.4.16.2.20.2.16 -r1.5.4.16.2.20.2.17 *** s_audio.c 9 Jul 2007 22:04:03 -0000 1.5.4.16.2.20.2.16 --- s_audio.c 9 Jul 2007 22:27:11 -0000 1.5.4.16.2.20.2.17 *************** *** 34,38 **** extern t_audioapi pa_api, jack_api, oss_api, alsa_api, sgi_api, mmio_api, asio_api;
! static t_audioapi *sys_audio(void) { #ifdef USEAPI_PORTAUDIO if (sys_audioapi == API_PORTAUDIO) return &pa_api; --- 34,40 ---- extern t_audioapi pa_api, jack_api, oss_api, alsa_api, sgi_api, mmio_api, asio_api;
! using namespace std; ! ! static t_audioapi *sys_audio() { #ifdef USEAPI_PORTAUDIO if (sys_audioapi == API_PORTAUDIO) return &pa_api; *************** *** 108,112 **** static float (*peak_fp)(t_float*, t_int, t_float) = peakvec;
! static int audio_isopen(void) { return audio_state && ((audio_naudioindev > 0 && audio_audiochindev[0] > 0) --- 110,114 ---- static float (*peak_fp)(t_float*, t_int, t_float) = peakvec;
! static int audio_isopen() { return audio_state && ((audio_naudioindev > 0 && audio_audiochindev[0] > 0) *************** *** 135,140 **** audio_naudioindev = naudioindev; audio_naudiooutdev = naudiooutdev; ! for (int i=0; i<MAXAUDIOINDEV; i++) audio_audioindev[i] = audioindev[i], audio_audiochindev[i] = chindev[i]; ! for (int i=0; i<MAXAUDIOOUTDEV; i++) audio_audiooutdev[i] = audiooutdev[i], audio_audiochoutdev[i] = choutdev[i]; audio_rate = rate; audio_dacblocksize = dacblocksize; --- 137,142 ---- audio_naudioindev = naudioindev; audio_naudiooutdev = naudiooutdev; ! for (int i=0; i<MAXAUDIOINDEV; i++) {audio_audioindev[i] = audioindev[i]; audio_audiochindev[i] = chindev[i];} ! for (int i=0; i<MAXAUDIOOUTDEV; i++) {audio_audiooutdev[i] = audiooutdev[i]; audio_audiochoutdev[i] = choutdev[i];} audio_rate = rate; audio_dacblocksize = dacblocksize; *************** *** 146,156 **** any other API gets used. This is only true of OSS so far. */ #ifdef USEAPI_OSS ! void oss_init(void); #endif
static void audio_init() { static int initted = 0; ! if (initted) ! return; initted = 1; #ifdef USEAPI_OSS --- 148,157 ---- any other API gets used. This is only true of OSS so far. */ #ifdef USEAPI_OSS ! void oss_init(); #endif
static void audio_init() { static int initted = 0; ! if (initted) return; initted = 1; #ifdef USEAPI_OSS *************** *** 172,179 **** sys_outchannels = chout; sys_dacsr = double(sr); ! sys_advance_samples = int(sys_schedadvance*sys_dacsr/1000000.); ! if (sys_advance_samples < /* 3 * */sys_dacblocksize) ! sys_advance_samples = /* 3 * */sys_dacblocksize; ! if (sys_soundin) freealignedbytes(sys_soundin,inbytes); sys_soundin = (t_float *)getalignedbytes(inbytes); --- 173,177 ---- sys_outchannels = chout; sys_dacsr = double(sr); ! sys_advance_samples = max(int(sys_schedadvance*sys_dacsr/1000000.),sys_dacblocksize); if (sys_soundin) freealignedbytes(sys_soundin,inbytes); sys_soundin = (t_float *)getalignedbytes(inbytes); *************** *** 185,191 **** if (SIMD_CHKCNT(sys_inchannels * sys_dacblocksize) && SIMD_CHKCNT(sys_outchannels * sys_dacblocksize)) ! peak_fp = peakvec_simd; ! else ! peak_fp = peakvec; if (sys_verbose) post("input channels = %d, output channels = %d", sys_inchannels, sys_outchannels); canvas_resume_dsp(canvas_suspend_dsp()); --- 183,188 ---- if (SIMD_CHKCNT(sys_inchannels * sys_dacblocksize) && SIMD_CHKCNT(sys_outchannels * sys_dacblocksize)) ! peak_fp = peakvec_simd; ! else peak_fp = peakvec; if (sys_verbose) post("input channels = %d, output channels = %d", sys_inchannels, sys_outchannels); canvas_resume_dsp(canvas_suspend_dsp()); *************** *** 205,211 **** int *choutdev, int rate, int dacblocksize, int advance, int schedmode, int enable) { - int i; int defaultchannels = SYS_DEFAULTCH; - int inchans, outchans; int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
--- 202,206 ---- *************** *** 237,241 **** } else naudioindev = nchindev = 0; } else { ! for (i = 0; i < MAXAUDIOINDEV; i++) audioindev[i] = i; naudioindev = nchindev; } --- 232,236 ---- } else naudioindev = nchindev = 0; } else { ! for (int i=0; i<MAXAUDIOINDEV; i++) audioindev[i] = i; naudioindev = nchindev; } *************** *** 243,255 **** if (nchindev == -1) { nchindev = naudioindev; ! for (i = 0; i < naudioindev; i++) ! chindev[i] = defaultchannels; } else if (nchindev > naudioindev) { ! for (i = naudioindev; i < nchindev; i++) { if (i == 0) audioindev[0] = DEFAULTAUDIODEV; else audioindev[i] = audioindev[i-1] + 1; } naudioindev = nchindev; } else if (nchindev < naudioindev) { ! for (i = nchindev; i < naudioindev; i++) { if (i == 0) chindev[0] = defaultchannels; else chindev[i] = chindev[i-1]; } --- 238,249 ---- if (nchindev == -1) { nchindev = naudioindev; ! for (int i=0; i<naudioindev; i++) chindev[i] = defaultchannels; } else if (nchindev > naudioindev) { ! for (int i=naudioindev; i<nchindev; i++) { if (i == 0) audioindev[0] = DEFAULTAUDIODEV; else audioindev[i] = audioindev[i-1] + 1; } naudioindev = nchindev; } else if (nchindev < naudioindev) { ! for (int i=nchindev; i<naudioindev; i++) { if (i == 0) chindev[0] = defaultchannels; else chindev[i] = chindev[i-1]; } *************** *** 266,270 **** } else nchoutdev = naudiooutdev = 0; } else { ! for (i = 0; i < MAXAUDIOOUTDEV; i++) audiooutdev[i] = i; naudiooutdev = nchoutdev; } --- 260,264 ---- } else nchoutdev = naudiooutdev = 0; } else { ! for (int i=0; i<MAXAUDIOOUTDEV; i++) audiooutdev[i] = i; naudiooutdev = nchoutdev; } *************** *** 272,283 **** if (nchoutdev == -1) { nchoutdev = naudiooutdev; ! for (i = 0; i < naudiooutdev; i++) choutdev[i] = defaultchannels; } else if (nchoutdev > naudiooutdev) { ! for (i = naudiooutdev; i < nchoutdev; i++) { if (i == 0) audiooutdev[0] = DEFAULTAUDIODEV; else audiooutdev[i] = audiooutdev[i-1] + 1; } naudiooutdev = nchoutdev; } else if (nchoutdev < naudiooutdev) { ! for (i = nchoutdev; i < naudiooutdev; i++) { if (i == 0) choutdev[0] = defaultchannels; else choutdev[i] = choutdev[i-1]; } --- 266,277 ---- if (nchoutdev == -1) { nchoutdev = naudiooutdev; ! for (int i=0; i<naudiooutdev; i++) choutdev[i] = defaultchannels; } else if (nchoutdev > naudiooutdev) { ! for (int i=naudiooutdev; i<nchoutdev; i++) { if (i == 0) audiooutdev[0] = DEFAULTAUDIODEV; else audiooutdev[i] = audiooutdev[i-1] + 1; } naudiooutdev = nchoutdev; } else if (nchoutdev < naudiooutdev) { ! for (int i=nchoutdev; i<naudiooutdev; i++) { if (i == 0) choutdev[0] = defaultchannels; else choutdev[i] = choutdev[i-1]; } *************** *** 286,297 **** } /* count total number of input and output channels */ ! for (i = inchans = 0; i < naudioindev; i++) ! inchans += (realinchans[i] = (chindev[i] > 0 ? chindev[i] : 0)); ! for (i = outchans = 0; i < naudiooutdev; i++) ! outchans += (realoutchans[i] = (choutdev[i] > 0 ? choutdev[i] : 0)); ! /* if no input or output devices seem to have been specified, ! this really means just disable audio, which we now do. */ ! if (!inchans && !outchans) ! enable = 0; sys_schedadvance = advance * 1000;
--- 280,288 ---- } /* count total number of input and output channels */ ! int inchans=0, outchans=0; ! for (int i=0; i < naudioindev; i++) inchans += (realinchans[i] = (chindev[i] > 0 ? chindev[i] : 0)); ! for (int i=0; i < naudiooutdev; i++) outchans += (realoutchans[i] = (choutdev[i] > 0 ? choutdev[i] : 0)); ! /* if no input or output devices seem to have been specified, this really means just disable audio, which we now do. */ ! if (!inchans && !outchans) enable = 0; sys_schedadvance = advance * 1000;
*************** *** 341,346 **** }
! extern void sgi_close_audio(void); ! void sys_close_audio(void) { /* jsarlo { (*/ if (sys_externalschedlib) return; --- 332,336 ---- }
! void sys_close_audio() { /* jsarlo { (*/ if (sys_externalschedlib) return; *************** *** 354,358 ****
/* open audio using whatever parameters were last used */ ! void sys_reopen_audio( void) { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; --- 344,348 ----
/* open audio using whatever parameters were last used */ ! void sys_reopen_audio() { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; *************** *** 367,372 **** /* tb: default value of peak_fp {*/ float peakvec(t_float* vec, t_int n, t_float cur_max) { ! int i; ! for (i = 0; i != n; ++i) { float f = *vec++; if (f > cur_max) cur_max = f; --- 357,361 ---- /* tb: default value of peak_fp {*/ float peakvec(t_float* vec, t_int n, t_float cur_max) { ! for (int i=0; i<n; i++) { float f = *vec++; if (f > cur_max) cur_max = f; *************** *** 377,387 **** /* } */
! void sys_peakmeters(void) { if (sys_inchannels) sys_inmax = peak_fp(sys_soundin, sys_inchannels * sys_dacblocksize, sys_inmax); if (sys_outchannels) sys_outmax = peak_fp(sys_soundout,sys_outchannels * sys_dacblocksize, sys_outmax); }
! extern int sgi_send_dacs(void); ! int sys_send_dacs(void) { if (sys_meters) sys_peakmeters(); if (sys_audio()) return sys_audio()->send_dacs(); --- 366,375 ---- /* } */
! void sys_peakmeters() { if (sys_inchannels) sys_inmax = peak_fp(sys_soundin, sys_inchannels * sys_dacblocksize, sys_inmax); if (sys_outchannels) sys_outmax = peak_fp(sys_soundout,sys_outchannels * sys_dacblocksize, sys_outmax); }
! int sys_send_dacs() { if (sys_meters) sys_peakmeters(); if (sys_audio()) return sys_audio()->send_dacs(); *************** *** 390,396 **** }
! float sys_getsr(void) {return sys_dacsr;} ! int sys_get_outchannels(void) {return sys_outchannels;} ! int sys_get_inchannels(void) {return sys_inchannels;}
void sys_getmeters(float *inmax, float *outmax) { --- 378,384 ---- }
! float sys_getsr() {return sys_dacsr;} ! int sys_get_outchannels() {return sys_outchannels;} ! int sys_get_inchannels() {return sys_inchannels;}
void sys_getmeters(float *inmax, float *outmax) { *************** *** 403,410 **** }
! void sys_reportidle(void) {}
- extern void sgi_getdevs(char *indevlist, int *nindevs, - char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize); static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { --- 391,396 ---- }
! void sys_reportidle() {}
static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { *************** *** 413,419 **** else { /* this shouldn't happen once all the above get filled in. */ - int i; *nindevs = *noutdevs = 3; ! for (i = 0; i < 3; i++) { sprintf(indevlist + i * devdescsize, "input device #%d", i+1); sprintf(outdevlist + i * devdescsize, "output device #%d", i+1); --- 399,404 ---- 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); *************** *** 423,444 **** }
! static void sys_listaudiodevs(void) { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; int nindevs = 0, noutdevs = 0, i, canmulti = 0; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); ! /* To agree with command line flags, normally start at 1 */ ! /* But microsoft "MMIO" device list starts at 0 (the "mapper"). */ /* (see also sys_mmio variable in s_main.c) */ if (!nindevs) post("no audio input devices found"); else { post("audio input devices:"); ! for (i = 0; i < nindevs; i++) ! post("%d. %s", i + (sys_audioapi != API_MMIO), indevlist + i * DEVDESCSIZE); } if (!noutdevs) post("no audio output devices found"); else { post("audio output devices:"); ! for (i = 0; i < noutdevs; i++) ! post("%d. %s", i + (sys_audioapi != API_MMIO), outdevlist + i * DEVDESCSIZE); } post("API number %d\n", sys_audioapi); --- 408,426 ---- }
! static void sys_listaudiodevs() { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; int nindevs = 0, noutdevs = 0, i, canmulti = 0; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); ! /* To agree with command line flags, normally start at 1; but microsoft "MMIO" device list starts at 0 (the "mapper"). */ /* (see also sys_mmio variable in s_main.c) */ if (!nindevs) post("no audio input devices found"); else { post("audio input devices:"); ! for (i = 0; i < nindevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), indevlist + i * DEVDESCSIZE); } if (!noutdevs) post("no audio output devices found"); else { post("audio output devices:"); ! for (i = 0; i < noutdevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), outdevlist + i * DEVDESCSIZE); } post("API number %d\n", sys_audioapi); *************** *** 450,509 **** int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; - int audioindev1, audioindev2, audioindev3, audioindev4, - audioinchan1, audioinchan2, audioinchan3, audioinchan4, - audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, - audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4; 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; - std::ostringstream indevliststring; - std::ostringstream outdevliststring; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); ! indevliststring << "{"; ! for (int i=0; i<nindevs; i++) indevliststring << "{" << (indevlist + i*DEVDESCSIZE) << "} "; ! indevliststring << "}"; ! outdevliststring << "{"; ! for (int i=0; i<noutdevs; i++) outdevliststring << "{" << (outdevlist + i*DEVDESCSIZE) << "} "; ! outdevliststring << "}"; ! sys_get_audio_params(&naudioindev, audioindev, chindev, ! &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler); if (naudioindev > 1 || naudiooutdev > 1) flongform = 1; ! std::ostringstream audioindevs; for (int i=0; i<naudioindev; i++) audioindevs << audioindev [i] << " "; ! std::ostringstream audiooutdevs; for (int i=0; i<naudiooutdev; i++) audiooutdevs << audiooutdev[i] << " "; ! std::ostringstream audioinchans; for (int i=0; i<naudioindev; i++) audioinchans << chindev [i] << " "; ! std::ostringstream audiooutchans; for (int i=0; i<naudiooutdev; i++) audiooutchans << choutdev [i] << " "; ! ! sys_vgui("pdtk_audio_dialog %s {%s} {%s} %s {%s} {%s} %d %d %d %d %d\n", ! indevliststring.str().data(), audioindevs.str().data(), audioinchans.str().data(), ! outdevliststring.str().data(), audiooutdevs.str().data(), audiooutchans.str().data(), rate, dacblocksize, advance, canmulti, flongform!=0); }
! /* new values from dialog window */ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { ! int i, nindev, noutdev; int newaudioindev[4], newaudioinchan[4], newaudiooutdev[4], newaudiooutchan[4]; /* the new values the dialog came back with: */ ! int newrate = atom_getintarg(16, argc, argv); int newdacblocksize = atom_getintarg(17, argc, argv); ! int newadvance = atom_getintarg(18, argc, argv); ! int newschedmode = atom_getintarg(19, argc, argv); ! for (i = 0; i < 4; i++) { ! newaudioindev[i] = atom_getintarg(i, argc, argv); ! newaudioinchan[i] = atom_getintarg(i+4, argc, argv); ! newaudiooutdev[i] = atom_getintarg(i+8, argc, argv); newaudiooutchan[i] = atom_getintarg(i+12, argc, argv); } ! for (i = 0, nindev = 0; i < 4; i++) { if (newaudioinchan[i]) { ! newaudioindev[nindev] = newaudioindev[i]; newaudioinchan[nindev] = newaudioinchan[i]; nindev++; } } ! for (i = 0, noutdev = 0; i < 4; i++) { if (newaudiooutchan[i]) { ! newaudiooutdev[noutdev] = newaudiooutdev[i]; newaudiooutchan[noutdev] = newaudiooutchan[i]; noutdev++; --- 432,479 ---- int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; 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; audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); ! ostringstream indevliststring; for (int i=0; i<nindevs; i++) indevliststring << " {" << (indevlist + i*DEVDESCSIZE) << "}"; ! ostringstream outdevliststring; for (int i=0; i<noutdevs; i++) outdevliststring << " {" << (outdevlist + i*DEVDESCSIZE) << "}"; ! sys_get_audio_params(&naudioindev,audioindev,chindev,&naudiooutdev,audiooutdev,choutdev,&rate,&dacblocksize,&advance,&scheduler); if (naudioindev > 1 || naudiooutdev > 1) flongform = 1; ! ostringstream audioindevs; for (int i=0; i<naudioindev; i++) audioindevs << " " << audioindev [i]; ! ostringstream audiooutdevs; for (int i=0; i<naudiooutdev; i++) audiooutdevs << " " << audiooutdev[i]; ! ostringstream audioinchans; for (int i=0; i<naudioindev; i++) audioinchans << " " << chindev [i]; ! ostringstream audiooutchans; for (int i=0; i<naudiooutdev; i++) audiooutchans << " " << choutdev [i]; ! sys_vgui("pdtk_audio_dialog {%s} {%s} {%s} {%s} {%s} {%s} %d %d %d %d %d\n", ! indevliststring .str().data()+1, audioindevs.str().data()+1, audioinchans.str().data()+1, ! outdevliststring.str().data()+1, audiooutdevs.str().data()+1, audiooutchans.str().data()+1, rate, dacblocksize, advance, canmulti, flongform!=0); }
! /* new values from dialog window */ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { ! int nindev=0, noutdev=0; int newaudioindev[4], newaudioinchan[4], newaudiooutdev[4], newaudiooutchan[4]; /* the new values the dialog came back with: */ ! int newrate = atom_getintarg(16, argc, argv); int newdacblocksize = atom_getintarg(17, argc, argv); ! int newadvance = atom_getintarg(18, argc, argv); ! int newschedmode = atom_getintarg(19, argc, argv); ! for (int i=0; i<4; i++) { ! newaudioindev[i] = atom_getintarg(i, argc, argv); ! newaudioinchan[i] = atom_getintarg(i+4, argc, argv); ! newaudiooutdev[i] = atom_getintarg(i+8, argc, argv); newaudiooutchan[i] = atom_getintarg(i+12, argc, argv); } ! for (int i=0; i<4; i++) { if (newaudioinchan[i]) { ! newaudioindev[nindev] = newaudioindev[i]; newaudioinchan[nindev] = newaudioinchan[i]; nindev++; } } ! for (int i=0; i<4; i++) { if (newaudiooutchan[i]) { ! newaudiooutdev[noutdev] = newaudiooutdev[i]; newaudiooutchan[noutdev] = newaudiooutchan[i]; noutdev++; *************** *** 511,521 **** } sys_close_audio(); ! sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, ! noutdev, newaudiooutdev, noutdev, newaudiooutchan, ! newrate, newdacblocksize, newadvance, newschedmode, 1); }
! extern void sgi_listaudiodevs(void); ! void sys_listdevs(void) { if (sys_audioapi == API_PORTAUDIO) sys_listaudiodevs(); else #ifdef USEAPI_JACK --- 481,491 ---- } sys_close_audio(); ! sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, ! noutdev, newaudiooutdev, noutdev, newaudiooutchan, ! newrate, newdacblocksize, newadvance, newschedmode, 1); }
! extern void sgi_listaudiodevs(); ! void sys_listdevs() { if (sys_audioapi == API_PORTAUDIO) sys_listaudiodevs(); else #ifdef USEAPI_JACK *************** *** 606,610 **** void alsa_putzeros(int iodev, int n); void alsa_getzeros(int iodev, int n); ! void alsa_printstate(void); #endif
--- 576,580 ---- void alsa_putzeros(int iodev, int n); void alsa_getzeros(int iodev, int n); ! void alsa_printstate(); #endif
*************** *** 635,639 **** }
! void glob_audio_api(t_pd * dummy, t_float f) { int newapi = (int)f; sys_close_audio(); --- 605,609 ---- }
! void glob_audio_api(t_pd *dummy, t_float f) { int newapi = (int)f; sys_close_audio(); *************** *** 641,645 **** }
! void glob_audio_delay(t_pd * dummy, t_float f) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; --- 611,615 ---- }
! void glob_audio_delay(t_pd *dummy, t_float f) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; *************** *** 685,696 **** }
! void glob_audio_device(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler, i; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudiooutdev = naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOINDEV; i++) { audiooutdev [i] = audioindev [i] = int(atom_getfloatarg(i*2+1, argc, argv)); audiochoutdev[i] = audiochindev[i] = int(atom_getfloatarg(i*2+2, argc, argv)); --- 655,666 ---- }
! void glob_audio_device(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudiooutdev = naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (int i=0; i<MAXAUDIOINDEV; i++) { audiooutdev [i] = audioindev [i] = int(atom_getfloatarg(i*2+1, argc, argv)); audiochoutdev[i] = audiochindev[i] = int(atom_getfloatarg(i*2+2, argc, argv)); *************** *** 701,712 **** }
! void glob_audio_device_in(t_pd * dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler, i; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOINDEV; i=i+2) { audioindev [i] = atom_getintarg(i+1, argc, argv); audiochindev[i] = atom_getintarg(i+2, argc, argv); --- 671,682 ---- }
! void glob_audio_device_in(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudioindev = (int)atom_getfloatarg(0, argc, argv); ! for (int i=0; i<MAXAUDIOINDEV; i=i+2) { audioindev [i] = atom_getintarg(i+1, argc, argv); audiochindev[i] = atom_getintarg(i+2, argc, argv); *************** *** 720,728 **** int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler, i; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudiooutdev = (int)atom_getfloatarg(0, argc, argv); ! for (i = 0; i != MAXAUDIOOUTDEV; i=i+2) { audiooutdev [i] = atom_getintarg(i+1, argc, argv); audiochoutdev[i] = atom_getintarg(i+2, argc, argv); --- 690,699 ---- int naudioindev, audioindev[MAXAUDIOINDEV], audiochindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], audiochoutdev[MAXAUDIOOUTDEV]; ! int rate, dacblocksize, advance, scheduler; sys_get_audio_params(&naudioindev, audioindev, audiochindev, &naudiooutdev, audiooutdev, audiochoutdev, &rate, &dacblocksize, &advance, &scheduler); naudiooutdev = (int)atom_getfloatarg(0, argc, argv); ! /* i+=2 ? isn't that a bug??? */ ! for (int i=0; i<MAXAUDIOOUTDEV; i+=2) { audiooutdev [i] = atom_getintarg(i+1, argc, argv); audiochoutdev[i] = atom_getintarg(i+2, argc, argv); *************** *** 734,738 ****
/* some general helper functions */ ! void sys_update_sleepgrain(void) { sys_sleepgrain = sys_schedadvance/4; if (sys_sleepgrain < 1000) sys_sleepgrain = 1000; --- 705,709 ----
/* some general helper functions */ ! void sys_update_sleepgrain() { sys_sleepgrain = sys_schedadvance/4; if (sys_sleepgrain < 1000) sys_sleepgrain = 1000; *************** *** 750,761 **** t_atom argv[MAXNDEV]; int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1; ! t_symbol * selector = gensym("audioindev"); ! t_symbol * pd = gensym("pd"); audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &rate, &dacblocksize, &advance, &scheduler); if (f < 0) { ! int i; ! for (i = 0; i != nindevs ;++i) SETSTRING(argv+i,indevlist + i * DEVDESCSIZE); typedmess(pd->s_thing, selector, nindevs, argv); } else if (f < nindevs) { --- 721,731 ---- t_atom argv[MAXNDEV]; int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1; ! t_symbol *selector = gensym("audioindev"); ! t_symbol *pd = gensym("pd"); audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE); sys_get_audio_params(&naudioindev, audioindev, chindev, &naudiooutdev, audiooutdev, choutdev, &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) { *************** *** 791,795 ****
/* some prototypes from s_audio_portaudio.c */ ! extern void pa_getcurrent_devices(void); extern void pa_getaudioininfo(t_float f); extern void pa_getaudiooutinfo(t_float f); --- 761,765 ----
/* some prototypes from s_audio_portaudio.c */ ! extern void pa_getcurrent_devices(); extern void pa_getaudioininfo(t_float f); extern void pa_getaudiooutinfo(t_float f); *************** *** 812,816 **** #endif } ! void glob_audio_getcurrent_devices(void) { #if defined(USEAPI_PORTAUDIO) && !defined(PABLIO) if (sys_audioapi == API_PORTAUDIO) pa_getcurrent_devices(); --- 782,786 ---- #endif } ! void glob_audio_getcurrent_devices() { #if defined(USEAPI_PORTAUDIO) && !defined(PABLIO) if (sys_audioapi == API_PORTAUDIO) pa_getcurrent_devices(); *************** *** 824,826 ****
/* tb } */ - --- 794,795 ----