Last modified 4 years ago
| Tutorial Quick-Links: |
- TutorialDir/BlockingReadWrite
- TutorialDir/Compile/Linux
- TutorialDir/Compile/MacintoshCoreAudio
- TutorialDir/Compile/Windows
- TutorialDir/Compile/WindowsASIOMSVC
- TutorialDir/Compile/WindowsMinGW
- TutorialDir/Exploring
- TutorialDir/InitializingPortAudio
- TutorialDir/OpenDefaultStream
- TutorialDir/QueryingDevices
- TutorialDir/StartStopAbort
- TutorialDir/TerminatingPortAudio
- TutorialDir/TutorialStart
- TutorialDir/UtilityFunctions
- TutorialDir/WritingACallback
Initializing PortAudio
Before making any other calls to PortAudio, you 'must' call Pa_Initialize(). This will trigger a scan of available devices which can be queried later. Like most PA functions, it will return a result of type paError. If the result is not paNoError, then an error has occurred.
err = Pa_Initialize(); if( err != paNoError ) goto error;
You can get a text message that explains the error message by passing it to Pa_GetErrorText( err ). For Example:
printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
It is also important, when you are done with PortAudio, to Terminate it:
err = Pa_Terminate(); if( err != paNoError ) printf( "PortAudio error: %s\n", Pa_GetErrorText( err ) );
Previous: Writing A Callback | Next: Opening A Stream Using the Defaults
