A few small memory leak fixes from MK
[rtaudio.git] / tests / testall.cpp
index 1f3ea264939735080682284267f588f493305040..c8db735f59ce8be567bbb5fc5f104cb70571f659 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "RtAudio.h"
 #include <iostream>
+#include <cstdlib>
+#include <cstring>
 
 #define BASE_RATE 0.005
 #define TIME   1.0
@@ -84,7 +86,7 @@ int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
   // a simple buffer copy operation here.
   if ( status ) std::cout << "Stream over/underflow detected." << std::endl;
 
-  unsigned long *bytes = (unsigned long *) data;
+  unsigned int *bytes = (unsigned int *) data;
   memcpy( outputBuffer, inputBuffer, *bytes );
   return 0;
 }
@@ -120,7 +122,7 @@ int main( int argc, char *argv[] )
   dac.showWarnings( true );
 
   // Set our stream parameters for output only.
-  bufferFrames = 256;
+  bufferFrames = 512;
   RtAudio::StreamParameters oParams, iParams;
   oParams.deviceId = oDevice;
   oParams.nChannels = channels;
@@ -158,7 +160,7 @@ int main( int argc, char *argv[] )
     std::cout << "Playing again ... press <enter> to close the stream.\n";
     std::cin.get( input );
   }
-  catch ( RtError& e ) {
+  catch ( RtAudioError& e ) {
     e.printMessage();
     goto cleanup;
   }
@@ -178,7 +180,7 @@ int main( int argc, char *argv[] )
     std::cout << "\nPlaying ... press <enter> to stop.\n";
     std::cin.get( input );
   }
-  catch ( RtError& e ) {
+  catch ( RtAudioError& e ) {
     e.printMessage();
     goto cleanup;
   }
@@ -214,7 +216,7 @@ int main( int argc, char *argv[] )
     std::cout << "\nRunning ... press <enter> to stop.\n";
     std::cin.get( input );
   }
-  catch ( RtError& e ) {
+  catch ( RtAudioError& e ) {
     e.printMessage();
   }