Commit 21853da8 authored by philburk's avatar philburk

Added paloopback test to the automated build.


git-svn-id: https://subversion.assembla.com/svn/portaudio/portaudio/trunk@1614 0f58301d-fd10-0410-b4af-bbb618454e57
parent 91624110
......@@ -58,6 +58,14 @@ COMMON_OBJS = \
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 \
bin/paqa_errs \
......@@ -140,10 +148,11 @@ SRC_DIRS = \
SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
all: lib/$(PALIB) all-recursive tests
all: lib/$(PALIB) all-recursive tests loopback
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)
......@@ -154,6 +163,9 @@ $(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)
......@@ -180,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
......
......@@ -146,9 +146,6 @@ int PaQa_WriteRecording( PaQaRecording *recording, float *buffer, int numFrames,
}
recording->numFrames += framesToWrite;
return (recording->numFrames >= recording->maxFrames);
error:
return -1;
}
/*==========================================================================================*/
......@@ -166,9 +163,6 @@ int PaQa_WriteSilence( PaQaRecording *recording, int numFrames )
}
recording->numFrames += framesToRecord;
return (recording->numFrames >= recording->maxFrames);
error:
return -1;
}
/*==========================================================================================*/
......@@ -187,9 +181,6 @@ int PaQa_RecordFreeze( PaQaRecording *recording, int numFrames )
}
recording->numFrames += framesToRecord;
return (recording->numFrames >= recording->maxFrames);
error:
return -1;
}
/*==========================================================================================*/
......@@ -518,7 +509,7 @@ int PaQa_DetectPhaseError( PaQaRecording *recording, PaQaTestTone *testTone, PaQ
double phase = 666.0;
double mag = PaQa_CorrelateSine( recording, testTone->frequency, testTone->sampleRate, i, windowSize, &phase );
if( loopCount > 1)
if( (loopCount > 1) && (mag > 0.0) )
{
double phaseDelta = PaQa_ComputePhaseDifference( phase, previousPhase );
double phaseError = PaQa_ComputePhaseDifference( phaseDelta, expectedPhaseIncrement );
......@@ -573,7 +564,7 @@ int PaQa_AnalyseRecording( PaQaRecording *recording, PaQaTestTone *testTone, PaQ
if( (analysisResult->latency >= 0) && (analysisResult->amplitudeRatio > 0.1) )
{
analysisResult->valid = 1;
analysisResult->valid = (1);
result = PaQa_DetectPop( recording, testTone, analysisResult );
QA_ASSERT_EQUALS( "detect pop", 0, result );
......@@ -584,4 +575,5 @@ int PaQa_AnalyseRecording( PaQaRecording *recording, PaQaTestTone *testTone, PaQ
return 0;
error:
return -1;
}
}
......@@ -53,7 +53,7 @@ extern int g_testsFailed;
#define QA_ASSERT_EQUALS( message, expected, actual ) \
if( (expected) != (actual) ) \
if( ((expected) != (actual)) ) \
{ \
printf( "%s:%d - ERROR - %s, expected %d, got %d\n", __FILE__, __LINE__, message, expected, actual ); \
g_testsFailed++; \
......
......@@ -48,6 +48,8 @@
#define FRAMES_PER_BLOCK (64)
#define PRINT_REPORTS 0
#define TEST_SAVED_WAVE (0)
/*==========================================================================================*/
/**
* Detect a single tone.
......@@ -425,7 +427,7 @@ static int TestDetectPops( void )
return 0;
}
#if TEST_SAVED_WAVE
/*==========================================================================================*/
/**
* Simple test that write a sawtooth waveform to a file.
......@@ -464,6 +466,7 @@ error:
printf("ERROR: result = %d\n", result );
return result;
}
#endif /* TEST_SAVED_WAVE */
/*==========================================================================================*/
/**
......@@ -558,26 +561,26 @@ error:
int PaQa_TestAnalyzer( void )
{
int result;
#if TEST_SAVED_WAVE
// Write a simple wave file.
//if (result = TestSavedWave()) return result;
if ((result = TestSavedWave()) != 0) return result;
#endif /* TEST_SAVED_WAVE */
// Generate single tone and verify presence.
if (result = TestSingleMonoTone()) return result;
if ((result = TestSingleMonoTone()) != 0) return result;
// Generate prime series of tones and verify presence.
if (result = TestMixedMonoTones()) return result;
if ((result = TestMixedMonoTones()) != 0) return result;
// Detect dropped or added samples in a sine wave recording.
if (result = TestDetectPhaseErrors()) return result;
if ((result = TestDetectPhaseErrors()) != 0) return result;
// Test to see if notch filter can knock out the test tone.
if (result = TestNotchFilter()) return result;
if ((result = TestNotchFilter()) != 0) return result;
// Detect pops that get back in phase.
if (result = TestDetectPops()) return result;
if ((result = TestDetectPops()) != 0) return result;
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment