calling Pa_SelectHostApis now returns an error if it is called while PA is initialized.

This commit is contained in:
Ross Bencina 2016-09-03 16:16:12 +10:00
commit f13a626eef
2 changed files with 10 additions and 3 deletions

View file

@ -134,7 +134,8 @@ typedef enum PaErrorCode
paCanNotReadFromAnOutputOnlyStream, paCanNotReadFromAnOutputOnlyStream,
paCanNotWriteToAnInputOnlyStream, paCanNotWriteToAnInputOnlyStream,
paIncompatibleStreamHostApi, paIncompatibleStreamHostApi,
paBadBufferPtr paBadBufferPtr,
paIsInitialized
} PaErrorCode; } PaErrorCode;
@ -276,8 +277,9 @@ typedef enum PaHostApiTypeId
/** Select host APIs and their initialization order. /** Select host APIs and their initialization order.
The selected host APIs take effect the next time that Pa_Initialize() is This function may only be called prior to calling Pa_Initialize()
invoked. 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 @param hostApiTypes An array of host API identifiers belonging to the
PaHostApiTypeId enumeration. PaHostApiTypeId enumeration.

View file

@ -217,6 +217,11 @@ PaError Pa_SelectHostApis( const PaHostApiTypeId *hostApiTypes, int count )
PaHostApiTypeId *oldSelectedHostApiTypes = selectedHostApiTypes_; PaHostApiTypeId *oldSelectedHostApiTypes = selectedHostApiTypes_;
PaHostApiTypeId *newSelectedHostApiTypes = NULL; PaHostApiTypeId *newSelectedHostApiTypes = NULL;
if( PA_IS_INITIALISED_ )
{
return paIsInitialized;
}
if( count == 0 ) if( count == 0 )
{ {
/* revert to default state */ /* revert to default state */