18 PAIO::PAIO(
unsigned sr,
unsigned bs,
int in_stream,
int out_stream,
unsigned in_chans,
unsigned out_chans)
19 :
IO(sr, bs, in_stream, out_stream, in_chans, out_chans) {
22 this->
initialize(sr, bs, in_stream, out_stream, in_chans, out_chans);
27 logMsg(
"PAIO::destructor");
41 static int pa_callback (
const void * inputPointer,
void * outputPointer,
42 unsigned long framesPerBuffer,
const PaStreamCallbackTimeInfo *outTime,
43 PaStreamCallbackFlags statusFlags,
void * userData) {
45 sample * out = (
float *) outputPointer;
74 throw IOError(
"Portaudio error");
105 if (err != paNoError) {
107 logMsg(
"Error opening PortAudio: %s", Pa_GetErrorText(err ));
109 throw IOError(
"Error opening PortAudio");
112 mThisSec = mTimeVals = mTimeSum = 0;
131 if (err != paNoError)
148 if (err != paNoError)
165 if (err != paNoError)
186 }
catch (CException ex) {
195 void PAIO::initialize(
unsigned sr,
unsigned bs,
int is,
int os,
unsigned ic,
unsigned oc) {
196 const PaDeviceInfo *pdi;
215 is = (int)Pa_GetDefaultInputDevice();
217 os = (int)Pa_GetDefaultOutputDevice();
229 PaDeviceIndex numDevices = Pa_GetDeviceCount();
233 for (
int i = 0; i < numDevices; i++) {
234 pdi = Pa_GetDeviceInfo(i);
236 pdi->maxInputChannels, pdi->maxOutputChannels,
237 (i == (
int)Pa_GetDefaultInputDevice()), (i == (
int)Pa_GetDefaultOutputDevice()));
238 devPtr->
mFrameRates.push_back(pdi->defaultSampleRate);
275 for (
unsigned i = 0; i <
mDevices.size(); i++) {