Merge pull request #68 from jpcima/master
[rtaudio-cdist.git] / RtAudio.cpp
index 5d49366358f450fcfdf400206b31df22437e7673..0b952f02ec8812c169d3eb17d1ca5c94ae151070 100644 (file)
@@ -1947,7 +1947,7 @@ struct JackHandle {
 static void jackSilentError( const char * ) {};\r
 \r
 RtApiJack :: RtApiJack()\r
-{\r
+    :shouldAutoconnect_(true) {\r
   // Nothing to do here.\r
 #if !defined(__RTAUDIO_DEBUG__)\r
   // Turn off Jack's internal error reporting.\r
@@ -2358,6 +2358,8 @@ bool RtApiJack :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne
   // here.\r
   if ( stream_.doConvertBuffer[mode] ) setConvertInfo( mode, 0 );\r
 \r
+  if ( options && options->flags & RTAUDIO_JACK_DONT_CONNECT ) shouldAutoconnect_ = false;\r
+\r
   return SUCCESS;\r
 \r
  error:\r
@@ -2447,7 +2449,7 @@ void RtApiJack :: startStream( void )
   const char **ports;\r
 \r
   // Get the list of available ports.\r
-  if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) {\r
+  if ( shouldAutoconnect_ && (stream_.mode == OUTPUT || stream_.mode == DUPLEX) ) {\r
     result = 1;\r
     ports = jack_get_ports( handle->client, handle->deviceName[0].c_str(), NULL, JackPortIsInput);\r
     if ( ports == NULL) {\r
@@ -2471,7 +2473,7 @@ void RtApiJack :: startStream( void )
     free(ports);\r
   }\r
 \r
-  if ( stream_.mode == INPUT || stream_.mode == DUPLEX ) {\r
+  if ( shouldAutoconnect_ && (stream_.mode == INPUT || stream_.mode == DUPLEX) ) {\r
     result = 1;\r
     ports = jack_get_ports( handle->client, handle->deviceName[1].c_str(), NULL, JackPortIsOutput );\r
     if ( ports == NULL) {\r
@@ -5287,6 +5289,8 @@ Exit:
 // Various revisions for RtAudio 4.0 by Gary Scavone, April 2007\r
 // Changed device query structure for RtAudio 4.0.7, January 2010\r
 \r
+#include <mmsystem.h>\r
+#include <mmreg.h>\r
 #include <dsound.h>\r
 #include <assert.h>\r
 #include <algorithm>\r