Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26504
Modified Files: Tag: devel_0_39 s_audio.c s_audio_portaudio.c s_midi.c s_midi_pm.c Log Message: more fixes to audio and midi consistence
Index: s_audio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v retrieving revision 1.5.4.16.2.18 retrieving revision 1.5.4.16.2.19 diff -C2 -d -r1.5.4.16.2.18 -r1.5.4.16.2.19 *** s_audio.c 25 Jun 2006 17:37:42 -0000 1.5.4.16.2.18 --- s_audio.c 5 Aug 2006 19:03:59 -0000 1.5.4.16.2.19 *************** *** 1263,1267 ****
t_atom argv[MAXNDEV]; ! t_float f = ac ? atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audioindev"); --- 1263,1267 ----
t_atom argv[MAXNDEV]; ! int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audioindev"); *************** *** 1288,1295 **** 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); --- 1288,1295 ---- typedmess(pd->s_thing, selector, nindevs, argv); } ! else if (f < nindevs) { t_symbol * sym; ! strcpy(str, indevlist + f * DEVDESCSIZE); sym = gensym(str); SETSYMBOL(argv, sym); *************** *** 1320,1324 ****
t_atom argv[MAXNDEV]; ! t_float f = ac ? atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audiooutdev"); --- 1320,1324 ----
t_atom argv[MAXNDEV]; ! int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("audiooutdev"); *************** *** 1345,1352 **** 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); --- 1345,1352 ---- typedmess(pd->s_thing, selector, noutdevs, argv); } ! else if (f < noutdevs) { t_symbol * sym; ! strcpy(str, outdevlist + f * DEVDESCSIZE); sym = gensym(str); SETSYMBOL(argv, sym); *************** *** 1357,1381 **** /* some prototypes from s_audio_portaudio.c */ extern void pa_getcurrent_devices(void); ! extern void pa_getaudioindevinfo(t_float f); ! extern void pa_getaudiooutdevinfo(t_float f); extern void pa_test_setting (int ac, t_atom *av); extern void pa_get_asio_latencies(t_float f);
! void glob_audio_getaudioindevinfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudioindevinfo(f); #endif #endif }
! void glob_audio_getaudiooutdevinfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudiooutdevinfo(f); #endif #endif --- 1357,1381 ---- /* 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); extern void pa_test_setting (int ac, t_atom *av); extern void pa_get_asio_latencies(t_float f);
! void glob_audio_getaudioininfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudioininfo(f); #endif #endif }
! void glob_audio_getaudiooutinfo(t_pd * dummy, t_float f) { #ifdef USEAPI_PORTAUDIO #ifndef PABLIO if (sys_audioapi == API_PORTAUDIO) ! pa_getaudiooutinfo(f); #endif #endif
Index: s_midi.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi.c,v retrieving revision 1.4.4.1.2.8 retrieving revision 1.4.4.1.2.9 diff -C2 -d -r1.4.4.1.2.8 -r1.4.4.1.2.9 *** s_midi.c 25 Jul 2006 10:54:41 -0000 1.4.4.1.2.8 --- s_midi.c 5 Aug 2006 19:03:59 -0000 1.4.4.1.2.9 *************** *** 810,814 **** /* tb { */
! void glob_midi_getindevs(t_pd *dummy) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; --- 810,814 ---- /* tb { */
! void glob_midi_getindevs(t_pd *dummy, t_symbol *s, int ac, t_atom *av) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; *************** *** 830,833 **** --- 830,835 ---- char str[DEVDESCSIZE];
+ int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1; + t_symbol * selector = gensym("midiindev"); t_symbol * pd = gensym("pd"); *************** *** 836,850 **** MAXNDEV, DEVDESCSIZE);
! for (i = 0; i < nindevs; i++) { t_symbol * sym; ! strcpy(str, indevlist + i * DEVDESCSIZE); sym = gensym(str); ! SETSYMBOL(argv+i, sym); } - typedmess(pd->s_thing, selector, nindevs, argv); }
! void glob_midi_getoutdevs(t_pd *dummy) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; --- 838,865 ---- MAXNDEV, DEVDESCSIZE);
! if (f < 0) ! { ! int i; ! ! for (i = 0; i != nindevs ;++i) ! { ! t_symbol * sym; ! strcpy(str, indevlist + i * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv+i, sym); ! } ! typedmess(pd->s_thing, selector, nindevs, argv); ! } ! else if (f < nindevs) { t_symbol * sym; ! strcpy(str, indevlist + f * DEVDESCSIZE); sym = gensym(str); ! SETSYMBOL(argv, sym); ! typedmess(pd->s_thing, selector, 1, argv); } }
! void glob_midi_getoutdevs(t_pd *dummy, t_symbol *s, int ac, t_atom *av) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; *************** *** 865,868 **** --- 880,885 ---- t_atom argv[MAXNDEV]; char str[DEVDESCSIZE]; + + int f = ac ? (int)atom_getfloatarg(0,ac,av) : -1;
t_symbol * selector = gensym("midioutdev"); *************** *** 872,883 **** MAXNDEV, DEVDESCSIZE);
! for (i = 0; i < noutdevs; i++) { t_symbol * sym; ! strcpy(str, outdevlist + i * DEVDESCSIZE); sym = gensym(str); ! SETSYMBOL(argv+i, sym); } - typedmess(pd->s_thing, selector, noutdevs, argv); }
--- 889,913 ---- MAXNDEV, DEVDESCSIZE);
! if (f < 0) ! { ! int i; ! ! for (i = 0; i != noutdevs ;++i) ! { ! t_symbol * sym; ! strcpy(str, outdevlist + i * DEVDESCSIZE); ! sym = gensym(str); ! SETSYMBOL(argv+i, sym); ! } ! typedmess(pd->s_thing, selector, noutdevs, argv); ! } ! else if (f < noutdevs) { t_symbol * sym; ! strcpy(str, outdevlist + f * DEVDESCSIZE); sym = gensym(str); ! SETSYMBOL(argv, sym); ! typedmess(pd->s_thing, selector, 1, argv); } }
*************** *** 905,909 **** for (i = 0; i < noutdev; i++) { ! SETFLOAT(argv+i, midiindev[i]); } typedmess(pd->s_thing, selector, nindev, argv); --- 935,939 ---- for (i = 0; i < noutdev; i++) { ! SETFLOAT(argv+i, midiindev[i]+1); } typedmess(pd->s_thing, selector, nindev, argv); *************** *** 932,936 **** for (i = 0; i < noutdev; i++) { ! SETFLOAT(argv+i, midioutdev[i]); } typedmess(pd->s_thing, selector, nindev, argv); --- 962,966 ---- for (i = 0; i < noutdev; i++) { ! SETFLOAT(argv+i, midioutdev[i]+1); } typedmess(pd->s_thing, selector, nindev, argv);
Index: s_audio_portaudio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_portaudio.c,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -C2 -d -r1.1.2.16 -r1.1.2.17 *** s_audio_portaudio.c 4 Aug 2006 11:55:51 -0000 1.1.2.16 --- s_audio_portaudio.c 5 Aug 2006 19:03:59 -0000 1.1.2.17 *************** *** 209,212 **** --- 209,213 ---- { const PaStreamInfo * streaminfo = Pa_GetStreamInfo (pa_stream); + t_atom atoms[4];
*************** *** 216,223 ****
sys_schedadvance = 1e-6 * streaminfo->outputLatency; SETFLOAT(atoms, (float)pa_indev); SETFLOAT(atoms+1, (float)inchans); SETFLOAT(atoms+2, (float)rate); ! SETFLOAT(atoms+3, (float)streaminfo->inputLatency * 1000); typedmess(pd->s_thing, selector1, 4, atoms);
--- 217,225 ----
sys_schedadvance = 1e-6 * streaminfo->outputLatency; + SETFLOAT(atoms, (float)pa_indev); SETFLOAT(atoms+1, (float)inchans); SETFLOAT(atoms+2, (float)rate); ! SETFLOAT(atoms+3, (float)streaminfo->inputLatency * 1000.f); typedmess(pd->s_thing, selector1, 4, atoms);
*************** *** 225,229 **** SETFLOAT(atoms+1, (float)outchans); SETFLOAT(atoms+2, (float)rate); ! SETFLOAT(atoms+3, (float)streaminfo->outputLatency * 1000); typedmess(pd->s_thing, selector2, 4, atoms); } --- 227,231 ---- SETFLOAT(atoms+1, (float)outchans); SETFLOAT(atoms+2, (float)rate); ! SETFLOAT(atoms+3, (float)streaminfo->outputLatency * 1000.f); typedmess(pd->s_thing, selector2, 4, atoms); } *************** *** 475,479 **** }
! void pa_getaudioindevinfo(t_float f) { int i = pdindev2paindev((int)f); --- 477,481 ---- }
! void pa_getaudioininfo(t_float f) { int i = pdindev2paindev((int)f); *************** *** 485,489 **** if (pdi) { ! t_symbol * selector = gensym("audioindevinfo"); t_symbol * pd = gensym("pd"); t_atom argv[4]; --- 487,491 ---- if (pdi) { ! t_symbol * selector = gensym("audioininfo"); t_symbol * pd = gensym("pd"); t_atom argv[4]; *************** *** 496,500 **** }
! void pa_getaudiooutdevinfo(t_float f) { int i = pdoutdev2paoutdev((int)f); --- 498,502 ---- }
! void pa_getaudiooutinfo(t_float f) { int i = pdoutdev2paoutdev((int)f); *************** *** 506,510 **** if (pdi) { ! t_symbol * selector = gensym("audiooutdevinfo"); t_symbol * pd = gensym("pd"); t_atom argv[4]; --- 508,512 ---- if (pdi) { ! t_symbol * selector = gensym("audiooutinfo"); t_symbol * pd = gensym("pd"); t_atom argv[4]; *************** *** 535,539 **** int outchans = atom_getfloatarg(4, ac, av); int advance = atom_getfloatarg(5, ac, av); - int blocksize = (advance * samplerate) / (1000000.); t_symbol * pd = gensym("pd"); t_symbol * selector = gensym("testaudiosettingresult"); --- 537,540 ---- *************** *** 564,568 **** ret = Pa_IsFormatSupported(&inputParameters, &outputParameters, samplerate);
! SETFLOAT(argv, ret); typedmess(pd->s_thing, selector, 1, argv); } --- 565,569 ---- ret = Pa_IsFormatSupported(&inputParameters, &outputParameters, samplerate);
! SETFLOAT(argv, ret == paNoError?1:0); typedmess(pd->s_thing, selector, 1, argv); }
Index: s_midi_pm.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_midi_pm.c,v retrieving revision 1.4.4.1.2.3 retrieving revision 1.4.4.1.2.4 diff -C2 -d -r1.4.4.1.2.3 -r1.4.4.1.2.4 *** s_midi_pm.c 28 Jul 2006 14:46:43 -0000 1.4.4.1.2.3 --- s_midi_pm.c 5 Aug 2006 19:03:59 -0000 1.4.4.1.2.4 *************** *** 41,44 **** --- 41,45 ---- for (i = 0; i < nmidiin; i++) { + int found = 0; for (j = 0, devno = 0; j < Pm_CountDevices(); j++) { *************** *** 50,54 **** err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev], j, NULL, 100, NULL, NULL); ! if (err) post("could not open midi input %d (%s): %s", j, info->name, Pm_GetErrorText(err)); --- 51,55 ---- err = Pm_OpenInput(&mac_midiindevlist[mac_nmidiindev], j, NULL, 100, NULL, NULL); ! if (err != pmNoError) post("could not open midi input %d (%s): %s", j, info->name, Pm_GetErrorText(err)); *************** *** 60,63 **** --- 61,65 ---- info->name); mac_nmidiindev++; + found = 1; } } *************** *** 65,68 **** --- 67,72 ---- } } + if(!found) + post("could not find midi device %d",midiinvec[i]); }
*************** *** 70,73 **** --- 74,78 ---- for (i = 0; i < nmidiout; i++) { + int found = 0; for (j = 0, devno = 0; j < Pm_CountDevices(); j++) { *************** *** 89,92 **** --- 94,98 ---- info->name); mac_nmidioutdev++; + found = 1; } } *************** *** 94,97 **** --- 100,105 ---- } } + if(!found) + post("could not find midi device %d",midioutvec[i]); } }