Version 4.2.1

This commit is contained in:
Gary Scavone
2009-03-24 23:02:14 -04:00
committed by Stephen Sinclair
parent a6381b9d38
commit 2cbce2d8bd
275 changed files with 8949 additions and 6906 deletions

View File

@@ -1,45 +1,41 @@
// sineosc.cpp STK tutorial program
#include "WaveLoop.h"
#include "WvOut.h"
#include "FileWvOut.h"
int main()
{
// Set the global sample rate before creating class instances.
Stk::setSampleRate( 44100.0 );
WaveLoop *input = 0;
WvOut *output = 0;
WaveLoop input;
FileWvOut output;
try {
// Define and load the sine wave file
input = new WaveLoop( "rawwaves/sinewave.raw", true );
// Load the sine wave file.
input.openFile( "rawwaves/sinewave.raw", true );
// Define and open a 16-bit, one-channel WAV formatted output file
output = new WvOut( "hellosine.wav", 1, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
// Open a 16-bit, one-channel WAV formatted output file
output.openFile( "hellosine.wav", 1, FileWrite::FILE_WAV, Stk::STK_SINT16 );
}
catch ( StkError & ) {
goto cleanup;
exit(0);
}
input->setFrequency( 440.0 );
input.setFrequency( 440.0 );
// Run the oscillator for 40000 samples, writing to the output file
int i;
for ( i=0; i<40000; i++ ) {
try {
output->tick( input->tick() );
output.tick( input.tick() );
}
catch ( StkError & ) {
goto cleanup;
exit(0);
}
}
cleanup:
delete input;
delete output;
return 0;
}