diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2019-04-07 15:38:58 -0400 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2019-04-19 15:16:47 -0400 |
| commit | dfadcff5c912beee1d1b76d50d47adcea2e400e4 (patch) | |
| tree | 6fc078cf91d5c6fdfc6f9c585f846b47257166a4 /RtAudio.cpp | |
| parent | 10a2ceddb4912a555dbfa61dc6b7fce0e29f8fb3 (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.cpp | 7 |
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; |
