/******************************************/ /* playsaw.cpp by Gary P. Scavone, 2006-2019. This program will output sawtooth waveforms of different frequencies on each channel. */ /******************************************/ #include "RtAudio.h" #include #include #include /* typedef int8_t MY_TYPE; #define FORMAT RTAUDIO_SINT8 #define SCALE 127.0 */ typedef int16_t MY_TYPE; #define FORMAT RTAUDIO_SINT16 #define SCALE 32767.0 /* typedef S24 MY_TYPE; #define FORMAT RTAUDIO_SINT24 #define SCALE 8388607.0 typedef int32_t 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 */ // Platform-dependent sleep routines. #if defined( WIN32 ) #include #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) #else // Unix variants #include #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) ) #endif // Interrupt handler function bool done; static void finish( int /*ignore*/ ){ done = true; } #define BASE_RATE 0.005 #define TIME 1.0 void usage( void ) { // Error function in case of incorrect command-line // argument specifications std::cout << "\nuseage: playsaw N fs