Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19642/src
Modified Files:
Tag: devel_0_39
s_audio_portaudio.c
Log Message:
reverting portaudio/pd indexing
Index: s_audio_portaudio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_portaudio.c,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** s_audio_portaudio.c 23 Apr 2006 12:13:45 -0000 1.1.2.3
--- s_audio_portaudio.c 5 May 2006 20:55:52 -0000 1.1.2.4
***************
*** 67,70 ****
--- 67,73 ----
static int pa_bufferpos;
+ static int pdindev2paindev(int pdindev);
+ static int pdoutdev2paoutdev(int pdoutdev);
+
int process (const void *input, void *output, unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
***************
*** 112,132 ****
if (inchans > 0)
{
! const PaDeviceInfo *info = Pa_GetDeviceInfo(indeviceno);
! int maxchans = info->maxOutputChannels;
! if (maxchans > 0)
{
! pa_indev = indeviceno;
}
}
!
if (outchans > 0)
{
! const PaDeviceInfo *info = Pa_GetDeviceInfo(outdeviceno);
! int maxchans = info->maxOutputChannels;
! if (maxchans > 0)
{
! pa_outdev = outdeviceno;
}
}
if (1/* sys_verbose */)
--- 115,156 ----
if (inchans > 0)
{
! for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
{
! const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
! int maxchans = info->maxInputChannels;
! if (maxchans > 0)
! {
! if (devno == indeviceno)
! {
! if (maxchans < inchans)
! inchans = maxchans;
! pa_indev = j;
! break;
! }
! devno++;
! }
}
}
!
if (outchans > 0)
{
! for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
{
! const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
! int maxchans = info->maxOutputChannels;
! if (maxchans > 0)
! {
! if (devno == outdeviceno)
! {
! if (maxchans < outchans)
! outchans = maxchans;
! pa_outdev = j;
! break;
! }
! devno++;
! }
}
}
+
if (1/* sys_verbose */)
***************
*** 430,434 ****
{
const PaDeviceInfo *pdi = Pa_GetDeviceInfo(i);
! if (nin < maxndev)
{
PaHostApiIndex api = pdi->hostApi;
--- 454,458 ----
{
const PaDeviceInfo *pdi = Pa_GetDeviceInfo(i);
! if (pdi->maxInputChannels > 0 && nin < maxndev)
{
PaHostApiIndex api = pdi->hostApi;
***************
*** 441,445 ****
nin++;
}
! if (nout < maxndev)
{
PaHostApiIndex api = pdi->hostApi;
--- 465,469 ----
nin++;
}
! if (pdi->maxOutputChannels > 0 && nout < maxndev)
{
PaHostApiIndex api = pdi->hostApi;
***************
*** 460,464 ****
void pa_getaudioindevinfo(t_float f)
{
! int i = (int)f;
const PaDeviceInfo * pdi;
--- 484,488 ----
void pa_getaudioindevinfo(t_float f)
{
! int i = pdindev2paindev((int)f);
const PaDeviceInfo * pdi;
***************
*** 481,485 ****
void pa_getaudiooutdevinfo(t_float f)
{
! int i = (int)f;
const PaDeviceInfo * pdi;
--- 505,509 ----
void pa_getaudiooutdevinfo(t_float f)
{
! int i = pdoutdev2paoutdev((int)f);
const PaDeviceInfo * pdi;
***************
*** 525,528 ****
--- 549,555 ----
PaStreamParameters inputParameters, outputParameters;
+ indev = pdindev2paindev(indev);
+ outdev = pdoutdev2paoutdev(outdev);
+
if ((pa_indev == -1) && (pa_outdev == -1))
{
***************
*** 547,548 ****
--- 574,613 ----
}
}
+
+ static int pdindev2paindev(int pdindev)
+ {
+ int j;
+ int devno;
+ for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
+ {
+ const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
+ int maxchans = info->maxInputChannels;
+ if (maxchans > 0)
+ {
+ if (devno == pdindev)
+ {
+ return devno;
+ }
+ devno++;
+ }
+ }
+ }
+
+ static int pdoutdev2paoutdev(int pdoutdev)
+ {
+ int j;
+ int devno;
+ for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
+ {
+ const PaDeviceInfo *info = Pa_GetDeviceInfo(j);
+ int maxchans = info->maxOutputChannels;
+ if (maxchans > 0)
+ {
+ if (devno == pdoutdev)
+ {
+ return devno;
+ }
+ devno++;
+ }
+ }
+ }