summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Scavone <gary@music.mcgill.ca>2019-04-07 15:02:40 -0400
committerGary Scavone <gary@music.mcgill.ca>2019-04-19 15:16:47 -0400
commit0eb9c6351d0f7e51b625547af94b9c01828b2963 (patch)
tree53851fff8af32b84420c9415ac77ef3a01122ab5
parent3619a028768e5f689aeaa49838f5216914d9163c (diff)
Bug fix for double stream time ticking in OS-X if duplex stream with two different devices.
-rw-r--r--RtAudio.cpp1
-rw-r--r--tests/duplex.cpp10
2 files changed, 9 insertions, 2 deletions
diff --git a/RtAudio.cpp b/RtAudio.cpp
index fd8380b..2edc14a 100644
--- a/RtAudio.cpp
+++ b/RtAudio.cpp
@@ -1947,7 +1947,6 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId,
}
unlock:
- //MUTEX_UNLOCK( &stream_.mutex );
// Make sure to only tick duplex stream time once if using two devices
if ( stream_.mode != DUPLEX || (stream_.mode == DUPLEX && handle->id[0] != handle->id[1] && deviceId == handle->id[0] ) )
diff --git a/tests/duplex.cpp b/tests/duplex.cpp
index 494e5ad..c5abc3b 100644
--- a/tests/duplex.cpp
+++ b/tests/duplex.cpp
@@ -48,13 +48,21 @@ void usage( void ) {
exit( 0 );
}
+double streamTimePrintIncrement = 1.0; // seconds
+double streamTimePrintTime = 1.0; // seconds
+
int inout( void *outputBuffer, void *inputBuffer, unsigned int /*nBufferFrames*/,
- double /*streamTime*/, RtAudioStreamStatus status, void *data )
+ double streamTime, RtAudioStreamStatus status, void *data )
{
// Since the number of input and output channels is equal, we can do
// a simple buffer copy operation here.
if ( status ) std::cout << "Stream over/underflow detected." << std::endl;
+ if ( streamTime >= streamTimePrintTime ) {
+ std::cout << "streamTime = " << streamTime << std::endl;
+ streamTimePrintTime += streamTimePrintIncrement;
+ }
+
unsigned int *bytes = (unsigned int *) data;
memcpy( outputBuffer, inputBuffer, *bytes );
return 0;