WASAPI : Ring buffer in/out index fix
authorMarcus Tomlinson <themarcustomlinson@gmail.com>
Sun, 24 Feb 2019 16:15:29 +0000 (16:15 +0000)
committerStephen Sinclair <radarsat1@users.noreply.github.com>
Mon, 25 Feb 2019 11:03:01 +0000 (12:03 +0100)
RtAudio.cpp

index ce2001d6a22751e1c23b209ecc13d0d919e53e42..f38c60f0d8461521ed8043e33f020ea80fb0ec3e 100644 (file)
@@ -3841,8 +3841,9 @@ public:
       relOutIndex += bufferSize_;
     }
 
-    // "in" index can end on the "out" index but cannot begin at it
-    if ( inIndex_ < relOutIndex && inIndexEnd > relOutIndex ) {
+    // the "IN" index CAN BEGIN at the "OUT" index
+    // the "IN" index CANNOT END at the "OUT" index
+    if ( inIndex_ < relOutIndex && inIndexEnd >= relOutIndex ) {
       return false; // not enough space between "in" index and "out" index
     }
 
@@ -3902,7 +3903,8 @@ public:
       relInIndex += bufferSize_;
     }
 
-    // "out" index can begin at and end on the "in" index
+    // the "OUT" index CANNOT BEGIN at the "IN" index
+    // the "OUT" index CAN END at the "IN" index
     if ( outIndex_ <= relInIndex && outIndexEnd > relInIndex ) {
       return false; // not enough space between "out" index and "in" index
     }