From: philburk Date: Thu, 18 Aug 2011 08:23:53 +0000 (+0000) Subject: Use bigger threshold to fix odd latency calculations. X-Git-Tag: pa_stable_v19_20111121_r1788~42 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=8b40f6d9e5e6e8b88028e2ec1e466d07da60e82b;p=portaudio Use bigger threshold to fix odd latency calculations. Use low default latency for loopback. --- diff --git a/qa/loopback/src/audio_analyzer.c b/qa/loopback/src/audio_analyzer.c index 6fa2f76..6674df3 100644 --- a/qa/loopback/src/audio_analyzer.c +++ b/qa/loopback/src/audio_analyzer.c @@ -494,7 +494,7 @@ int PaQa_MeasureLatency( PaQaRecording *recording, PaQaTestTone *testTone, PaQaA PaQa_EraseBuffer( buffer, cycleSize, testTone->samplesPerFrame ); PaQa_MixSine( &generator, buffer, cycleSize, testTone->samplesPerFrame ); - threshold = cycleSize * 0.01; + threshold = cycleSize * 0.02; analysisResult->latency = PaQa_FindFirstMatch( recording, buffer, cycleSize, threshold ); QA_ASSERT_TRUE( "Could not find the start of the signal.", (analysisResult->latency >= 0) ); analysisResult->amplitudeRatio = PaQa_CompareAmplitudes( recording, analysisResult->latency, buffer, cycleSize ); diff --git a/qa/loopback/src/paqa.c b/qa/loopback/src/paqa.c index 560b75d..3ac6599 100644 --- a/qa/loopback/src/paqa.c +++ b/qa/loopback/src/paqa.c @@ -243,10 +243,10 @@ static int RecordAndPlaySinesCallback( const void *inputBuffer, void *outputBuff return loopbackContext->done ? paComplete : paContinue; } -static void CopyStreamInfoToLoopbackContext( LoopbackContext *loopbackContext, const PaStream *inputStream, const PaStream *outputStream ) +static void CopyStreamInfoToLoopbackContext( LoopbackContext *loopbackContext, PaStream *inputStream, PaStream *outputStream ) { - PaStreamInfo *inputStreamInfo = Pa_GetStreamInfo( inputStream ); - PaStreamInfo *outputStreamInfo = Pa_GetStreamInfo( outputStream ); + const PaStreamInfo *inputStreamInfo = Pa_GetStreamInfo( inputStream ); + const PaStreamInfo *outputStreamInfo = Pa_GetStreamInfo( outputStream ); loopbackContext->streamInfoInputLatency = inputStreamInfo ? inputStreamInfo->inputLatency : -1; loopbackContext->streamInfoOutputLatency = outputStreamInfo ? outputStreamInfo->outputLatency : -1; @@ -903,12 +903,14 @@ static void PaQa_SetDefaultTestParameters( TestParameters *testParamsPtr, PaDevi testParamsPtr->inputParameters.device = inputDevice; testParamsPtr->inputParameters.sampleFormat = paFloat32; testParamsPtr->inputParameters.channelCount = testParamsPtr->samplesPerFrame; - testParamsPtr->inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputDevice )->defaultHighInputLatency; + testParamsPtr->inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputDevice )->defaultLowInputLatency; + //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; + testParamsPtr->outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputDevice )->defaultLowOutputLatency; + //testParamsPtr->outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputDevice )->defaultHighOutputLatency; } /*******************************************************************/ diff --git a/qa/loopback/src/test_audio_analyzer.c b/qa/loopback/src/test_audio_analyzer.c index 990d8d8..add57d4 100644 --- a/qa/loopback/src/test_audio_analyzer.c +++ b/qa/loopback/src/test_audio_analyzer.c @@ -527,6 +527,7 @@ static int TestInitialSpike( void ) { int result; +//( double sampleRate, int stepPosition, int cycleSize, int latencyFrames, double stepAmplitude ) // No spike. result = TestSingleInitialSpike( 44100, 32, 100, 537, 0.0 ); if( result < 0 ) return result; @@ -555,7 +556,7 @@ static int TestInitialSpike( void ) #if TEST_SAVED_WAVE /*==========================================================================================*/ /** - * Simple test that write a sawtooth waveform to a file. + * Simple test that writes a sawtooth waveform to a file. */ static int TestSavedWave() {