summaryrefslogtreecommitdiff
path: root/RtAudio.cpp
diff options
context:
space:
mode:
authorGary Scavone <gary@music.mcgill.ca>2019-04-07 15:38:58 -0400
committerGary Scavone <gary@music.mcgill.ca>2019-04-19 15:16:47 -0400
commitdfadcff5c912beee1d1b76d50d47adcea2e400e4 (patch)
tree6fc078cf91d5c6fdfc6f9c585f846b47257166a4 /RtAudio.cpp
parent10a2ceddb4912a555dbfa61dc6b7fce0e29f8fb3 (diff)
Added clearing of input user buffer in stopStream for OS-X, in case stream is restarted.
Diffstat (limited to 'RtAudio.cpp')
-rw-r--r--RtAudio.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index 912704e..0dff2d3 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -1656,7 +1656,12 @@ void RtApiCore :: stopStream( void )
stream_.state = STREAM_STOPPED;
// set stream time to zero?
- // and perhaps clear input user or device buffers?
+ // Clear user input buffer in case the stream is restarted
+ if ( stream_.mode == INPUT || stream_.mode == DUPLEX ) {
+ unsigned long bufferBytes;
+ bufferBytes = stream_.nUserChannels[1] * stream_.bufferSize * formatBytes( stream_.userFormat );
+ memset( stream_.userBuffer[1], 0, bufferBytes * sizeof(char) );
+ }
unlock:
if ( result == noErr ) return;