]> Repos - portaudio/commitdiff
Forgot error check after Pa_OpenStream. Naughty.
authorrobiwan <robiwan@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 19 Jun 2012 20:08:03 +0000 (20:08 +0000)
committerrobiwan <robiwan@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 19 Jun 2012 20:08:03 +0000 (20:08 +0000)
examples/paex_sine_c++.cpp

index cc436b3579b903b5a45381955f93b1365433d7f0..5b96aee7c546717468585b51037ef2dbf2a96b6c 100644 (file)
@@ -94,6 +94,12 @@ public:
             this            /* Using 'this' for userData so we can cast to Sine* in paCallback method */\r
             );\r
 \r
+        if (err != paNoError)\r
+        {\r
+            /* Failed to open stream to device !!! */\r
+            return false;\r
+        }\r
+\r
         err = Pa_SetStreamFinishedCallback( stream, &Sine::paStreamFinished );\r
 \r
         if (err != paNoError)\r
@@ -121,6 +127,9 @@ public:
 \r
     bool start()\r
     {\r
+        if (stream == 0)\r
+            return false;\r
+\r
         PaError err = Pa_StartStream( stream );\r
 \r
         return (err == paNoError);\r
@@ -128,6 +137,9 @@ public:
 \r
     bool stop()\r
     {\r
+        if (stream == 0)\r
+            return false;\r
+\r
         PaError err = Pa_StopStream( stream );\r
 \r
         return (err == paNoError);\r