3 * Copyright 2006 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
27 #include <gri_portaudio.h>
28 #include <portaudio.h>
33 gri_pa_find_device_by_name(const char *name)
37 const PaDeviceInfo *pdi;
38 int len = strlen( name );
39 PaDeviceIndex result = paNoDevice;
40 numDevices = Pa_GetDeviceCount();
41 for( i=0; i<numDevices; i++ )
43 pdi = Pa_GetDeviceInfo( i );
44 if( strncmp( name, pdi->name, len ) == 0 )
57 int numDevices, defaultDisplayed, myDevice=0;
58 const PaDeviceInfo *deviceInfo;
60 numDevices = Pa_GetDeviceCount();
64 printf("Number of devices found = %d\n", numDevices);
66 for (int i=0; i < numDevices; i++ ) {
67 deviceInfo = Pa_GetDeviceInfo( i );
68 printf( "--------------------------------------- device #%d\n", i );
69 /* Mark global and API specific default devices */
71 if( i == Pa_GetDefaultInputDevice() )
74 printf( "[ Default Input" );
77 else if( i == Pa_GetHostApiInfo( deviceInfo->hostApi )->defaultInputDevice )
79 const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo( deviceInfo->hostApi );
80 printf( "[ Default %s Input", hostInfo->name );
84 if( i == Pa_GetDefaultOutputDevice() )
86 printf( (defaultDisplayed ? "," : "[") );
87 printf( " Default Output" );
90 else if( i == Pa_GetHostApiInfo( deviceInfo->hostApi )->defaultOutputDevice )
92 const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo( deviceInfo->hostApi );
93 printf( (defaultDisplayed ? "," : "[") );
94 printf( " Default %s Output", hostInfo->name );
97 if( defaultDisplayed )
100 /* print device info fields */
101 printf( "Name = %s\n", deviceInfo->name );
102 printf( "Host API = %s\n", Pa_GetHostApiInfo( deviceInfo->hostApi )->name );
103 printf( "Max inputs = %d", deviceInfo->maxInputChannels );
104 printf( ", Max outputs = %d\n", deviceInfo->maxOutputChannels );
106 printf( "Default low input latency = %8.3f\n", deviceInfo->defaultLowInputLatency );
107 printf( "Default low output latency = %8.3f\n", deviceInfo->defaultLowOutputLatency );
108 printf( "Default high input latency = %8.3f\n", deviceInfo->defaultHighInputLatency );
109 printf( "Default high output latency = %8.3f\n", deviceInfo->defaultHighOutputLatency );