From: philburk Date: Fri, 22 Jun 2012 21:02:36 +0000 (+0000) Subject: Fixed warnings that broke build. X-Git-Tag: pa_stable_v19_20140130_r1919~62 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=39f9a22d282691ab9054b3e1969b8a39ce618c26;p=portaudio Fixed warnings that broke build. Fixed bug added to paqa_latency.c that caused a failed test to appear to succeed. Error result was not passed up to main. --- diff --git a/qa/paqa_latency.c b/qa/paqa_latency.c index 2e75440..6142a80 100644 --- a/qa/paqa_latency.c +++ b/qa/paqa_latency.c @@ -253,8 +253,8 @@ static int paqaCheckMultipleSuggested( PaDeviceIndex deviceIndex, int isInput ) if( (highLatency - lowLatency) < 0.001 ) { - numLoops = 1; - } + numLoops = 1; + } for( i=0; i 1024) */ - if( i == 0 | i == ( numLoops - 1 )) - toleranceRatio = 0.1; - else - toleranceRatio = 1.0; + toleranceRatio = ( (i == 0) || (i == ( numLoops - 1 )) ) ? 0.1 : 1.0; QA_ASSERT_CLOSE( "final latency should be close to suggested latency", streamParameters.suggestedLatency, finalLatency, (streamParameters.suggestedLatency * toleranceRatio) ); if( i == 0 ) + { previousLatency = finalLatency; + } } + if( numLoops > 1 ) + { QA_ASSERT_TRUE( " final latency should increase with suggested latency", (finalLatency > previousLatency) ); + } return 0; error: @@ -323,18 +325,22 @@ static int paqaVerifySuggestedLatency( void ) printf("\nUsing device #%d: '%s' (%s)\n", id, pdi->name, Pa_GetHostApiInfo(pdi->hostApi)->name); if( pdi->maxOutputChannels > 0 ) { - if( (result = paqaCheckMultipleSuggested( id, 0 )) != 0 ) + if( paqaCheckMultipleSuggested( id, 0 ) < 0 ) + { printf("OUTPUT CHECK FAILED !!! #%d: '%s'\n", id, pdi->name); + result -= 1; + } } if( pdi->maxInputChannels > 0 ) { - if( (result = paqaCheckMultipleSuggested( id, 1 )) != 0 ) + if( paqaCheckMultipleSuggested( id, 1 ) < 0 ) + { printf("INPUT CHECK FAILED !!! #%d: '%s'\n", id, pdi->name); + result -= 1; + } } } - return 0; -error: - return -1; + return result; } /*******************************************************************/ @@ -463,14 +469,13 @@ int main(void) err = paqaCheckLatency( &outputParameters, &data, sampleRate, paFramesPerBufferUnspecified ); if( err != paNoError ) goto error; - Pa_Terminate(); - printf("Test finished.\n"); - + printf("SUCCESS - test finished.\n"); return err; + error: Pa_Terminate(); - fprintf( stderr, "An error occured while using the portaudio stream\n" ); + fprintf( stderr, "ERROR - test failed.\n" ); fprintf( stderr, "Error number: %d\n", err ); fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) ); return err;