int right_inc = 3; /* higher pitch so we can distinguish left and right. */
int i, j, k;
int bufferCount;
-
printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
}
outputParameters.channelCount = 2; /* stereo output */
outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
- outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
+ outputParameters.suggestedLatency = 0.050; // Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
err = Pa_OpenStream(
printf("Test finished.\n");
return err;
+
error:
- Pa_Terminate();
fprintf( stderr, "An error occured while using the portaudio stream\n" );
fprintf( stderr, "Error number: %d\n", err );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
+ // Print more information about the error.
+ if( err == paUnanticipatedHostError )
+ {
+ const PaHostErrorInfo *hostErrorInfo = Pa_GetLastHostErrorInfo();
+ fprintf( stderr, "Host API error = #%d, hostApiType = %d\n", hostErrorInfo->errorCode, hostErrorInfo->hostApiType );
+ fprintf( stderr, "Host API error = %s\n", hostErrorInfo->errorText );
+ }
+ Pa_Terminate();
return err;
}