]> Repos - portaudio/commitdiff
calling Pa_SelectHostApis now returns an error if it is called while PA is initialized.
authorRoss Bencina <rossb@audiomulch.com>
Sat, 3 Sep 2016 06:16:12 +0000 (16:16 +1000)
committerRoss Bencina <rossb@audiomulch.com>
Sat, 3 Sep 2016 06:16:12 +0000 (16:16 +1000)
include/portaudio.h
src/common/pa_front.c

index 6d90d2ff01e1995111954c5f02f8670bdd5d80a3..5f98e1500f7c540c73ae649da585a009af205407 100644 (file)
@@ -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.
index 79aa1087c5258635e2ff36631a81619e2753fe62..de74457772d0e30f21da26a0354994c7e11110d1 100644 (file)
@@ -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 */