Add loopback target to Makefile.
Fixes to loopback test for ALSA.
This commit is contained in:
parent
2abba447e6
commit
284a16cf4f
2 changed files with 38 additions and 21 deletions
16
Makefile.in
16
Makefile.in
|
|
@ -57,6 +57,14 @@ COMMON_OBJS = \
|
|||
src/common/pa_stream.o \
|
||||
src/common/pa_trace.o \
|
||||
src/hostapi/skeleton/pa_hostapi_skeleton.o
|
||||
|
||||
LOOPBACK_OBJS = \
|
||||
qa/loopback/src/audio_analyzer.o \
|
||||
qa/loopback/src/biquad_filter.o \
|
||||
qa/loopback/src/paqa_tools.o \
|
||||
qa/loopback/src/test_audio_analyzer.o \
|
||||
qa/loopback/src/write_wav.o \
|
||||
qa/loopback/src/paqa.o
|
||||
|
||||
TESTS = \
|
||||
bin/paqa_devs \
|
||||
|
|
@ -144,6 +152,8 @@ all: lib/$(PALIB) all-recursive tests
|
|||
|
||||
tests: bin-stamp $(TESTS)
|
||||
|
||||
loopback: bin-stamp bin/paloopback
|
||||
|
||||
# With ASIO enabled we must link libportaudio and all test programs with CXX
|
||||
lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC)
|
||||
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS)
|
||||
|
|
@ -153,6 +163,10 @@ $(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c
|
|||
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
|
||||
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS)
|
||||
|
||||
bin/paloopback: lib/$(PALIB) $(MAKEFILE) $(PAINC) $(LOOPBACK_OBJS)
|
||||
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS)
|
||||
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(LOOPBACK_OBJS) lib/$(PALIB) $(LIBS)
|
||||
|
||||
install: lib/$(PALIB) portaudio-2.0.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(libdir)
|
||||
$(LIBTOOL) --mode=install $(INSTALL) lib/$(PALIB) $(DESTDIR)$(libdir)
|
||||
|
|
@ -178,7 +192,7 @@ uninstall:
|
|||
$(MAKE) uninstall-recursive
|
||||
|
||||
clean:
|
||||
$(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(ALL_TESTS) lib/$(PALIB)
|
||||
$(LIBTOOL) --mode=clean rm -f $(LTOBJS) $(LOOPBACK_OBJS) $(ALL_TESTS) lib/$(PALIB)
|
||||
$(RM) bin-stamp lib-stamp
|
||||
-$(RM) -r bin lib
|
||||
|
||||
|
|
|
|||
|
|
@ -284,8 +284,8 @@ static int RecordAndPlayBlockingIO( PaStream *inStream,
|
|||
)
|
||||
{
|
||||
int i;
|
||||
float *in = (float *)g_BigBuffer;
|
||||
float *out = (float *)g_BigBuffer;
|
||||
float *in = (float *)g_BigBuffer;
|
||||
float *out = (float *)g_BigBuffer;
|
||||
PaError err;
|
||||
int done = 0;
|
||||
long available;
|
||||
|
|
@ -307,12 +307,12 @@ static int RecordAndPlayBlockingIO( PaStream *inStream,
|
|||
}
|
||||
|
||||
// Save in a recording.
|
||||
for( i=0; i<loopbackContext->test->inputParameters.channelCount; i++ )
|
||||
for( i=0; i<loopbackContext->test->inputParameters.channelCount; i++ )
|
||||
{
|
||||
done |= PaQa_WriteRecording( &loopbackContext->recordings[i],
|
||||
in + i,
|
||||
framesPerBuffer,
|
||||
loopbackContext->test->inputParameters.channelCount );
|
||||
in + i,
|
||||
framesPerBuffer,
|
||||
loopbackContext->test->inputParameters.channelCount );
|
||||
}
|
||||
|
||||
// Synthesize audio.
|
||||
|
|
@ -322,9 +322,9 @@ static int RecordAndPlayBlockingIO( PaStream *inStream,
|
|||
for( i=0; i<loopbackContext->test->outputParameters.channelCount; i++ )
|
||||
{
|
||||
PaQa_MixSine( &loopbackContext->generators[i],
|
||||
out + i,
|
||||
available,
|
||||
loopbackContext->test->outputParameters.channelCount );
|
||||
out + i,
|
||||
available,
|
||||
loopbackContext->test->outputParameters.channelCount );
|
||||
}
|
||||
|
||||
// Write out audio.
|
||||
|
|
@ -705,6 +705,8 @@ static void PaQa_SetDefaultTestParameters( TestParameters *testParamsPtr, PaDevi
|
|||
static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceIndex inputDevice, PaDeviceIndex outputDevice, double expectedAmplitude )
|
||||
{
|
||||
int i;
|
||||
int iFlags;
|
||||
int iRate;
|
||||
int iSize;
|
||||
int totalBadChannels = 0;
|
||||
TestParameters testParams;
|
||||
|
|
@ -719,10 +721,10 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
|||
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 };
|
||||
double sampleRates[] = { 44100.0, 48000.0, 8000.0, 11025.0, 16000.0, 22050.0, 32000.0, 96000.0 };
|
||||
int numRates = (sizeof(sampleRates)/sizeof(double));
|
||||
|
||||
int framesPerBuffers[] = { 0, 16, 32, 40, 64, 100, 128, 512, 1024 };
|
||||
int framesPerBuffers[] = { 256, 16, 32, 40, 64, 100, 128, 512, 1024 };
|
||||
int numBufferSizes = (sizeof(framesPerBuffers)/sizeof(int));
|
||||
|
||||
// Check to see if a specific value was requested.
|
||||
|
|
@ -749,7 +751,7 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
|||
printf("|-sRate-|-buffer-|-latency-|-channel results--------------------|\n");
|
||||
|
||||
// Loop though combinations of audio parameters.
|
||||
testParams.framesPerBuffer = 128;
|
||||
testParams.framesPerBuffer = framesPerBuffers[0];
|
||||
for( iRate=0; iRate<numRates; iRate++ )
|
||||
{
|
||||
// SAMPLE RATE
|
||||
|
|
@ -761,7 +763,7 @@ static int PaQa_AnalyzeLoopbackConnection( UserOptions *userOptions, PaDeviceInd
|
|||
}
|
||||
printf( "\n" );
|
||||
|
||||
testParams.sampleRate = 44100;
|
||||
testParams.sampleRate = sampleRates[0];
|
||||
testParams.maxFrames = (int) (1.2 * testParams.sampleRate);
|
||||
for( iSize=0; iSize<numBufferSizes; iSize++ )
|
||||
{
|
||||
|
|
@ -839,9 +841,9 @@ int PaQa_CheckForLoopBack( PaDeviceIndex inputDevice, PaDeviceIndex outputDevice
|
|||
startFrame, numFrames, NULL );
|
||||
|
||||
double magRightReverse = PaQa_CorrelateSine( &loopbackContext.recordings[1],
|
||||
loopbackContext.generators[0].frequency,
|
||||
testParams.sampleRate,
|
||||
startFrame, numFrames, NULL );
|
||||
loopbackContext.generators[0].frequency,
|
||||
testParams.sampleRate,
|
||||
startFrame, numFrames, NULL );
|
||||
|
||||
if ((magLeftReverse > 0.1) && (magRightReverse>minAmplitude))
|
||||
{
|
||||
|
|
@ -866,6 +868,7 @@ error:
|
|||
*/
|
||||
static int ScanForLoopback(UserOptions *userOptions)
|
||||
{
|
||||
PaDeviceIndex i,j;
|
||||
int numLoopbacks = 0;
|
||||
int numDevices;
|
||||
numDevices = Pa_GetDeviceCount();
|
||||
|
|
@ -881,7 +884,7 @@ static int ScanForLoopback(UserOptions *userOptions)
|
|||
else if (userOptions->inputDevice >= 0)
|
||||
{
|
||||
// Just scan for output.
|
||||
for( PaDeviceIndex i=0; i<numDevices; i++ )
|
||||
for( i=0; i<numDevices; i++ )
|
||||
{
|
||||
int loopbackConnected = PaQa_CheckForLoopBack( userOptions->inputDevice, i );
|
||||
if( loopbackConnected > 0 )
|
||||
|
|
@ -894,7 +897,7 @@ static int ScanForLoopback(UserOptions *userOptions)
|
|||
else if (userOptions->outputDevice >= 0)
|
||||
{
|
||||
// Just scan for input.
|
||||
for( PaDeviceIndex i=0; i<numDevices; i++ )
|
||||
for( i=0; i<numDevices; i++ )
|
||||
{
|
||||
int loopbackConnected = PaQa_CheckForLoopBack( i, userOptions->inputDevice );
|
||||
if( loopbackConnected > 0 )
|
||||
|
|
@ -907,9 +910,9 @@ static int ScanForLoopback(UserOptions *userOptions)
|
|||
else
|
||||
{
|
||||
// Scan both.
|
||||
for( PaDeviceIndex i=0; i<numDevices; i++ )
|
||||
for( i=0; i<numDevices; i++ )
|
||||
{
|
||||
for( PaDeviceIndex j=0; j<numDevices; j++ )
|
||||
for( j=0; j<numDevices; j++ )
|
||||
{
|
||||
int loopbackConnected = PaQa_CheckForLoopBack( i, j );
|
||||
if( loopbackConnected > 0 )
|
||||
|
|
|
|||
Loading…
Reference in a new issue