mirror of
https://github.com/thestk/stk
synced 2026-04-20 06:26:55 +00:00
Version 4.3.0
This commit is contained in:
committed by
Stephen Sinclair
parent
2cbce2d8bd
commit
27d9b79dc7
@@ -34,7 +34,7 @@ main(int argc, char *argv[])
|
||||
int i;
|
||||
|
||||
// Minimal command-line checking.
|
||||
if (argc != 5) usage();
|
||||
if ( argc != 5 ) usage();
|
||||
|
||||
int channels = (int) atoi(argv[1]);
|
||||
double time = atof(argv[3]);
|
||||
@@ -43,18 +43,18 @@ main(int argc, char *argv[])
|
||||
// Create our object instances.
|
||||
FileWvOut output;
|
||||
SineWave **oscs = (SineWave **) malloc( channels * sizeof(SineWave *) );
|
||||
for (i=0; i<channels; i++) oscs[i] = 0;
|
||||
for ( i=0; i<channels; i++ ) oscs[i] = 0;
|
||||
|
||||
// If you want to change the default sample rate (set in Stk.h), do
|
||||
// it before instantiating any objects!!
|
||||
Stk::setSampleRate( srate );
|
||||
|
||||
// Define the sinewaves.
|
||||
for (i=0; i<channels; i++)
|
||||
for ( i=0; i<channels; i++ )
|
||||
oscs[i] = new SineWave;
|
||||
|
||||
// Set oscillator frequency(ies) here ... somewhat random.
|
||||
for (i=0; i<channels; i++)
|
||||
for ( i=0; i<channels; i++ )
|
||||
oscs[i]->setFrequency( base_freq + i*(45.0) );
|
||||
|
||||
long nFrames = (long) ( time * Stk::sampleRate() );
|
||||
@@ -67,12 +67,12 @@ main(int argc, char *argv[])
|
||||
try {
|
||||
output.openFile( argv[2], channels, FileWrite::FILE_WAV, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
catch ( StkError & ) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Here's the runtime code ... no loop
|
||||
for ( i=0; i<channels; i++)
|
||||
for ( i=0; i<channels; i++ )
|
||||
oscs[i]->tick( frames, i );
|
||||
|
||||
output.tickFrame( frames );
|
||||
@@ -80,7 +80,7 @@ main(int argc, char *argv[])
|
||||
cleanup:
|
||||
for ( i=0; i<channels; i++ )
|
||||
delete oscs[i];
|
||||
free(oscs);
|
||||
free( oscs );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user