summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-audio-portaudio/src/audio_portaudio_sink.cc9
-rw-r--r--gr-audio-portaudio/src/audio_portaudio_source.cc11
2 files changed, 15 insertions, 5 deletions
diff --git a/gr-audio-portaudio/src/audio_portaudio_sink.cc b/gr-audio-portaudio/src/audio_portaudio_sink.cc
index 06bcc957a..602f11835 100644
--- a/gr-audio-portaudio/src/audio_portaudio_sink.cc
+++ b/gr-audio-portaudio/src/audio_portaudio_sink.cc
@@ -176,16 +176,21 @@ audio_portaudio_sink::audio_portaudio_sink(int sampling_rate,
for (i=0;i<numDevices;i++) {
deviceInfo = Pa_GetDeviceInfo( i );
fprintf(stderr,"Testing device name: %s",deviceInfo->name);
+ if (deviceInfo->maxOutputChannels <= 0) {
+ fprintf(stderr,"\n");
+ continue;
+ }
if (strstr(deviceInfo->name, d_device_name.c_str())){
fprintf(stderr," Chosen!\n");
- device = gri_pa_find_device_by_name(deviceInfo->name);
+ device = i;
fprintf(stderr,"%s using %s as the host\n",d_device_name.c_str(),
Pa_GetHostApiInfo(deviceInfo->hostApi)->name), fflush(stderr);
found = true;
deviceInfo = Pa_GetDeviceInfo(device);
i = numDevices; // force loop exit
}
- fprintf(stderr,"\n"),fflush(stderr);
+ else
+ fprintf(stderr,"\n"),fflush(stderr);
}
if (!found){
diff --git a/gr-audio-portaudio/src/audio_portaudio_source.cc b/gr-audio-portaudio/src/audio_portaudio_source.cc
index 3741e826c..8638d4369 100644
--- a/gr-audio-portaudio/src/audio_portaudio_source.cc
+++ b/gr-audio-portaudio/src/audio_portaudio_source.cc
@@ -102,7 +102,7 @@ portaudio_source_callback (const void *inputBuffer,
self->d_log->printf("PAsrc cb: f/b = %4ld OVERRUN\n", framesPerBuffer);
self->d_noverruns++;
- ::write(2, "aU", 2); // FIXME change to non-blocking call
+ ::write(2, "aO", 2); // FIXME change to non-blocking call
#if 0
// copy any frames that will fit
@@ -181,16 +181,21 @@ audio_portaudio_source::audio_portaudio_source(int sampling_rate,
for (i=0;i<numDevices;i++) {
deviceInfo = Pa_GetDeviceInfo( i );
fprintf(stderr,"Testing device name: %s",deviceInfo->name);
+ if (deviceInfo->maxInputChannels <= 0) {
+ fprintf(stderr,"\n");
+ continue;
+ }
if (strstr(deviceInfo->name, d_device_name.c_str())){
fprintf(stderr," Chosen!\n");
- device = gri_pa_find_device_by_name(deviceInfo->name);
+ device = i;
fprintf(stderr,"%s using %s as the host\n",d_device_name.c_str(),
Pa_GetHostApiInfo(deviceInfo->hostApi)->name), fflush(stderr);
found = true;
deviceInfo = Pa_GetDeviceInfo(device);
i = numDevices; // force loop exit
}
- fprintf(stderr,"\n"),fflush(stderr);
+ else
+ fprintf(stderr,"\n"),fflush(stderr);
}
if (!found){