WSJT-X/padevsub.c
Joe Taylor 2c17544f3f initial import
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/WSJT/trunk@1 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2005-12-22 16:40:53 +00:00

37 lines
809 B
C

// #include <stdio.h>
// #include <math.h>
#include "portaudio.h"
int __stdcall PADEVSUB(int *numdev, int *ndefin, int *ndefout,
int nchin[], int nchout[])
{
int i,j;
int numDevices;
const PaDeviceInfo *pdi;
PaError err;
Pa_Initialize();
numDevices = Pa_CountDevices();
*numdev=numDevices;
if( numDevices < 0 ) {
err = numDevices;
goto error;
}
for( i=0; i<numDevices; i++ ) {
pdi = Pa_GetDeviceInfo( i );
if(i == Pa_GetDefaultInputDeviceID()) *ndefin=i;
if(i == Pa_GetDefaultOutputDeviceID()) *ndefout=i;
nchin[i]=pdi->maxInputChannels;
nchout[i]=pdi->maxOutputChannels;
printf("Audio device %d: In=%d Out=%d %s\n",i,nchin[i],nchout[i],pdi->name);
}
Pa_Terminate();
return 0;
error:
Pa_Terminate();
return err;
}