Version 4.3.0

This commit is contained in:
Gary Scavone
2009-03-24 23:02:15 -04:00
committed by Stephen Sinclair
parent 2cbce2d8bd
commit 27d9b79dc7
271 changed files with 22219 additions and 8834 deletions

View File

@@ -155,11 +155,12 @@ void processMessage( TickData* data )
// The tick() function handles sample computation and scheduling of
// control updates. It will be called automatically by RtAudio when
// the system needs a new buffer of audio samples.
int tick(char *buffer, int bufferSize, void *dataPointer)
int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
double streamTime, RtAudioStreamStatus status, void *dataPointer )
{
TickData *data = (TickData *) dataPointer;
register StkFloat temp, outs[2], *samples = (StkFloat *) buffer;
int i, voiceNote, counter, nTicks = bufferSize;
register StkFloat temp, outs[2], *samples = (StkFloat *) outputBuffer;
int i, voiceNote, counter, nTicks = (int) nBufferFrames;
while ( nTicks > 0 && !done ) {
@@ -257,10 +258,10 @@ int tick(char *buffer, int bufferSize, void *dataPointer)
int main( int argc, char *argv[] )
{
TickData data;
RtAudio *dac = 0;
RtAudio dac;
int i;
if (argc < 2 || argc > 6) usage();
if ( argc < 2 || argc > 6 ) usage();
// If you want to change the default sample rate (set in Stk.h), do
// it before instantiating any objects! If the sample rate is
@@ -284,11 +285,14 @@ int main( int argc, char *argv[] )
// Allocate the dac here.
RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
int bufferSize = RT_BUFFER_SIZE;
RtAudio::StreamParameters parameters;
parameters.deviceId = dac.getDefaultOutputDevice();
parameters.nChannels = 2;
unsigned int bufferFrames = RT_BUFFER_SIZE;
try {
dac = new RtAudio(0, 2, 0, 0, format, (int)Stk::sampleRate(), &bufferSize, 4);
dac.openStream( &parameters, NULL, format, (unsigned int)Stk::sampleRate(), &bufferFrames, &tick, (void *)&data );
}
catch (RtError& error) {
catch ( RtError& error ) {
error.printMessage();
goto cleanup;
}
@@ -309,10 +313,9 @@ int main( int argc, char *argv[] )
// If realtime output, set our callback function and start the dac.
try {
dac->setStreamCallback( &tick, (void *)&data );
dac->startStream();
dac.startStream();
}
catch (RtError &error) {
catch ( RtError &error ) {
error.printMessage();
goto cleanup;
}
@@ -325,16 +328,14 @@ int main( int argc, char *argv[] )
// Shut down the output stream.
try {
dac->cancelStreamCallback();
dac->closeStream();
dac.closeStream();
}
catch (RtError& error) {
catch ( RtError& error ) {
error.printMessage();
}
cleanup:
delete dac;
return 0;
}