Raise pop threshold for loopback test.
This commit is contained in:
parent
c8dcb76f19
commit
af4e71a184
2 changed files with 15 additions and 10 deletions
|
|
@ -45,6 +45,7 @@
|
||||||
#include "audio_analyzer.h"
|
#include "audio_analyzer.h"
|
||||||
#include "write_wav.h"
|
#include "write_wav.h"
|
||||||
|
|
||||||
|
#define PAQA_POP_THRESHOLD (0.04)
|
||||||
|
|
||||||
/*==========================================================================================*/
|
/*==========================================================================================*/
|
||||||
double PaQa_GetNthFrequency( double baseFrequency, int index )
|
double PaQa_GetNthFrequency( double baseFrequency, int index )
|
||||||
|
|
@ -540,7 +541,7 @@ int PaQa_DetectPop( PaQaRecording *recording, PaQaTestTone *testTone, PaQaAnalys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( maxAmplitude > 0.01 )
|
if( maxAmplitude > PAQA_POP_THRESHOLD )
|
||||||
{
|
{
|
||||||
analysisResult->popPosition = maxPosition;
|
analysisResult->popPosition = maxPosition;
|
||||||
analysisResult->popAmplitude = maxAmplitude;
|
analysisResult->popAmplitude = maxAmplitude;
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,10 @@ int g_testsFailed = 0;
|
||||||
|
|
||||||
#define MAX_NUM_GENERATORS (8)
|
#define MAX_NUM_GENERATORS (8)
|
||||||
#define MAX_NUM_RECORDINGS (8)
|
#define MAX_NUM_RECORDINGS (8)
|
||||||
#define MAX_BACKGROUND_NOISE_RMS (0.00001)
|
#define MAX_BACKGROUND_NOISE_RMS (0.0004)
|
||||||
#define LOOPBACK_DETECTION_DURATION_SECONDS (0.5)
|
#define LOOPBACK_DETECTION_DURATION_SECONDS (0.8)
|
||||||
|
#define DEFAULT_FRAMES_PER_BUFFER (64)
|
||||||
|
#define PAQA_WAIT_STREAM_MSEC (100)
|
||||||
|
|
||||||
// Use two separate streams instead of one full duplex stream.
|
// Use two separate streams instead of one full duplex stream.
|
||||||
#define PAQA_FLAG_TWO_STREAMS (1<<0)
|
#define PAQA_FLAG_TWO_STREAMS (1<<0)
|
||||||
|
|
@ -74,7 +76,6 @@ const char * s_FlagOffNames[] =
|
||||||
"Callback"
|
"Callback"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_FRAMES_PER_BUFFER (256)
|
|
||||||
|
|
||||||
/** Parameters that describe a single test run. */
|
/** Parameters that describe a single test run. */
|
||||||
typedef struct TestParameters_s
|
typedef struct TestParameters_s
|
||||||
|
|
@ -134,7 +135,6 @@ static int RecordAndPlaySinesCallback( const void *inputBuffer, void *outputBuff
|
||||||
int i;
|
int i;
|
||||||
LoopbackContext *loopbackContext = (LoopbackContext *) userData;
|
LoopbackContext *loopbackContext = (LoopbackContext *) userData;
|
||||||
|
|
||||||
int channelsPerFrame = loopbackContext->test->inputParameters.channelCount;
|
|
||||||
|
|
||||||
loopbackContext->callbackCount += 1;
|
loopbackContext->callbackCount += 1;
|
||||||
if( statusFlags & paInputUnderflow ) loopbackContext->inputUnderflowCount += 1;
|
if( statusFlags & paInputUnderflow ) loopbackContext->inputUnderflowCount += 1;
|
||||||
|
|
@ -148,6 +148,7 @@ static int RecordAndPlaySinesCallback( const void *inputBuffer, void *outputBuff
|
||||||
*/
|
*/
|
||||||
if( inputBuffer != NULL)
|
if( inputBuffer != NULL)
|
||||||
{
|
{
|
||||||
|
int channelsPerFrame = loopbackContext->test->inputParameters.channelCount;
|
||||||
float *in = (float *)inputBuffer;
|
float *in = (float *)inputBuffer;
|
||||||
|
|
||||||
PaSampleFormat inFormat = loopbackContext->test->inputParameters.sampleFormat;
|
PaSampleFormat inFormat = loopbackContext->test->inputParameters.sampleFormat;
|
||||||
|
|
@ -169,6 +170,7 @@ static int RecordAndPlaySinesCallback( const void *inputBuffer, void *outputBuff
|
||||||
|
|
||||||
if( outputBuffer != NULL )
|
if( outputBuffer != NULL )
|
||||||
{
|
{
|
||||||
|
int channelsPerFrame = loopbackContext->test->outputParameters.channelCount;
|
||||||
float *out = (float *)outputBuffer;
|
float *out = (float *)outputBuffer;
|
||||||
|
|
||||||
PaSampleFormat outFormat = loopbackContext->test->outputParameters.sampleFormat;
|
PaSampleFormat outFormat = loopbackContext->test->outputParameters.sampleFormat;
|
||||||
|
|
@ -193,6 +195,7 @@ static int RecordAndPlaySinesCallback( const void *inputBuffer, void *outputBuff
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return loopbackContext->done ? paComplete : paContinue;
|
return loopbackContext->done ? paComplete : paContinue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,7 +230,7 @@ int PaQa_RunLoopbackFullDuplex( LoopbackContext *loopbackContext )
|
||||||
// Wait for stream to finish.
|
// Wait for stream to finish.
|
||||||
while( loopbackContext->done == 0 )
|
while( loopbackContext->done == 0 )
|
||||||
{
|
{
|
||||||
Pa_Sleep(50);
|
Pa_Sleep(PAQA_WAIT_STREAM_MSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = Pa_StopStream( stream );
|
err = Pa_StopStream( stream );
|
||||||
|
|
@ -796,13 +799,13 @@ static void PaQa_SetDefaultTestParameters( TestParameters *testParamsPtr, PaDevi
|
||||||
testParamsPtr->inputParameters.sampleFormat = paFloat32;
|
testParamsPtr->inputParameters.sampleFormat = paFloat32;
|
||||||
testParamsPtr->inputParameters.channelCount = testParamsPtr->samplesPerFrame;
|
testParamsPtr->inputParameters.channelCount = testParamsPtr->samplesPerFrame;
|
||||||
testParamsPtr->inputParameters.suggestedLatency =
|
testParamsPtr->inputParameters.suggestedLatency =
|
||||||
Pa_GetDeviceInfo( inputDevice )->defaultHighInputLatency;
|
Pa_GetDeviceInfo( inputDevice )->defaultLowInputLatency;
|
||||||
|
|
||||||
testParamsPtr->outputParameters.device = outputDevice;
|
testParamsPtr->outputParameters.device = outputDevice;
|
||||||
testParamsPtr->outputParameters.sampleFormat = paFloat32;
|
testParamsPtr->outputParameters.sampleFormat = paFloat32;
|
||||||
testParamsPtr->outputParameters.channelCount = testParamsPtr->samplesPerFrame;
|
testParamsPtr->outputParameters.channelCount = testParamsPtr->samplesPerFrame;
|
||||||
testParamsPtr->outputParameters.suggestedLatency =
|
testParamsPtr->outputParameters.suggestedLatency =
|
||||||
Pa_GetDeviceInfo( outputDevice )->defaultHighOutputLatency;
|
Pa_GetDeviceInfo( outputDevice )->defaultLowOutputLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
@ -824,7 +827,7 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
||||||
outputDeviceInfo = Pa_GetDeviceInfo( outputDevice );
|
outputDeviceInfo = Pa_GetDeviceInfo( outputDevice );
|
||||||
|
|
||||||
double bestSampleRate = 44100.0;
|
double bestSampleRate = 44100.0;
|
||||||
int bestBufferSize = 32;
|
int bestBufferSize = DEFAULT_FRAMES_PER_BUFFER;
|
||||||
|
|
||||||
printf( "=============== Analysing Loopback %d to %d ====================\n", outputDevice, inputDevice );
|
printf( "=============== Analysing Loopback %d to %d ====================\n", outputDevice, inputDevice );
|
||||||
printf( " Devices: %s => %s\n", outputDeviceInfo->name, inputDeviceInfo->name);
|
printf( " Devices: %s => %s\n", outputDeviceInfo->name, inputDeviceInfo->name);
|
||||||
|
|
@ -840,6 +843,7 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
||||||
int numBufferSizes = (sizeof(framesPerBuffers)/sizeof(int));
|
int numBufferSizes = (sizeof(framesPerBuffers)/sizeof(int));
|
||||||
|
|
||||||
PaSampleFormat sampleFormats[] = { paUInt8, paInt16, paInt32 };
|
PaSampleFormat sampleFormats[] = { paUInt8, paInt16, paInt32 };
|
||||||
|
const char *sampleFormatNames[] = { "paUInt8", "paInt16", "paInt32" };
|
||||||
int numSampleFormats = (sizeof(sampleFormats)/sizeof(PaSampleFormat));
|
int numSampleFormats = (sizeof(sampleFormats)/sizeof(PaSampleFormat));
|
||||||
|
|
||||||
// Check to see if a specific value was requested.
|
// Check to see if a specific value was requested.
|
||||||
|
|
@ -903,7 +907,7 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
||||||
PaSampleFormat format = sampleFormats[ iFormat ];
|
PaSampleFormat format = sampleFormats[ iFormat ];
|
||||||
testParams.inputParameters.sampleFormat = format;
|
testParams.inputParameters.sampleFormat = format;
|
||||||
testParams.outputParameters.sampleFormat = format;
|
testParams.outputParameters.sampleFormat = format;
|
||||||
printf("Sample format = %d\n", (int) format );
|
printf("Sample format = %d = %s\n", (int) format, sampleFormatNames[iFormat] );
|
||||||
int numBadChannels = PaQa_SingleLoopBackTest( userOptions, &testParams );
|
int numBadChannels = PaQa_SingleLoopBackTest( userOptions, &testParams );
|
||||||
totalBadChannels += numBadChannels;
|
totalBadChannels += numBadChannels;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue