Syntax changes to test programs and restoration of Windows VC++ project files (gps).
authorGary Scavone <gary@music.mcgill.ca>
Thu, 22 Nov 2007 16:12:08 +0000 (16:12 +0000)
committerStephen Sinclair <sinclair@music.mcgill.ca>
Thu, 10 Oct 2013 23:29:21 +0000 (01:29 +0200)
tests/Makefile.in
tests/audioprobe.cpp [new file with mode: 0644]
tests/duplex.cpp
tests/playraw.cpp
tests/playsaw.cpp
tests/probe.cpp [deleted file]
tests/testall.cpp

index be9cc8babace61fa0fa01ee545bf47bac2616f3d..449dcf4b7ba6fae741e0b80f83a339fdfd18f240 100644 (file)
@@ -1,6 +1,6 @@
 ### RtAudio tests Makefile - for various flavors of unix
 
-PROGRAMS = probe playsaw playraw record duplex testall
+PROGRAMS = audioprobe playsaw playraw record duplex testall
 RM = /bin/rm
 SRC_PATH = ../
 INCLUDE = ../
@@ -22,8 +22,8 @@ LIBRARY += @frameworks@
 
 all : $(PROGRAMS)
 
-probe : probe.cpp $(OBJECTS)
-       $(CC) $(CFLAGS) $(DEFS) -o probe probe.cpp $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
+audioprobe : audioprobe.cpp $(OBJECTS)
+       $(CC) $(CFLAGS) $(DEFS) -o audioprobe audioprobe.cpp $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
 
 playsaw : playsaw.cpp $(OBJECTS)
        $(CC) $(CFLAGS) $(DEFS) -o playsaw playsaw.cpp $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
diff --git a/tests/audioprobe.cpp b/tests/audioprobe.cpp
new file mode 100644 (file)
index 0000000..f7246fb
--- /dev/null
@@ -0,0 +1,86 @@
+/******************************************/
+/*
+  audioprobe.cpp
+  by Gary P. Scavone, 2001
+
+  Probe audio system and prints device info.
+*/
+/******************************************/
+
+#include "RtAudio.h"
+#include <iostream>
+#include <map>
+
+int main()
+{
+  // Create an api map.
+  std::map<int, std::string> apiMap;
+  apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio";
+  apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO";
+  apiMap[RtAudio::WINDOWS_DS] = "Windows Direct Sound";
+  apiMap[RtAudio::UNIX_JACK] = "Jack Client";
+  apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA";
+  apiMap[RtAudio::LINUX_OSS] = "Linux OSS";
+  apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy";
+
+  std::vector< RtAudio::Api > apis;
+  RtAudio :: getCompiledApi( apis );
+
+  std::cout << "\nCompiled APIs:\n";
+  for ( unsigned int i=0; i<apis.size(); i++ )
+    std::cout << "  " << apiMap[ apis[i] ] << std::endl;
+
+  RtAudio audio;
+  RtAudio::DeviceInfo info;
+
+  std::cout << "\nCurrent API: " << apiMap[ audio.getCurrentApi() ] << std::endl;
+
+  unsigned int devices = audio.getDeviceCount();
+  std::cout << "\nFound " << devices << " device(s) ...\n";
+
+  for (unsigned int i=0; i<devices; i++) {
+    info = audio.getDeviceInfo(i);
+
+    std::cout << "\nDevice Name = " << info.name << '\n';
+    if ( info.probed == false )
+      std::cout << "Probe Status = UNsuccessful\n";
+    else {
+      std::cout << "Probe Status = Successful\n";
+      std::cout << "Output Channels = " << info.outputChannels << '\n';
+      std::cout << "Input Channels = " << info.inputChannels << '\n';
+      std::cout << "Duplex Channels = " << info.duplexChannels << '\n';
+      if ( info.isDefaultOutput ) std::cout << "This is the default output device.\n";
+      else std::cout << "This is NOT the default output device.\n";
+      if ( info.isDefaultInput ) std::cout << "This is the default input device.\n";
+      else std::cout << "This is NOT the default input device.\n";
+      if ( info.nativeFormats == 0 )
+        std::cout << "No natively supported data formats(?)!";
+      else {
+        std::cout << "Natively supported data formats:\n";
+        if ( info.nativeFormats & RTAUDIO_SINT8 )
+          std::cout << "  8-bit int\n";
+        if ( info.nativeFormats & RTAUDIO_SINT16 )
+          std::cout << "  16-bit int\n";
+        if ( info.nativeFormats & RTAUDIO_SINT24 )
+          std::cout << "  24-bit int\n";
+        if ( info.nativeFormats & RTAUDIO_SINT32 )
+          std::cout << "  32-bit int\n";
+        if ( info.nativeFormats & RTAUDIO_FLOAT32 )
+          std::cout << "  32-bit float\n";
+        if ( info.nativeFormats & RTAUDIO_FLOAT64 )
+          std::cout << "  64-bit float\n";
+      }
+      if ( info.sampleRates.size() < 1 )
+        std::cout << "No supported sample rates found!";
+      else {
+        std::cout << "Supported sample rates = ";
+        for (unsigned int j=0; j<info.sampleRates.size(); j++)
+          std::cout << info.sampleRates[j] << " ";
+      }
+      std::cout << std::endl;
+    }
+  }
+  std::cout << std::endl;
+
+  return 0;
+}
index 5e63cd7970c7f3e51c201bc7fdd68205468df901..f416bad993f268ad9fba52d8f1f5bcf5d266d8ea 100644 (file)
@@ -56,7 +56,7 @@ int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
   return 0;
 }
 
-int main(int argc, char *argv[])
+int main( int argc, char *argv[] )
 {
   unsigned int channels, fs, bufferBytes, oDevice = 0, iDevice = 0, iOffset = 0, oOffset = 0;
 
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
   RtAudio adac;
   if ( adac.getDeviceCount() < 1 ) {
     std::cout << "\nNo audio devices found!\n";
-    exit( 0 );
+    exit( 1 );
   }
 
   channels = (unsigned int) atoi(argv[1]);
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
   }
   catch ( RtError& e ) {
     std::cout << '\n' << e.getMessage() << '\n' << std::endl;
-    exit( 0 );
+    exit( 1 );
   }
 
   bufferBytes = bufferFrames * channels * sizeof( MY_TYPE );
index 3b70cdb869870787cb1269ea3f7240b78485e06c..a9e4db15acdd00197a7413fa146561c59b6feb2f 100644 (file)
@@ -58,7 +58,7 @@ void usage( void ) {
   std::cout << "    file = the raw file to play,\n";
   std::cout << "    device = optional device to use (default = 0),\n";
   std::cout << "    and channelOffset = an optional channel offset on the device (default = 0).\n\n";
-  exit(0);
+  exit( 0 );
 }
 
 struct OutputData {
@@ -106,13 +106,13 @@ int main( int argc, char *argv[] )
   if ( argc > 4 )
     device = (unsigned int) atoi( argv[4] );
   if ( argc > 5 )
-    offset = (unsigned int) atoi(argv[5]);
+    offset = (unsigned int) atoi( argv[5] );
 
   OutputData data;
   data.fd = fopen( file, "rb" );
   if ( !data.fd ) {
     std::cout << "Unable to find or open file!\n";
-    exit( 0 );
+    exit( 1 );
   }
 
   // Set our stream parameters for output only.
index cbe42036e62185c30b6da954c9ec6ba079891af0..772881c1657c63cc62fb73a2d69980f251ba99e7 100644 (file)
@@ -119,15 +119,15 @@ int main( int argc, char *argv[] )
   RtAudio dac;
   if ( dac.getDeviceCount() < 1 ) {
     std::cout << "\nNo audio devices found!\n";
-    exit( 0 );
+    exit( 1 );
   }
 
-  channels = (unsigned int) atoi(argv[1]);
-  fs = (unsigned int) atoi(argv[2]);
+  channels = (unsigned int) atoi( argv[1] );
+  fs = (unsigned int) atoi( argv[2] );
   if ( argc > 3 )
-    device = (unsigned int) atoi(argv[3]);
+    device = (unsigned int) atoi( argv[3] );
   if ( argc > 4 )
-    offset = (unsigned int) atoi(argv[4]);
+    offset = (unsigned int) atoi( argv[4] );
 
   double *data;
   data = (double *) calloc( channels, sizeof( double ) );
@@ -142,7 +142,6 @@ int main( int argc, char *argv[] )
   oParams.nChannels = channels;
   oParams.firstChannel = offset;
 
-
   options.flags |= RTAUDIO_HOG_DEVICE;
 #if !defined( USE_INTERLEAVED )
   options.flags |= RTAUDIO_NONINTERLEAVED;
diff --git a/tests/probe.cpp b/tests/probe.cpp
deleted file mode 100644 (file)
index e756346..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/******************************************/
-/*
-  probe.cpp
-  by Gary P. Scavone, 2001
-
-  Probe audio system and prints device info.
-*/
-/******************************************/
-
-#include "RtAudio.h"
-#include <iostream>
-#include <map>
-
-int main()
-{
-  // Create an api map.
-  std::map<int, std::string> apiMap;
-  apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio";
-  apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO";
-  apiMap[RtAudio::WINDOWS_DS] = "Windows Direct Sound";
-  apiMap[RtAudio::UNIX_JACK] = "Jack Client";
-  apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA";
-  apiMap[RtAudio::LINUX_OSS] = "Linux OSS";
-  apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy";
-
-  std::vector< RtAudio::Api > apis;
-  RtAudio :: getCompiledApi( apis );
-
-  std::cout << "\nCompiled APIs:\n";
-  for ( unsigned int i=0; i<apis.size(); i++ )
-    std::cout << "  " << apiMap[ apis[i] ] << std::endl;
-
-  RtAudio audio;
-  RtAudio::DeviceInfo info;
-
-  std::cout << "\nCurrent API: " << apiMap[ audio.getCurrentApi() ] << std::endl;
-
-  unsigned int devices = audio.getDeviceCount();
-  std::cout << "\nFound " << devices << " device(s) ...\n";
-
-  for (unsigned int i=0; i<devices; i++) {
-    info = audio.getDeviceInfo(i);
-
-    std::cout << "\nDevice Name = " << info.name << '\n';
-    if ( info.probed == false )
-      std::cout << "Probe Status = UNsuccessful\n";
-    else {
-      std::cout << "Probe Status = Successful\n";
-      std::cout << "Output Channels = " << info.outputChannels << '\n';
-      std::cout << "Input Channels = " << info.inputChannels << '\n';
-      std::cout << "Duplex Channels = " << info.duplexChannels << '\n';
-      if ( info.isDefaultOutput ) std::cout << "This is the default output device.\n";
-      else std::cout << "This is NOT the default output device.\n";
-      if ( info.isDefaultInput ) std::cout << "This is the default input device.\n";
-      else std::cout << "This is NOT the default input device.\n";
-      if ( info.nativeFormats == 0 )
-        std::cout << "No natively supported data formats(?)!";
-      else {
-        std::cout << "Natively supported data formats:\n";
-        if ( info.nativeFormats & RTAUDIO_SINT8 )
-          std::cout << "  8-bit int\n";
-        if ( info.nativeFormats & RTAUDIO_SINT16 )
-          std::cout << "  16-bit int\n";
-        if ( info.nativeFormats & RTAUDIO_SINT24 )
-          std::cout << "  24-bit int\n";
-        if ( info.nativeFormats & RTAUDIO_SINT32 )
-          std::cout << "  32-bit int\n";
-        if ( info.nativeFormats & RTAUDIO_FLOAT32 )
-          std::cout << "  32-bit float\n";
-        if ( info.nativeFormats & RTAUDIO_FLOAT64 )
-          std::cout << "  64-bit float\n";
-      }
-      if ( info.sampleRates.size() < 1 )
-        std::cout << "No supported sample rates found!";
-      else {
-        std::cout << "Supported sample rates = ";
-        for (unsigned int j=0; j<info.sampleRates.size(); j++)
-          std::cout << info.sampleRates[j] << " ";
-      }
-      std::cout << std::endl;
-    }
-  }
-  std::cout << std::endl;
-
-  return 0;
-}
index af14809c3885f417d49961b566860b8ba802c9a5..5efb0dd840468ba4d7584aaafc8ecee7a4c9a816 100644 (file)
@@ -98,15 +98,15 @@ int main( int argc, char *argv[] )
   RtAudio dac;
   if ( dac.getDeviceCount() < 1 ) {
     std::cout << "\nNo audio devices found!\n";
-    exit( 0 );
+    exit( 1 );
   }
 
-  channels = (unsigned int) atoi(argv[1]);
-  fs = (unsigned int) atoi(argv[2]);
+  channels = (unsigned int) atoi( argv[1] );
+  fs = (unsigned int) atoi( argv[2] );
   if ( argc > 3 )
-    device = (unsigned int) atoi(argv[3]);
+    device = (unsigned int) atoi( argv[3] );
   if ( argc > 4 )
-    offset = (unsigned int) atoi(argv[4]);
+    offset = (unsigned int) atoi( argv[4] );
 
   double *data;
   data = (double *) calloc( channels, sizeof( double ) );