summaryrefslogtreecommitdiff
path: root/tests/duplex.cpp
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 /tests/duplex.cpp
parent3619a028768e5f689aeaa49838f5216914d9163c (diff)
Bug fix for double stream time ticking in OS-X if duplex stream with two different devices.
Diffstat (limited to 'tests/duplex.cpp')
-rw-r--r--tests/duplex.cpp10
1 files changed, 9 insertions, 1 deletions
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;