// Use bloching read/write for loopback.
#define PAQA_FLAG_USE_BLOCKING_IO (1<<1)
+const char * s_FlagOnNames[] =
+{
+ "Two Streams (Half Duplex)",
+ "Blocking Read/Write"
+};
+
+const char * s_FlagOffNames[] =
+{
+ "One Stream (Full Duplex)",
+ "Callback"
+};
+
#define DEFAULT_FRAMES_PER_BUFFER (256)
/** Parameters that describe a single test run. */
*/
if( in != NULL)
{
+ // Read each channel from the buffer.
for( int i=0; i<loopbackContext->test->inputParameters.channelCount; i++ )
{
- done |= PaQa_WriteRecording( &loopbackContext->recordings[i], in + i, framesPerBuffer, loopbackContext->test->inputParameters.channelCount );
+ done |= PaQa_WriteRecording( &loopbackContext->recordings[i],
+ in + i,
+ framesPerBuffer,
+ loopbackContext->test->inputParameters.channelCount );
}
}
{
PaQa_EraseBuffer( out, framesPerBuffer, loopbackContext->test->outputParameters.channelCount );
+
for( int i=0; i<loopbackContext->test->outputParameters.channelCount; i++ )
{
- PaQa_MixSine( &loopbackContext->generators[i], out + i, framesPerBuffer, loopbackContext->test->outputParameters.channelCount );
+ PaQa_MixSine( &loopbackContext->generators[i],
+ out + i,
+ framesPerBuffer,
+ loopbackContext->test->outputParameters.channelCount );
}
}
return done ? paComplete : paContinue;
// Save in a recording.
for( int i=0; i<loopbackContext->test->inputParameters.channelCount; i++ )
{
- done |= PaQa_WriteRecording( &loopbackContext->recordings[i], in + i, framesPerBuffer, loopbackContext->test->inputParameters.channelCount );
+ done |= PaQa_WriteRecording( &loopbackContext->recordings[i],
+ in + i,
+ framesPerBuffer,
+ loopbackContext->test->inputParameters.channelCount );
}
// Synthesize audio.
PaQa_EraseBuffer( out, available, loopbackContext->test->outputParameters.channelCount );
for( int i=0; i<loopbackContext->test->outputParameters.channelCount; i++ )
{
- PaQa_MixSine( &loopbackContext->generators[i], out + i, available, loopbackContext->test->outputParameters.channelCount );
+ PaQa_MixSine( &loopbackContext->generators[i],
+ out + i,
+ available,
+ loopbackContext->test->outputParameters.channelCount );
}
// Write out audio.
PaQaAnalysisResult analysisResult;
int numBadChannels = 0;
+ printf("| %5d | %6d | ", ((int)(testParams->sampleRate+0.5)), testParams->framesPerBuffer );
+ fflush(stdout);
+
testTone.samplesPerFrame = testParams->samplesPerFrame;
testTone.sampleRate = testParams->sampleRate;
testTone.amplitude = testParams->amplitude;
}
}
+ if( numBadChannels == 0 )
+ {
+ printf( "OK" );
+ }
+ printf( "\n" );
+
PaQa_TeardownLoopbackContext( &loopbackContext );
if( numBadChannels > 0 )
error:
PaQa_TeardownLoopbackContext( &loopbackContext );
+ printf( "\n" );
return err;
}
printf( "=============== Analysing Loopback %d to %d ====================\n", outputDevice, inputDevice );
printf( " Devices: %s => %s\n", outputDeviceInfo->name, inputDeviceInfo->name);
- int flagSettings[] = { 0, 1, 2, 3 };
+ int flagSettings[] = { 0, 1 };
int numFlagSettings = (sizeof(flagSettings)/sizeof(int));
double sampleRates[] = { 8000.0, 11025.0, 16000.0, 22050.0, 32000.0, 44100.0, 48000.0, 96000.0 };
int framesPerBuffers[] = { 0, 16, 32, 40, 64, 100, 128, 512, 1024 };
int numBufferSizes = (sizeof(framesPerBuffers)/sizeof(int));
- printf("|-sRate-|-buffer-|-latency-|-channel results--------------------|\n");
// Check to see if a specific value was requested.
if( userOptions->sampleRate > 0 )
{
for( int iFlags=0; iFlags<numFlagSettings; iFlags++ )
{
testParams.flags = flagSettings[iFlags];
- printf( "************ FLAGS = 0x%08X ************************\n", testParams.flags );
+ printf( "************ Mode = %s ************\n",
+ (( iFlags & 1 ) ? s_FlagOnNames[0] : s_FlagOffNames[0]) );
+ printf("|-sRate-|-buffer-|-latency-|-channel results--------------------|\n");
// Loop though combinations of audio parameters.
+ testParams.framesPerBuffer = 128;
for( int iRate=0; iRate<numRates; iRate++ )
{
// SAMPLE RATE
testParams.sampleRate = sampleRates[iRate];
testParams.maxFrames = (int) (1.2 * testParams.sampleRate);
- for( int iSize=0; iSize<numBufferSizes; iSize++ )
- {
- // BUFFER SIZE
- testParams.framesPerBuffer = framesPerBuffers[iSize];
- printf("| %5d | %6d | ", ((int)(testParams.sampleRate+0.5)), testParams.framesPerBuffer );
- fflush(stdout);
-
- int numBadChannels = PaQa_SingleLoopBackTest( userOptions, &testParams, expectedAmplitude );
- if( numBadChannels == 0 )
- {
- printf( "OK" );
- }
- //else if( numBadChannels < 0 )
- //{
- // printf( "Aborting because of error.\n" );
- // return numBadChannels;
- //}
- totalBadChannels += numBadChannels;
- printf( "\n" );
- }
- printf( "\n" );
+
+ int numBadChannels = PaQa_SingleLoopBackTest( userOptions, &testParams, expectedAmplitude );
+ totalBadChannels += numBadChannels;
}
+ printf( "\n" );
+
+ testParams.sampleRate = 44100;
+ testParams.maxFrames = (int) (1.2 * testParams.sampleRate);
+ for( int iSize=0; iSize<numBufferSizes; iSize++ )
+ {
+ // BUFFER SIZE
+ testParams.framesPerBuffer = framesPerBuffers[iSize];
+
+ int numBadChannels = PaQa_SingleLoopBackTest( userOptions, &testParams, expectedAmplitude );
+ totalBadChannels += numBadChannels;
+ }
+ printf( "\n" );
+
+
}
return totalBadChannels;
}
TODO - This should be moved into a doxydoc page.
+For more information on the TestPlan please visit:
+
+ http://www.portaudio.com/trac/wiki/TestPlan
+
This directory contains various programs to test PortAudio. The files
-named patest_* are tests, the files named debug_* are just scratch
-files that may or may not work.
+named patest_* are tests.
All following tests are up to date with the V19 API. They should all compile
(without any warnings on GCC 3.3). Note that this does not necessarily mean that
x- pa_fuzz.c
x- pa_minlat.c
-The debug_ files are still in V18 format and may need some V19 adaption.
-Feel free to fix them, most simply require adjusting to the new API.
-
-o- pa_tests/debug_convert.c
-o- pa_tests/debug_dither_calc.c
-o- pa_tests/debug_dual.c
-o- pa_tests/debug_multi_in.c
-o- pa_tests/debug_multi_out.c
-o- pa_tests/debug_record.c
-o- pa_tests/debug_record_reuse.c
-o- pa_tests/debug_sine.c
-o- pa_tests/debug_sine_amp.c
-o- pa_tests/debug_sine_formats.c
-o- pa_tests/debug_srate.c
-o- pa_tests/debug_test1.c
+Note that Phil Burk deleted the debug_* tests on 2/26/11. They were just hacked
+versions of old V18 tests. If we need to debug then we can just hack a working V19 test.