Updates to test programs when specifying default device numbers.
authorGary Scavone <gary@music.mcgill.ca>
Sat, 26 Apr 2014 13:44:39 +0000 (09:44 -0400)
committerGary Scavone <gary@music.mcgill.ca>
Sat, 26 Apr 2014 13:44:39 +0000 (09:44 -0400)
tests/duplex.cpp
tests/playraw.cpp
tests/playsaw.cpp
tests/testall.cpp
tests/teststops.cpp

index 291d2aa91eda7a1e8d4d84105d52d80652378465..06462f2872aae5edbf6f883c01037cc8756f7df4 100644 (file)
@@ -97,6 +97,11 @@ int main( int argc, char *argv[] )
   oParams.nChannels = channels;
   oParams.firstChannel = oOffset;
 
+  if ( iDevice == 0 )
+    iParams.deviceId = adac.getDefaultInputDevice();
+  if ( oDevice == 0 )
+    oParams.deviceId = adac.getDefaultOutputDevice();
+
   RtAudio::StreamOptions options;
   //options.flags |= RTAUDIO_NONINTERLEAVED;
 
index 75e7d130410cbe22d8eeebce4928d76107f555d2..f11f83c28f4b90738ca72cba6773dd30f52234f6 100644 (file)
@@ -125,6 +125,9 @@ int main( int argc, char *argv[] )
   oParams.nChannels = channels;
   oParams.firstChannel = offset;
 
+  if ( device == 0 )
+    oParams.deviceId = dac.getDefaultOutputDevice();
+
   data.channels = channels;
   try {
     dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &output, (void *)&data );
index 2be179bb1145a5500c53acfb89a29850333b14ba..d1953b6ca164c0a14ffc3ef136b08d60f5072c26 100644 (file)
@@ -174,6 +174,9 @@ int main( int argc, char *argv[] )
   oParams.nChannels = channels;
   oParams.firstChannel = offset;
 
+  if ( device == 0 )
+    oParams.deviceId = dac.getDefaultOutputDevice();
+
   options.flags = RTAUDIO_HOG_DEVICE;
   options.flags |= RTAUDIO_SCHEDULE_REALTIME;
 #if !defined( USE_INTERLEAVED )
index ec7107b45a38208607dc339deefda5d55a56b441..419f27b630729bfb9c6d5a3d99e6fdbc8832ccab 100644 (file)
@@ -128,6 +128,9 @@ int main( int argc, char *argv[] )
   oParams.nChannels = channels;
   oParams.firstChannel = oOffset;
 
+  if ( oDevice == 0 )
+    oParams.deviceId = dac.getDefaultOutputDevice();
+
   RtAudio::StreamOptions options;
   options.flags = RTAUDIO_HOG_DEVICE;
   try {
@@ -192,6 +195,8 @@ int main( int argc, char *argv[] )
   iParams.deviceId = iDevice;
   iParams.nChannels = channels;
   iParams.firstChannel = iOffset;
+  if ( iDevice == 0 )
+    iParams.deviceId = dac.getDefaultInputDevice();
   options.flags = RTAUDIO_NONINTERLEAVED;
   try {
     dac.openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options );
index 5c6ed384f85907331577ee7d69e99a9b0555482d..e24c06490ab0877b8ebfcf7500c00ba0404459a5 100644 (file)
@@ -121,6 +121,11 @@ int main( int argc, char *argv[] )
   iParams.nChannels = mydata.channels;\r
   iParams.firstChannel = iOffset;\r
 \r
+  if ( iDevice == 0 )\r
+    iParams.deviceId = adc->getDefaultInputDevice();\r
+  if ( oDevice == 0 )\r
+    oParams.deviceId = adc->getDefaultOutputDevice();\r
+\r
   // First, test external stopStream() calls.\r
   mydata.pulseCount = PULSE_RATE * fs;\r
   mydata.nFrames = 50 * fs;\r