From: Ross Bencina Date: Sat, 3 Sep 2016 06:16:12 +0000 (+1000) Subject: calling Pa_SelectHostApis now returns an error if it is called while PA is initialized. X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=f13a626eef9c2b7515405283dba2b2ddcba21a17;p=portaudio calling Pa_SelectHostApis now returns an error if it is called while PA is initialized. --- diff --git a/include/portaudio.h b/include/portaudio.h index 6d90d2f..5f98e15 100644 --- a/include/portaudio.h +++ b/include/portaudio.h @@ -134,7 +134,8 @@ typedef enum PaErrorCode paCanNotReadFromAnOutputOnlyStream, paCanNotWriteToAnInputOnlyStream, paIncompatibleStreamHostApi, - paBadBufferPtr + paBadBufferPtr, + paIsInitialized } PaErrorCode; @@ -276,8 +277,9 @@ typedef enum PaHostApiTypeId /** Select host APIs and their initialization order. - The selected host APIs take effect the next time that Pa_Initialize() is - invoked. + This function may only be called prior to calling Pa_Initialize() + or after calling Pa_Terminate(). The selected host APIs take effect the + next time that Pa_Initialize() is invoked. @param hostApiTypes An array of host API identifiers belonging to the PaHostApiTypeId enumeration. diff --git a/src/common/pa_front.c b/src/common/pa_front.c index 79aa108..de74457 100644 --- a/src/common/pa_front.c +++ b/src/common/pa_front.c @@ -217,6 +217,11 @@ PaError Pa_SelectHostApis( const PaHostApiTypeId *hostApiTypes, int count ) PaHostApiTypeId *oldSelectedHostApiTypes = selectedHostApiTypes_; PaHostApiTypeId *newSelectedHostApiTypes = NULL; + if( PA_IS_INITIALISED_ ) + { + return paIsInitialized; + } + if( count == 0 ) { /* revert to default state */