]> Repos - portaudio/commitdiff
Added paloopback test to the automated build.
authorphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 1 Mar 2011 01:54:20 +0000 (01:54 +0000)
committerphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 1 Mar 2011 01:54:20 +0000 (01:54 +0000)
Makefile.in
qa/loopback/src/audio_analyzer.c
qa/loopback/src/qa_tools.h
qa/loopback/src/test_audio_analyzer.c

index c613ca1879f66d5fef9b6f4dd57fe7551abfd926..ba89041f60b40f4f3ce3223618825e3d8b0749fe 100644 (file)
@@ -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
 
index aff93d0de4e4969aca109654d75ae7172fc1532d..a8a22c8aaa7b5d6c4ea0b85c56613f1b14ae91ed 100644 (file)
@@ -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;
-}      
+}
+
index 9a60d045853a483ff25d49bf33a996d37a0362a9..32be2155d211fb16cc2b44a77c75c3887ec77533 100755 (executable)
@@ -53,7 +53,7 @@ extern int g_testsFailed;
 \r
 \r
 #define QA_ASSERT_EQUALS( message, expected, actual ) \\r
-       if( (expected) != (actual) ) \\r
+       if( ((expected) != (actual)) ) \\r
        { \\r
                printf( "%s:%d - ERROR - %s, expected %d, got %d\n", __FILE__, __LINE__, message, expected, actual ); \\r
                g_testsFailed++; \\r
index 08a4fca9d2a5ffa1b8b169c0089e45fd328337c1..4f6112e331de08333661549f89181e01573b8ce2 100644 (file)
@@ -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;
 }