bin/paex_write_sine \
bin/paex_write_sine_nonint
-TESTS = \
+SELFTESTS = \
bin/paqa_devs \
bin/paqa_errs \
+ bin/paqa_latency
+
+TESTS = \
bin/patest1 \
bin/patest_buffer \
bin/patest_callbackstop \
SUBDIRS =
@ENABLE_CXX_TRUE@SUBDIRS += bindings/cpp
-all: lib/$(PALIB) all-recursive tests examples
+all: lib/$(PALIB) all-recursive tests examples selftests
tests: bin-stamp $(TESTS)
examples: bin-stamp $(EXAMPLES)
+selftests: bin-stamp $(SELFTESTS)
+
loopback: bin-stamp bin/paloopback
# With ASIO enabled we must link libportaudio and all test programs with CXX
@WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS)
@WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/examples/$*.c lib/$(PALIB) $(LIBS)
+$(SELFTESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) qa/%.c
+ @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/qa/$*.c lib/$(PALIB) $(LIBS)
+ @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/qa/$*.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)
/** @file paqa_devs.c
- @ingroup test_src
+ @ingroup qa_src
@brief Self Testing Quality Assurance app for PortAudio
Try to open each device and run through all the
possible configurations. This test does not verify
error:
Pa_Terminate();
printf("QA Report: %d passed, %d failed.\n", gNumPassed, gNumFailed );
- return 0;
+ return (gNumFailed > 0) ? 1 : 0;
}
/*******************************************************************
for( jc=1; jc<=maxChannels; jc++ )
{
- printf("Name = %s\n", pdi->name );
+ printf("\n========================================================================\n");
+ printf(" Device = %s\n", pdi->name );
+ printf("========================================================================\n");
/* Try each standard sample rate. */
for( i=0; standardSampleRates[i] > 0; i++ )
{
PaError result = paNoError;
PaQaData myData;
#define FRAMES_PER_BUFFER (64)
+ const int kNumSeconds = 100;
/* Setup data for synthesis thread. */
- myData.framesLeft = (unsigned long) (sampleRate * 100); /* 100 seconds */
+ myData.framesLeft = (unsigned long) (sampleRate * kNumSeconds);
myData.numChannels = numChannels;
myData.mode = mode;
myData.format = format;
ipp = &inputParameters;
}
else
- ipp = NULL;
- if( mode == MODE_OUTPUT ) /* Pa_GetDeviceInfo(paNoDevice) COREDUMPS!!! */
+ {
+ ipp = NULL;
+ }
+
+ if( mode == MODE_OUTPUT )
{
outputParameters.device = deviceID;
outputParameters.channelCount = numChannels;
opp = &outputParameters;
}
else
- opp = NULL;
-
+ {
+ opp = NULL;
+ }
+
if(paFormatIsSupported == Pa_IsFormatSupported( ipp, opp, sampleRate ))
{
printf("------ TestAdvance: %s, device = %d, rate = %g, numChannels = %d, format = %lu -------\n",
oldStamp = Pa_GetStreamTime(stream);
Pa_Sleep(msec);
newStamp = Pa_GetStreamTime(stream);
- printf("oldStamp = %g,newStamp = %g\n", oldStamp, newStamp ); /**/
+ printf("oldStamp = %g, newStamp = %g\n", oldStamp, newStamp ); /**/
EXPECT( (oldStamp < newStamp) );
/* Check to make sure callback is decrementing framesLeft. */
oldFrames = myData.framesLeft;
stream = NULL;
}
}
+ return 0;
error:
if( stream != NULL ) Pa_CloseStream( stream );
- return result;
+ return -1;
}
/** @file paqa_errs.c
- @ingroup test_src
+ @ingroup qa_src
@brief Self Testing Quality Assurance app for PortAudio
Do lots of bad things to test error reporting.
@author Phil Burk http://www.softsynth.com
static int TestBadActions( void )
{
PaStream* stream = NULL;
+ const PaDeviceInfo* deviceInfo = NULL;
PaError result;
PaQaData myData;
PaStreamParameters opp;
SAMPLE_RATE, FRAMES_PER_BUFFER,
paClipOff, QaCallback, &myData )) == paNoError));
}
-
+
+ HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(paNoDevice)) == NULL));
+ HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(87654)) == NULL));
HOPEFOR(((result = Pa_StartStream(NULL)) == paBadStreamPtr));
HOPEFOR(((result = Pa_StopStream(NULL)) == paBadStreamPtr));
HOPEFOR(((result = Pa_IsStreamStopped(NULL)) == paBadStreamPtr));
-/** @file patest_sine.c
- @ingroup test_src
- @brief Play a sine wave for several seconds.
+/** @file paqa_latency.c
+ @ingroup qa_src
+ @brief Test latency estimates.
@author Ross Bencina <rossb@audiomulch.com>
@author Phil Burk <philburk@softsynth.com>
*/
dataPtr->maxDeltaDacTime = 0.0;
dataPtr->callbackCount = 0;
- printf("-------------------------------------\n");
printf("Stream parameter: suggestedOutputLatency = %g\n", outputParamsPtr->suggestedLatency );
if( framesPerBuffer == paFramesPerBufferUnspecified ){
printf("Stream parameter: user framesPerBuffer = paFramesPerBufferUnspecified\n" );
Pa_Sleep( 1 * 1000 );
+ printf("-------------------------------------\n");
return err;
error2:
Pa_CloseStream( stream );
error1:
+ printf("-------------------------------------\n");
return err;
}
printf("Device info: defaultHighOutputLatency = %f seconds\n", deviceInfo->defaultHighOutputLatency);
outputParameters.hostApiSpecificStreamInfo = NULL;
+
// Try to use a small buffer that is smaller than we think the device can handle.
// Try to force combining multiple user buffers into a host buffer.
+ printf("------------- Try a very small buffer.\n");
framesPerBuffer = 9;
outputParameters.suggestedLatency = deviceInfo->defaultLowOutputLatency;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, framesPerBuffer );
if( err != paNoError ) goto error;
+ printf("------------- 64 frame buffer with 1.1 * defaultLow latency.\n");
framesPerBuffer = 64;
outputParameters.suggestedLatency = deviceInfo->defaultLowOutputLatency * 1.1;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, framesPerBuffer );
if( err != paNoError ) goto error;
// Try to create a huge buffer that is bigger than the allowed device maximum.
+ printf("------------- Try a huge buffer.\n");
framesPerBuffer = 16*1024;
outputParameters.suggestedLatency = ((double)framesPerBuffer) / sampleRate; // approximate
err = paqaCheckLatency( &outputParameters, &data, sampleRate, framesPerBuffer );
if( err != paNoError ) goto error;
+ printf("------------- Try suggestedLatency = 0.0\n");
outputParameters.suggestedLatency = 0.0;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, paFramesPerBufferUnspecified );
if( err != paNoError ) goto error;
+ printf("------------- Try suggestedLatency = defaultLowOutputLatency\n");
outputParameters.suggestedLatency = deviceInfo->defaultLowOutputLatency;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, paFramesPerBufferUnspecified );
if( err != paNoError ) goto error;
+ printf("------------- Try suggestedLatency = defaultHighOutputLatency\n");
outputParameters.suggestedLatency = deviceInfo->defaultHighOutputLatency;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, paFramesPerBufferUnspecified );
if( err != paNoError ) goto error;
-
+
+ printf("------------- Try suggestedLatency = defaultHighOutputLatency * 4\n");
outputParameters.suggestedLatency = deviceInfo->defaultHighOutputLatency * 4;
err = paqaCheckLatency( &outputParameters, &data, sampleRate, paFramesPerBufferUnspecified );
if( err != paNoError ) goto error;