Skip to content

Commit

Permalink
calling Pa_SelectHostApis now returns an error if it is called while …
Browse files Browse the repository at this point in the history
…PA is initialized.
  • Loading branch information
RossBencina committed Sep 3, 2016
1 parent 9039daf commit f13a626
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/portaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ typedef enum PaErrorCode
paCanNotReadFromAnOutputOnlyStream,
paCanNotWriteToAnInputOnlyStream,
paIncompatibleStreamHostApi,
paBadBufferPtr
paBadBufferPtr,
paIsInitialized
} PaErrorCode;


Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions src/common/pa_front.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit f13a626

Please sign in to comment.