]> Repos - portaudio/commitdiff
Use bigger threshold to fix odd latency calculations.
authorphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 18 Aug 2011 08:23:53 +0000 (08:23 +0000)
committerphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Thu, 18 Aug 2011 08:23:53 +0000 (08:23 +0000)
Use low default latency for loopback.

qa/loopback/src/audio_analyzer.c
qa/loopback/src/paqa.c
qa/loopback/src/test_audio_analyzer.c

index 6fa2f76da665d464298659e86d7778235fbb553e..6674df3ed0d26131927d209ef0156c25c0ee2a48 100644 (file)
@@ -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 );
index 560b75de3f5d1f013c2396401203558764154767..3ac6599f35c0c3f7095bdfb86542c8cd40945bbe 100644 (file)
@@ -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;
 }
 
 /*******************************************************************/
index 990d8d8033390220c32d24c4b6c015916dc96cc6..add57d495e20d125ce98cae4819ee3841585ee23 100644 (file)
@@ -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()
 {