// grains.cpp // // A simple test program for the STK Granulate class. #include "Granulate.h" #include "RtAudio.h" #include using namespace stk; // This tick() function handles sample computation only. It will be // called automatically when the system needs a new buffer of audio // samples. int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *dataPointer ) { Granulate *grani = (Granulate *) dataPointer; register StkFloat *samples = (StkFloat *) outputBuffer; const StkFrames& lastframe = grani->lastFrame(); unsigned int nChannels = lastframe.channels(); unsigned int j; for ( unsigned int i=0; itick(); for ( j=0; j to quit.\n"; std::cin.get( keyhit ); // Shut down the callback and output stream. try { dac.closeStream(); } catch ( RtAudioError &error ) { error.printMessage(); } cleanup: return 0; }