Use bigger threshold to fix odd latency calculations.

Use low default latency for loopback.
This commit is contained in:
philburk 2011-08-18 08:23:53 +00:00
commit 8b40f6d9e5
3 changed files with 10 additions and 7 deletions

View 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 );

View 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;
}
/*******************************************************************/

View 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()
{