summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStephen Sinclair <sinclair@music.mcgill.ca>2013-10-11 01:56:29 +0200
committerStephen Sinclair <sinclair@music.mcgill.ca>2013-10-11 01:56:29 +0200
commitacd5fefddbc6629095bcfae56edb87af8d40e4db (patch)
treed09a573bce0a46e95c2da8c4336ecbfb6e6f67fa /tests
parent504ebe4ba69765df5ca0da115690c29e52a44c6d (diff)
parent1022a7876a6ef1980ad5518340df177814783c7f (diff)
Merge 4.0.5 into releases
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.in13
-rw-r--r--tests/duplex.cpp2
-rw-r--r--tests/playraw.cpp6
-rw-r--r--tests/playsaw.cpp8
-rw-r--r--tests/record.cpp6
-rw-r--r--tests/testall.cpp32
6 files changed, 42 insertions, 25 deletions
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 059b5ce..4e93823 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -11,12 +11,10 @@ vpath %.o $(OBJECT_PATH)
OBJECTS = RtAudio.o @objects@
CC = @CXX@
-DEFS = @debug@
-DEFS += @audio_apis@
-CFLAGS = @CFLAGS@
-CFLAGS += @warn@ -I$(INCLUDE) -I../include
+DEFS = @CPPFLAGS@
+CFLAGS = @CXXFLAGS@
+CFLAGS += -I$(INCLUDE) -I../include
LIBRARY = @LIBS@
-LIBRARY += @frameworks@
%.o : $(SRC_PATH)/%.cpp
$(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@
@@ -44,11 +42,14 @@ duplex : duplex.cpp $(OBJECTS)
testall : testall.cpp $(OBJECTS)
$(CC) $(CFLAGS) $(DEFS) -o testall testall.cpp $(OBJECT_PATH)/*.o $(LIBRARY)
-
clean :
-rm $(OBJECT_PATH)/*.o
-rm $(PROGRAMS)
-rm -f *.raw *~ *.exe
+ -rm -fR *.dSYM
+
+distclean: clean
+ -rm Makefile
strip :
strip $(PROGRAMS)
diff --git a/tests/duplex.cpp b/tests/duplex.cpp
index f416bad..125b56e 100644
--- a/tests/duplex.cpp
+++ b/tests/duplex.cpp
@@ -10,6 +10,8 @@
#include "RtAudio.h"
#include <iostream>
+#include <cstdlib>
+#include <cstring>
/*
typedef signed long MY_TYPE;
diff --git a/tests/playraw.cpp b/tests/playraw.cpp
index a9e4db1..1ab1600 100644
--- a/tests/playraw.cpp
+++ b/tests/playraw.cpp
@@ -11,16 +11,20 @@
#include "RtAudio.h"
#include <iostream>
+#include <cstdlib>
+#include <cstring>
/*
typedef char MY_TYPE;
#define FORMAT RTAUDIO_SINT8
#define SCALE 127.0
+*/
typedef signed short MY_TYPE;
#define FORMAT RTAUDIO_SINT16
#define SCALE 32767.0
+/*
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT24
#define SCALE 8388607.0
@@ -28,13 +32,11 @@ typedef signed long MY_TYPE;
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT32
#define SCALE 2147483647.0
-*/
typedef float MY_TYPE;
#define FORMAT RTAUDIO_FLOAT32
#define SCALE 1.0;
-/*
typedef double MY_TYPE;
#define FORMAT RTAUDIO_FLOAT64
#define SCALE 1.0;
diff --git a/tests/playsaw.cpp b/tests/playsaw.cpp
index c39bcb4..b89d5f9 100644
--- a/tests/playsaw.cpp
+++ b/tests/playsaw.cpp
@@ -10,6 +10,7 @@
#include "RtAudio.h"
#include <iostream>
+#include <cstdlib>
/*
typedef signed long MY_TYPE;
@@ -19,21 +20,21 @@ typedef signed long MY_TYPE;
typedef char MY_TYPE;
#define FORMAT RTAUDIO_SINT8
#define SCALE 127.0
+*/
typedef signed short MY_TYPE;
#define FORMAT RTAUDIO_SINT16
#define SCALE 32767.0
+/*
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT32
#define SCALE 2147483647.0
-*/
typedef float MY_TYPE;
#define FORMAT RTAUDIO_FLOAT32
#define SCALE 1.0
-/*
typedef double MY_TYPE;
#define FORMAT RTAUDIO_FLOAT64
#define SCALE 1.0
@@ -142,6 +143,7 @@ int main( int argc, char *argv[] )
oParams.firstChannel = offset;
options.flags |= RTAUDIO_HOG_DEVICE;
+ options.flags |= RTAUDIO_SCHEDULE_REALTIME;
#if !defined( USE_INTERLEAVED )
options.flags |= RTAUDIO_NONINTERLEAVED;
#endif
@@ -155,12 +157,12 @@ int main( int argc, char *argv[] )
}
char input;
+ //std::cout << "Stream latency = " << dac.getStreamLatency() << "\n" << std::endl;
std::cout << "\nPlaying ... press <enter> to quit (buffer size = " << bufferFrames << ").\n";
std::cin.get( input );
try {
// Stop the stream
- std::cout << "Stream latency = " << dac.getStreamLatency() << "\n" << std::endl;
dac.stopStream();
}
catch ( RtError& e ) {
diff --git a/tests/record.cpp b/tests/record.cpp
index 7fb1317..a56f351 100644
--- a/tests/record.cpp
+++ b/tests/record.cpp
@@ -11,25 +11,27 @@
#include "RtAudio.h"
#include <iostream>
+#include <cstdlib>
+#include <cstring>
/*
typedef char MY_TYPE;
#define FORMAT RTAUDIO_SINT8
+*/
typedef signed short MY_TYPE;
#define FORMAT RTAUDIO_SINT16
+/*
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT24
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT32
-*/
typedef float MY_TYPE;
#define FORMAT RTAUDIO_FLOAT32
-/*
typedef double MY_TYPE;
#define FORMAT RTAUDIO_FLOAT64
*/
diff --git a/tests/testall.cpp b/tests/testall.cpp
index 2eeb330..bd9ca74 100644
--- a/tests/testall.cpp
+++ b/tests/testall.cpp
@@ -1,7 +1,7 @@
/******************************************/
/*
testall.cpp
- by Gary P. Scavone, 2007
+ by Gary P. Scavone, 2007-2008
This program will make a variety of calls
to extensively test RtAudio functionality.
@@ -10,6 +10,8 @@
#include "RtAudio.h"
#include <iostream>
+#include <cstdlib>
+#include <cstring>
#define BASE_RATE 0.005
#define TIME 1.0
@@ -17,11 +19,13 @@
void usage( void ) {
// Error function in case of incorrect command-line
// argument specifications
- std::cout << "\nuseage: testall N fs <device> <channelOffset>\n";
+ std::cout << "\nuseage: testall N fs <iDevice> <oDevice> <iChannelOffset> <oChannelOffset>\n";
std::cout << " where N = number of channels,\n";
std::cout << " fs = the sample rate,\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";
+ std::cout << " iDevice = optional input device to use (default = 0),\n";
+ std::cout << " oDevice = optional output device to use (default = 0),\n";
+ std::cout << " iChannelOffset = an optional input channel offset (default = 0),\n";
+ std::cout << " and oChannelOffset = optional output channel offset (default = 0).\n\n";
exit( 0 );
}
@@ -89,11 +93,11 @@ int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
int main( int argc, char *argv[] )
{
- unsigned int bufferFrames, fs, device = 0, offset = 0;
+ unsigned int bufferFrames, fs, oDevice = 0, iDevice = 0, iOffset = 0, oOffset = 0;
char input;
// minimal command-line checking
- if (argc < 3 || argc > 5 ) usage();
+ if (argc < 3 || argc > 7 ) usage();
RtAudio dac;
if ( dac.getDeviceCount() < 1 ) {
@@ -104,9 +108,13 @@ int main( int argc, char *argv[] )
channels = (unsigned int) atoi( argv[1] );
fs = (unsigned int) atoi( argv[2] );
if ( argc > 3 )
- device = (unsigned int) atoi( argv[3] );
+ iDevice = (unsigned int) atoi( argv[3] );
if ( argc > 4 )
- offset = (unsigned int) atoi( argv[4] );
+ oDevice = (unsigned int) atoi(argv[4]);
+ if ( argc > 5 )
+ iOffset = (unsigned int) atoi(argv[5]);
+ if ( argc > 6 )
+ oOffset = (unsigned int) atoi(argv[6]);
double *data = (double *) calloc( channels, sizeof( double ) );
@@ -116,9 +124,9 @@ int main( int argc, char *argv[] )
// Set our stream parameters for output only.
bufferFrames = 256;
RtAudio::StreamParameters oParams, iParams;
- oParams.deviceId = device;
+ oParams.deviceId = oDevice;
oParams.nChannels = channels;
- oParams.firstChannel = offset;
+ oParams.firstChannel = oOffset;
RtAudio::StreamOptions options;
options.flags = RTAUDIO_HOG_DEVICE;
@@ -181,9 +189,9 @@ int main( int argc, char *argv[] )
// Now open a duplex stream.
unsigned int bufferBytes;
- iParams.deviceId = device;
+ iParams.deviceId = iDevice;
iParams.nChannels = channels;
- iParams.firstChannel = offset;
+ iParams.firstChannel = iOffset;
options.flags = RTAUDIO_NONINTERLEAVED;
try {
dac.openStream( &oParams, &iParams, RTAUDIO_SINT32, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options );