Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25630
Modified Files:
Tag: desiredata
s_audio.c
Log Message:
new audio api
Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.5.4.16.2.20.2.9
retrieving revision 1.5.4.16.2.20.2.10
diff -C2 -d -r1.5.4.16.2.20.2.9 -r1.5.4.16.2.20.2.10
*** s_audio.c 30 Jun 2007 21:23:41 -0000 1.5.4.16.2.20.2.9
--- s_audio.c 30 Jun 2007 22:09:45 -0000 1.5.4.16.2.20.2.10
***************
*** 166,180 ****
}
! /* set channels and sample rate. */
!
! void sys_setchsr(int chin, int chout, int sr, int dacblocksize)
! {
! int inbytes = (chin ? chin : 2) * (sys_dacblocksize*sizeof(float));
int outbytes = (chout ? chout : 2) * (sys_dacblocksize*sizeof(float));
!
! if (dacblocksize != (1 << ilog2(dacblocksize)))
! post("warning: adjusting dac~blocksize to power of 2: %d",
! (dacblocksize = (1 << ilog2(dacblocksize))));
!
sys_dacblocksize = dacblocksize;
sys_schedblocksize = dacblocksize;
--- 166,177 ----
}
! /* set channels and sample rate. */
! void sys_setchsr(int chin, int chout, int sr, int dacblocksize) {
! int inbytes = (chin ? chin : 2) * (sys_dacblocksize*sizeof(float));
int outbytes = (chout ? chout : 2) * (sys_dacblocksize*sizeof(float));
! if (dacblocksize != (1<<ilog2(dacblocksize))) {
! dacblocksize = 1<<ilog2(dacblocksize);
! post("warning: adjusting dac~blocksize to power of 2: %d", dacblocksize);
! }
sys_dacblocksize = dacblocksize;
sys_schedblocksize = dacblocksize;
***************
*** 192,206 ****
sys_soundout = (t_float *)getalignedbytes(outbytes);
memset(sys_soundout, 0, outbytes);
!
! /* tb: modification for simd-optimized peak finding */
! 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());
}
--- 189,199 ----
sys_soundout = (t_float *)getalignedbytes(outbytes);
memset(sys_soundout, 0, outbytes);
! /* tb: modification for simd-optimized peak finding */
! 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());
}
***************
*** 224,231 ****
int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
! char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
! int indevs = 0, outdevs = 0, canmulti = 0;
! audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti,
! MAXNDEV, DEVDESCSIZE);
/* jsarlo { (*/
--- 217,223 ----
int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
! char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
! int indevs = 0, outdevs = 0, canmulti = 0;
! audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti, MAXNDEV, DEVDESCSIZE);
/* jsarlo { (*/
***************
*** 313,318 ****
sys_setchsr(inchans, outchans, rate, dacblocksize);
sys_log_error(ERR_NOTHING);
! if (enable)
! {
#ifdef USEAPI_PORTAUDIO
if (sys_audioapi == API_PORTAUDIO)
--- 305,310 ----
sys_setchsr(inchans, outchans, rate, dacblocksize);
sys_log_error(ERR_NOTHING);
! if (enable) {
! /* for alsa, only one device is supported; it may be open for both input and output. */
#ifdef USEAPI_PORTAUDIO
if (sys_audioapi == API_PORTAUDIO)
***************
*** 327,362 ****
(naudiooutdev > 0 ? realoutchans[0] : 0), rate, schedmode);
else
- #endif
- #ifdef USEAPI_OSS
- if (sys_audioapi == API_OSS)
- oss_open_audio(naudioindev, audioindev, nchindev, realinchans,
- naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
- else
#endif
! #ifdef USEAPI_ALSA
! /* for alsa, only one device is supported; it may be open for both input and output. */
! if (sys_audioapi == API_ALSA)
! alsa_open_audio(naudioindev, audioindev, nchindev, realinchans,
! naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
! else
! #endif
! #ifdef USEAPI_SGI
! if (sys_audioapi == API_SGI)
! sgi_open_audio(naudioindev, audioindev, nchindev, chindev,
! naudiooutdev, audiooutdev, nchoutdev, choutdev, rate);
else
! #endif
! #ifdef USEAPI_MMIO
! if (sys_audioapi == API_MMIO)
! mmio_open_audio(naudioindev, audioindev, nchindev, realinchans,
! naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate);
else
- #endif
- #ifdef USEAPI_ASIO
if (sys_audioapi == API_ASIO)
! asio_open_audio(naudioindev, audioindev, nchindev, chindev,
! naudiooutdev, audiooutdev, nchoutdev, choutdev, rate, schedmode);
else
- #endif
post("unknown audio API specified");
}
--- 319,332 ----
(naudiooutdev > 0 ? realoutchans[0] : 0), rate, schedmode);
else
#endif
! if (sys_audioapi == API_OSS || sys_audioapi == API_ALSA || sys_audioapi == API_MMIO)
! sys_audio()->open_audio(naudioindev, audioindev, nchindev, realinchans, naudiooutdev, audiooutdev, nchoutdev, realoutchans, rate, -42);
else
! if (sys_audioapi == API_SGI)
! sys_audio()->open_audio(naudioindev, audioindev, nchindev, chindev, naudiooutdev, audiooutdev, nchoutdev, choutdev, rate, -42);
else
if (sys_audioapi == API_ASIO)
! sys_audio()->open_audio(naudioindev, audioindev, nchindev, chindev, naudiooutdev, audiooutdev, nchoutdev, choutdev, rate, schedmode);
else
post("unknown audio API specified");
}
***************
*** 370,375 ****
if (enable) {
t_atom argv[1];
! t_symbol * selector = gensym("audio_started");
! t_symbol * pd = gensym("pd");
SETFLOAT(argv, 1.);
typedmess(pd->s_thing, selector, 1, argv);
--- 340,345 ----
if (enable) {
t_atom argv[1];
! t_symbol *selector = gensym("audio_started");
! t_symbol *pd = gensym("pd");
SETFLOAT(argv, 1.);
typedmess(pd->s_thing, selector, 1, argv);
***************
*** 422,446 ****
int sys_send_dacs(void) {
if (sys_meters) sys_peakmeters();
! #ifdef USEAPI_PORTAUDIO
! if (sys_audioapi == API_PORTAUDIO) return pa_send_dacs(); else
! #endif
! #ifdef USEAPI_JACK
! if (sys_audioapi == API_JACK) return jack_send_dacs(); else
! #endif
! #ifdef USEAPI_OSS
! if (sys_audioapi == API_OSS) return oss_send_dacs(); else
! #endif
! #ifdef USEAPI_ALSA
! if (sys_audioapi == API_ALSA) return alsa_send_dacs(); else
! #endif
! #ifdef USEAPI_SGI
! if (sys_audioapi == API_SGI) return sgi_send_dacs(); else
! #endif
! #ifdef USEAPI_MMIO
! if (sys_audioapi == API_MMIO) return mmio_send_dacs(); else
! #endif
! #ifdef USEAPI_ASIO
! if (sys_audioapi == API_ASIO) return asio_send_dacs(); else
! #endif
post("unknown API");
return 0;
--- 392,396 ----
int sys_send_dacs(void) {
if (sys_meters) sys_peakmeters();
! if (sys_audio()) return sys_audio()->send_dacs();
post("unknown API");
return 0;
***************
*** 467,499 ****
char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) {
audio_init();
! #ifdef USEAPI_PORTAUDIO
! if (sys_audioapi == API_PORTAUDIO)
! pa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_JACK
! if (sys_audioapi == API_JACK)
! jack_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_OSS
! if (sys_audioapi == API_OSS)
! oss_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_ALSA
! if (sys_audioapi == API_ALSA)
! alsa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_SGI
! if (sys_audioapi == API_SGI)
! sgi_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_MMIO
! if (sys_audioapi == API_MMIO)
! mmio_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! #ifdef USEAPI_ASIO
! if (sys_audioapi == API_ASIO)
! asio_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); else
! #endif
! {
/* this shouldn't happen once all the above get filled in. */
int i;
--- 417,422 ----
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. */
int i;