Pa_RefreshDevice functionality
This commit is contained in:
parent
16884fc201
commit
1f01a3ddc0
8 changed files with 337 additions and 2 deletions
46
examples/paex_refresh_devs.c
Normal file
46
examples/paex_refresh_devs.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "portaudio.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
PaError err = paNoError;
|
||||
|
||||
PaDeviceIndex defaultOutputDevice;
|
||||
PaDeviceIndex defaultInputDevice;
|
||||
|
||||
err = Pa_Initialize();
|
||||
if( err != paNoError )
|
||||
{
|
||||
printf( "ERROR: Pa_Initialize returned 0x%x\n", err );
|
||||
goto error;
|
||||
}
|
||||
|
||||
printf( "PortAudio version: 0x%08X\n", Pa_GetVersion());
|
||||
// printf( "Version text: '%s'\n", Pa_GetVersionInfo()->versionText );
|
||||
|
||||
const int count = 20;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
defaultInputDevice = Pa_GetDefaultInputDevice();
|
||||
defaultOutputDevice = Pa_GetDefaultOutputDevice();
|
||||
printf("Input: %i, Output: %i\n", defaultInputDevice, defaultOutputDevice);
|
||||
|
||||
err = Pa_RefreshDevices();
|
||||
if( err != paNoError )
|
||||
{
|
||||
printf( "ERROR: Pa_RefreshDevices returned 0x%x\n", err );
|
||||
goto error;
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
Pa_Terminate();
|
||||
|
||||
printf("----------------------------------------------\n");
|
||||
return 0;
|
||||
error:
|
||||
return 1;
|
||||
}
|
||||
Loading…
Reference in a new issue