int outputOverflowCount;
int primingCount;
TestParameters *test;
-
+ volatile int done;
} LoopbackContext;
typedef struct UserOptions_s
void *userData )
{
int i;
- int done = paContinue;
LoopbackContext *loopbackContext = (LoopbackContext *) userData;
int channelsPerFrame = loopbackContext->test->inputParameters.channelCount;
/* This may get called with NULL inputBuffer during initial setup.
* We may also use the same callback with output only streams.
*/
- if( inputBuffer != NULL)
+ if( inputBuffer != NULL)
{
float *in = (float *)inputBuffer;
// Read each channel from the buffer.
for( i=0; i<channelsPerFrame; i++ )
{
- done |= PaQa_WriteRecording( &loopbackContext->recordings[i],
+ loopbackContext->done |= PaQa_WriteRecording( &loopbackContext->recordings[i],
in + i,
framesPerBuffer,
channelsPerFrame );
out = (float *) g_ConversionBuffer;
}
- PaQa_EraseBuffer( out, framesPerBuffer, loopbackContext->test->outputParameters.channelCount );
+ PaQa_EraseBuffer( out, framesPerBuffer, channelsPerFrame );
for( i=0; i<channelsPerFrame; i++ )
{
PaQa_MixSine( &loopbackContext->generators[i],
}
}
- return done ? paComplete : paContinue;
+ return loopbackContext->done ? paComplete : paContinue;
}
/*******************************************************************/
PaStream *stream = NULL;
PaError err = 0;
TestParameters *test = loopbackContext->test;
-
+ loopbackContext->done = 0;
// Use one full duplex stream.
err = Pa_OpenStream(
&stream,
if( err != paNoError ) goto error;
// Wait for stream to finish.
- while( Pa_IsStreamActive( stream ) )
+ while( loopbackContext->done == 0 )
{
Pa_Sleep(50);
}
PaStream *outStream = NULL;
PaError err = 0;
TestParameters *test = loopbackContext->test;
+ loopbackContext->done = 0;
// Use two half duplex streams.
err = Pa_OpenStream(
if( err != paNoError ) goto error;
// Wait for stream to finish.
- while( Pa_IsStreamActive( inStream ) )
+ while( loopbackContext->done == 0 )
{
Pa_Sleep(50);
}
PaStream *inStream = NULL;
PaError err = 0;
TestParameters *test = loopbackContext->test;
+ loopbackContext->done = 0;
// Just open an input stream.
err = Pa_OpenStream(
if( err != paNoError ) goto error;
// Wait for stream to finish.
- while( Pa_IsStreamActive( inStream ) )
+ while( loopbackContext->done == 0 )
{
Pa_Sleep(50);
}
printf( "\n" );
+ Pa_Sleep( 500 );
PaQa_TeardownLoopbackContext( &loopbackContext );
if( numBadChannels > 0 )
testParamsPtr->inputParameters.device = inputDevice;
testParamsPtr->inputParameters.sampleFormat = paFloat32;
testParamsPtr->inputParameters.channelCount = testParamsPtr->samplesPerFrame;
+ testParamsPtr->inputParameters.suggestedLatency =
+ Pa_GetDeviceInfo( inputDevice )->defaultHighInputLatency;
testParamsPtr->outputParameters.device = outputDevice;
testParamsPtr->outputParameters.sampleFormat = paFloat32;
testParamsPtr->outputParameters.channelCount = testParamsPtr->samplesPerFrame;
+ testParamsPtr->outputParameters.suggestedLatency =
+ Pa_GetDeviceInfo( outputDevice )->defaultHighOutputLatency;
}
/*******************************************************************/
int iFormat;
int totalBadChannels = 0;
TestParameters testParams;
- const PaDeviceInfo *inputDeviceInfo;
- const PaDeviceInfo *outputDeviceInfo;
+ const PaDeviceInfo *inputDeviceInfo;
+ const PaDeviceInfo *outputDeviceInfo;
inputDeviceInfo = Pa_GetDeviceInfo( inputDevice );
outputDeviceInfo = Pa_GetDeviceInfo( outputDevice );
double bestSampleRate = 44100.0;
int bestBufferSize = 32;
-
printf( "=============== Analysing Loopback %d to %d ====================\n", outputDevice, inputDevice );
printf( " Devices: %s => %s\n", outputDeviceInfo->name, inputDeviceInfo->name);