mirror of
https://github.com/thestk/stk
synced 2026-04-26 00:58:37 +00:00
Version 4.2.1
This commit is contained in:
committed by
Stephen Sinclair
parent
a6381b9d38
commit
2cbce2d8bd
@@ -1,14 +1,14 @@
|
||||
### STK demo Makefile - for various flavors of unix
|
||||
|
||||
PROGRAMS = demo
|
||||
PROGRAMS = demo Md2Skini
|
||||
RM = /bin/rm
|
||||
SRC_PATH = ../../src
|
||||
OBJECT_PATH = @object_path@
|
||||
vpath %.o $(OBJECT_PATH)
|
||||
|
||||
OBJECTS = Stk.o Generator.o Noise.o SubNoise.o Envelope.o ADSR.o \
|
||||
Modulate.o SingWave.o \
|
||||
WvIn.o WaveLoop.o WvOut.o \
|
||||
Modulate.o SingWave.o SineWave.o FileRead.o FileWrite.o \
|
||||
WvIn.o FileWvIn.o WaveLoop.o WvOut.o FileWvOut.o \
|
||||
Filter.o OneZero.o OnePole.o PoleZero.o TwoZero.o \
|
||||
BiQuad.o FormSwep.o Delay.o DelayL.o DelayA.o \
|
||||
Function.o ReedTable.o JetTable.o BowTable.o \
|
||||
@@ -39,7 +39,7 @@ LIBRARY += @frameworks@
|
||||
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o
|
||||
OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o
|
||||
DEFS += @audio_apis@
|
||||
endif
|
||||
|
||||
|
||||
@@ -23,10 +23,16 @@ void usage(void) {
|
||||
std::cout << " With flag = -f <filename>, the output stream is simultaneously\n";
|
||||
std::cout << " written to the file specified by the optional <filename>\n";
|
||||
std::cout << " (default = test.ski).\n";
|
||||
std::cout << " With flag = -c, MIDI control change messages will not be\n";
|
||||
std::cout << " converted to SKINI-specific named controls.\n";
|
||||
std::cout << " A MIDI input port can be specified with flag = -p portNumber.\n" << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#include <signal.h>
|
||||
static void finish( int ignore ){ std::cout << "Type 'Exit' to quit." << std::endl; }
|
||||
bool parseSkiniControl = true;
|
||||
|
||||
void midiCallback( double deltatime, std::vector< unsigned char > *bytes, void *userData )
|
||||
{
|
||||
if ( bytes->size() < 2 ) return;
|
||||
@@ -35,7 +41,7 @@ void midiCallback( double deltatime, std::vector< unsigned char > *bytes, void *
|
||||
if ( bytes->at(0) > 239 ) return;
|
||||
|
||||
register long type = bytes->at(0) & 0xF0;
|
||||
register long channel = bytes->at(0) & 0x0F;
|
||||
register int channel = bytes->at(0) & 0x0F;
|
||||
register long databyte1 = bytes->at(1);
|
||||
register long databyte2 = 0;
|
||||
if ( ( type != 0xC0 ) && ( type != 0xD0 ) ) {
|
||||
@@ -75,56 +81,63 @@ void midiCallback( double deltatime, std::vector< unsigned char > *bytes, void *
|
||||
|
||||
case __SK_ControlChange_:
|
||||
|
||||
if ( parseSkiniControl != true ) {
|
||||
typeName = "ControlChange\t";
|
||||
goto output;
|
||||
}
|
||||
|
||||
switch( databyte1 ) {
|
||||
case __SK_PitchChange_:
|
||||
typeName = "PitchChange\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Volume_:
|
||||
typeName = "Volume\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_ModWheel_:
|
||||
typeName = "ModWheel\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Breath_:
|
||||
typeName = "Breath\t\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_FootControl_:
|
||||
typeName = "FootControl\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Portamento_:
|
||||
typeName = "Portamento\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Balance_:
|
||||
typeName = "Balance\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Pan_:
|
||||
typeName = "Pan\t\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Sustain_:
|
||||
typeName = "Sustain\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
case __SK_Expression_:
|
||||
typeName = "Expression\t";
|
||||
break;
|
||||
goto output;
|
||||
|
||||
default:
|
||||
typeName = "ControlChange\t";
|
||||
break;
|
||||
goto output;
|
||||
}
|
||||
|
||||
default:
|
||||
typeName = "Unknown\t";
|
||||
typeName = "Unknown\t";
|
||||
}
|
||||
|
||||
output:
|
||||
|
||||
FILE *file = (FILE *) userData;
|
||||
if ( type == 0xC0 || type == 0xD0 || type == 0xE0 ) { // program change, channel pressure, or pitchbend
|
||||
fprintf( stdout, "%s %.3f %d %.1f\n", typeName.c_str(), 0.0, channel, (float)databyte1 );
|
||||
@@ -132,9 +145,16 @@ void midiCallback( double deltatime, std::vector< unsigned char > *bytes, void *
|
||||
fprintf( file, "%s %.3f %d %.1f\n", typeName.c_str(), deltatime, channel, (float)databyte1 );
|
||||
}
|
||||
else if ( type == 0xB0 ) { // control change
|
||||
if ( typeName == "ControlChange\t" ) {
|
||||
fprintf( stdout, "%s %.3f %d %.1f %.1f\n", typeName.c_str(), 0.0, channel, (float)databyte1, (float)databyte2 );
|
||||
if ( file != NULL )
|
||||
fprintf( file, "%s %.3f %d %.1f %.1f\n", typeName.c_str(), deltatime, channel, (float)databyte1, (float)databyte2 );
|
||||
}
|
||||
else {
|
||||
fprintf( stdout, "%s %.3f %d %.1f\n", typeName.c_str(), 0.0, channel, (float)databyte2 );
|
||||
if ( file != NULL )
|
||||
fprintf( file, "%s %.3f %d %.1f\n", typeName.c_str(), deltatime, channel, (float)databyte2 );
|
||||
}
|
||||
}
|
||||
else { // noteon, noteoff, aftertouch, and unknown
|
||||
fprintf( stdout, "%s %.3f %d %.1f %.1f\n", typeName.c_str(), 0.0, channel, (float)databyte1, (float)databyte2 );
|
||||
@@ -149,6 +169,7 @@ int main( int argc,char *argv[] )
|
||||
std::string fileName;
|
||||
RtMidiIn *midiin = 0;
|
||||
unsigned int port = 0;
|
||||
std::string input;
|
||||
|
||||
if ( argc > 5 ) usage();
|
||||
|
||||
@@ -172,6 +193,10 @@ int main( int argc,char *argv[] )
|
||||
if ( i++ >= argc) usage();
|
||||
port = (unsigned int) atoi( argv[i] );
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
parseSkiniControl = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage();
|
||||
@@ -219,9 +244,15 @@ int main( int argc,char *argv[] )
|
||||
// We'll ignore sysex, timing, and active sensing messages.
|
||||
midiin->ignoreTypes( true, true, true );
|
||||
|
||||
std::cout << "\nReading MIDI input ... press <enter> to quit.\n";
|
||||
char input;
|
||||
std::cin.get(input);
|
||||
// Install an interrupt handler function.
|
||||
(void) signal(SIGINT, finish);
|
||||
|
||||
std::cout << "\nReading MIDI input ... type 'Exit' to quit.\n";
|
||||
while ( input != "Exit" && input != "exit" ) {
|
||||
input.erase();
|
||||
std::cin >> input;
|
||||
std::cout << input << std::endl;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete midiin;
|
||||
|
||||
@@ -194,6 +194,10 @@ int main( int argc, char *argv[] )
|
||||
// specified in the command line, it will override this setting.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
// By default, warning messages are not printed. If we want to see
|
||||
// them, we need to specify that here.
|
||||
Stk::showWarnings( true );
|
||||
|
||||
// Check the command-line arguments for errors and to determine
|
||||
// the number of WvOut objects to be instantiated (in utilities.cpp).
|
||||
data.nWvOuts = checkArgs(argc, argv);
|
||||
@@ -276,12 +280,14 @@ int main( int argc, char *argv[] )
|
||||
|
||||
// Shut down the callback and output stream.
|
||||
#if defined(__STK_REALTIME__)
|
||||
try {
|
||||
dac->cancelStreamCallback();
|
||||
dac->closeStream();
|
||||
}
|
||||
catch (RtError& error) {
|
||||
error.printMessage();
|
||||
if ( data.realtime ) {
|
||||
try {
|
||||
dac->cancelStreamCallback();
|
||||
dac->closeStream();
|
||||
}
|
||||
catch (RtError& error) {
|
||||
error.printMessage();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -159,6 +159,22 @@ SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWrite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -323,6 +339,10 @@ SOURCE=..\..\src\Simple.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SingWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -355,6 +375,10 @@ SOURCE=..\..\src\SubNoise.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -479,6 +503,22 @@ SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWrite.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -643,6 +683,10 @@ SOURCE=..\..\include\Simple.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SineWave.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SingWave.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -675,6 +719,10 @@ SOURCE=..\..\include\SubNoise.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -659,7 +659,7 @@ proc patchChange {value} {
|
||||
.right.cont4 config -state normal -label "Stick Position"
|
||||
set preset [expr $value-2400]
|
||||
if {$preset == 1} {
|
||||
.right.cont11 config -state normal -label "Vibrato Gain"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
} else {
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ proc noteOff {pitchVal pressVal} {
|
||||
proc patchChange {value} {
|
||||
global outID preset
|
||||
if {$preset == 1} {
|
||||
.right.cont11 config -state normal -label "Vibrato Gain"
|
||||
.right.cont11 config -state normal -label "Vibrato Rate"
|
||||
} else {
|
||||
.right.cont11 config -state disabled -label "Disabled"
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ void usage(char *function) {
|
||||
printf(" -im <port> for realtime control input by MIDI (virtual port = 0, default = 1),\n");
|
||||
#endif
|
||||
printf(" and Instrument = one of these:\n");
|
||||
for (i=0;i<NUM_INSTS;i+=8) {
|
||||
for (j=0;j<8 && (i+j) < NUM_INSTS;j++) {
|
||||
for ( i=0; i<NUM_INSTS; i+=8 ) {
|
||||
for ( j=0; j<8 && (i+j)<NUM_INSTS; j++ ) {
|
||||
printf("%s ",insts[i+j]);
|
||||
}
|
||||
printf("\n");
|
||||
@@ -182,10 +182,10 @@ int checkArgs(int numArgs, char *args[])
|
||||
}
|
||||
|
||||
// Check for multiple flags of the same type
|
||||
for (i=0; i<=j; i++) {
|
||||
for ( i=0; i<=j; i++ ) {
|
||||
w = i+1;
|
||||
while (w <= j) {
|
||||
if (flags[0][i] == flags[0][w] && flags[1][i] == flags[1][w] ) {
|
||||
while (w <= j ) {
|
||||
if ( flags[0][i] == flags[0][w] && flags[1][i] == flags[1][w] ) {
|
||||
printf("\nError: Multiple command line flags of the same type specified.\n\n");
|
||||
usage(args[0]);
|
||||
}
|
||||
@@ -203,7 +203,7 @@ int countVoices(int nArgs, char *args[])
|
||||
{
|
||||
int i = 2, nInstruments = 1;
|
||||
|
||||
while (i < nArgs) {
|
||||
while ( i < nArgs ) {
|
||||
if ( strncmp( args[i], "-n", 2) == 0 ) {
|
||||
if ( i+1 < nArgs && args[i+1][0] != '-' ) {
|
||||
nInstruments = atoi( args[i+1] );
|
||||
@@ -218,7 +218,7 @@ int countVoices(int nArgs, char *args[])
|
||||
|
||||
bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
{
|
||||
int i = 2, j = 0;
|
||||
int i = 2, j = 0, nWvIns = 0;
|
||||
bool realtime = false;
|
||||
char fileName[256];
|
||||
|
||||
@@ -228,12 +228,14 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
|
||||
case 'f':
|
||||
strcpy(fileName,args[++i]);
|
||||
if ( !messager.setScoreFile( fileName ) ) usage(args[0]);
|
||||
if ( !messager.setScoreFile( fileName ) ) exit(0);
|
||||
nWvIns++;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
#if defined(__STK_REALTIME__)
|
||||
if ( !messager.startStdInput() ) usage(args[0]);
|
||||
if ( !messager.startStdInput() ) exit(0);
|
||||
nWvIns++;
|
||||
break;
|
||||
#else
|
||||
usage(args[0]);
|
||||
@@ -244,9 +246,10 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
// Check for an optional socket port argument.
|
||||
if ((i+1 < numArgs) && args[i+1][0] != '-') {
|
||||
int port = atoi(args[++i]);
|
||||
if ( !messager.startSocketInput( port ) ) usage(args[0]);
|
||||
if ( !messager.startSocketInput( port ) ) exit(0);
|
||||
}
|
||||
else if ( !messager.startSocketInput() ) usage(args[0]);
|
||||
else if ( !messager.startSocketInput() ) exit(0);
|
||||
nWvIns++;
|
||||
break;
|
||||
#else
|
||||
usage(args[0]);
|
||||
@@ -257,9 +260,10 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
// Check for an optional MIDI port argument.
|
||||
if ((i+1 < numArgs) && args[i+1][0] != '-') {
|
||||
int port = atoi(args[++i]);
|
||||
if ( !messager.startMidiInput( port-1 ) ) usage(args[0]);
|
||||
if ( !messager.startMidiInput( port-1 ) ) exit(0);
|
||||
}
|
||||
else if ( !messager.startMidiInput() ) usage(args[0]);
|
||||
else if ( !messager.startMidiInput() ) exit(0);
|
||||
nWvIns++;
|
||||
break;
|
||||
#else
|
||||
usage(args[0]);
|
||||
@@ -287,7 +291,7 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
strcpy(fileName,args[i]);
|
||||
}
|
||||
else strcpy(fileName,"testwav");
|
||||
output[j] = new WvOut(fileName, 1, WvOut::WVOUT_WAV );
|
||||
output[j] = new FileWvOut(fileName, 1, FileWrite::FILE_WAV );
|
||||
j++;
|
||||
break;
|
||||
|
||||
@@ -297,7 +301,7 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
strcpy(fileName,args[i]);
|
||||
}
|
||||
else strcpy(fileName,"testsnd");
|
||||
output[j] = new WvOut(fileName,1, WvOut::WVOUT_SND);
|
||||
output[j] = new FileWvOut(fileName,1, FileWrite::FILE_SND);
|
||||
j++;
|
||||
break;
|
||||
|
||||
@@ -307,7 +311,7 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
strcpy(fileName,args[i]);
|
||||
}
|
||||
else strcpy(fileName,"testmat");
|
||||
output[j] = new WvOut(fileName,1, WvOut::WVOUT_MAT);
|
||||
output[j] = new FileWvOut(fileName,1, FileWrite::FILE_MAT);
|
||||
j++;
|
||||
break;
|
||||
|
||||
@@ -317,7 +321,7 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
strcpy(fileName,args[i]);
|
||||
}
|
||||
else strcpy(fileName,"testaif");
|
||||
output[j] = new WvOut(fileName,1, WvOut::WVOUT_AIF );
|
||||
output[j] = new FileWvOut(fileName,1, FileWrite::FILE_AIF );
|
||||
j++;
|
||||
break;
|
||||
|
||||
@@ -329,5 +333,14 @@ bool parseArgs(int numArgs, char *args[], WvOut **output, Messager& messager)
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( nWvIns == 0 ) {
|
||||
#if defined(__STK_REALTIME__)
|
||||
if ( !messager.startStdInput() ) exit(0);
|
||||
#else
|
||||
printf("\nError: The -if file input flag must be specified for non-realtime use.\n\n");
|
||||
usage(args[0]);
|
||||
#endif
|
||||
}
|
||||
|
||||
return realtime;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Gary P. Scavone, 1999.
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include "WvOut.h"
|
||||
#include "FileWvOut.h"
|
||||
#include "Messager.h"
|
||||
|
||||
int voiceByNumber(int number, Instrmnt **instrument);
|
||||
|
||||
@@ -6,11 +6,11 @@ SRC_PATH = ../../src
|
||||
OBJECT_PATH = @object_path@
|
||||
vpath %.o $(OBJECT_PATH)
|
||||
|
||||
OBJECTS = Stk.o Generator.o Envelope.o \
|
||||
OBJECTS = Stk.o Generator.o Envelope.o SineWave.o \
|
||||
Filter.o Delay.o DelayL.o \
|
||||
Effect.o Echo.o PitShift.o Chorus.o \
|
||||
PRCRev.o JCRev.o NRev.o \
|
||||
WvIn.o WaveLoop.o Skini.o Messager.o
|
||||
FileRead.o WvIn.o FileWvIn.o WaveLoop.o Skini.o Messager.o
|
||||
|
||||
INCLUDE = @include@
|
||||
ifeq ($(strip $(INCLUDE)), )
|
||||
@@ -28,7 +28,7 @@ LIBRARY += @frameworks@
|
||||
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o
|
||||
OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o
|
||||
DEFS += @audio_apis@
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2002.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2005.
|
||||
|
||||
EFFECTS PROJECT:
|
||||
|
||||
This directory contains a program that demonstrates realtime duplex mode (simultaneous audio input and output) operation, as well as several simple delay-line based effects algorithms. Duplex mode operation is very hardware dependent. If you have trouble with this application, make sure your soundcard supports the desired sample rate and sample size (16-bit).
|
||||
This directory contains a program that demonstrates realtime duplex
|
||||
mode (simultaneous audio input and output) operation, as well as
|
||||
several simple delay-line based effects algorithms. Duplex mode
|
||||
operation is very hardware dependent. If you have trouble with this
|
||||
application, make sure your soundcard supports the desired sample rate
|
||||
and sample size (16-bit).
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This project will not run under WindowsNT or NeXTStep, due to lack of realtime audio input support. However, it should run under other flavors of Windows.
|
||||
1. This project will not run under WindowsNT or NeXTStep, due to lack
|
||||
of realtime audio input support. However, it should run under
|
||||
other flavors of Windows.
|
||||
|
||||
2. Audio input from either a microphone or line-input device MUST be available to the audio input port when the program is started.
|
||||
2. Audio input from either a microphone or line-input device MUST be
|
||||
available to the audio input port when the program is started.
|
||||
|
||||
3. Latency can be controlled using the RtDuplex bufferSize and nBuffers constructor arguments. The default settings in effects.cpp are relatively high because some Windows soundcard drivers crash if the settings are too low.
|
||||
3. Latency can be controlled using the RtDuplex bufferSize and
|
||||
nBuffers constructor arguments. The default settings in
|
||||
effects.cpp are relatively high because some Windows soundcard
|
||||
drivers crash if the settings are too low.
|
||||
|
||||
@@ -138,6 +138,22 @@ SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -218,6 +234,14 @@ SOURCE=..\..\include\RtMidi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SineWave.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SKINI.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -242,6 +266,14 @@ SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
### STK examples Makefile - for various flavors of unix
|
||||
|
||||
PROGRAMS = sine play record io tcpIn tcpOut sineosc rtsine crtsine bethree controlbee foursine threebees playsmf
|
||||
PROGRAMS = sine play record io inetIn inetOut sineosc rtsine crtsine bethree controlbee foursine threebees playsmf grains
|
||||
RM = /bin/rm
|
||||
SRC_PATH = ../../src
|
||||
OBJECT_PATH = @object_path@
|
||||
@@ -45,44 +45,47 @@ clean :
|
||||
strip :
|
||||
strip $(PROGRAMS)
|
||||
|
||||
play: play.cpp Stk.o WvIn.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o play play.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
play: play.cpp Stk.o FileRead.o WvIn.o FileWvIn.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o play play.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
record: record.cpp Stk.o WvIn.o WvOut.o RtWvIn.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o record record.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvIn.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
record: record.cpp Stk.o WvIn.o FileWrite.o WvOut.o FileWvOut.o RtWvIn.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o record record.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileWrite.o $(OBJECT_PATH)/FileWvOut.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvIn.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
sine: sine.cpp Stk.o WvIn.o WvOut.o WaveLoop.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sine sine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
sine: sine.cpp Stk.o Generator.o SineWave.o FileWrite.o WvOut.o FileWvOut.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sine sine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/FileWrite.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/FileWvOut.o $(LIBRARY)
|
||||
|
||||
io: io.cpp Stk.o RtAudio.o RtDuplex.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o io io.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/RtDuplex.o $(LIBRARY)
|
||||
|
||||
tcpIn: tcpIn.cpp Stk.o WvIn.o TcpWvIn.o WvOut.o RtWvOut.o RtAudio.o Socket.o Thread.o Mutex.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o tcpIn tcpIn.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/TcpWvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
inetIn: inetIn.cpp Stk.o WvIn.o InetWvIn.o WvOut.o RtWvOut.o RtAudio.o Socket.o TcpServer.o UdpSocket.o Thread.o Mutex.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o inetIn inetIn.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/InetWvIn.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/TcpServer.o $(OBJECT_PATH)/UdpSocket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
tcpOut: tcpOut.cpp Stk.o WvIn.o WvOut.o TcpWvOut.o Socket.o Thread.o Mutex.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o tcpOut tcpOut.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/TcpWvOut.o $(LIBRARY)
|
||||
inetOut: inetOut.cpp Stk.o FileRead.o WvIn.o FileWvIn.o WvOut.o InetWvOut.o Socket.o TcpClient.o UdpSocket.o Thread.o Mutex.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o inetOut inetOut.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/TcpClient.o $(OBJECT_PATH)/UdpSocket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/InetWvOut.o $(LIBRARY)
|
||||
|
||||
sineosc: sineosc.cpp Stk.o WvIn.o WvOut.o WaveLoop.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
sineosc: sineosc.cpp Stk.o FileRead.o WvIn.o FileWvIn.o WaveLoop.o FileWrite.o WvOut.o FileWvOut.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileWrite.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/FileWvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
|
||||
rtsine: rtsine.cpp Stk.o WvIn.o WaveLoop.o WvOut.o RtWvOut.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o rtsine rtsine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
rtsine: rtsine.cpp Stk.o Generator.o SineWave.o WvOut.o RtWvOut.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o rtsine rtsine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/RtWvOut.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
crtsine: crtsine.cpp Stk.o WvIn.o WaveLoop.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o crtsine crtsine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
crtsine: crtsine.cpp Stk.o Generator.o SineWave.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o crtsine crtsine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
bethree: bethree.cpp Stk.o WvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o Envelope.o ADSR.o BeeThree.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o bethree bethree.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(LIBRARY)
|
||||
bethree: bethree.cpp Stk.o WvIn.o FileRead.o FileWvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o SineWave.o Envelope.o ADSR.o BeeThree.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o bethree bethree.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(LIBRARY)
|
||||
|
||||
controlbee: controlbee.cpp Stk.o WvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o Thread.o Mutex.o Skini.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o controlbee controlbee.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/Skini.o $(LIBRARY)
|
||||
controlbee: controlbee.cpp Stk.o WvIn.o FileRead.o FileWvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o SineWave.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o TcpServer.o Thread.o Mutex.o Skini.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o controlbee controlbee.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/TcpServer.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/Skini.o $(LIBRARY)
|
||||
|
||||
foursine: foursine.cpp Stk.o WvIn.o WvOut.o WaveLoop.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o foursine foursine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/WaveLoop.o $(LIBRARY)
|
||||
foursine: foursine.cpp Stk.o Generator.o SineWave.o FileWrite.o WvOut.o FileWvOut.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o foursine foursine.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/FileWrite.o $(OBJECT_PATH)/WvOut.o $(OBJECT_PATH)/FileWvOut.o $(LIBRARY)
|
||||
|
||||
threebees: threebees.cpp Stk.o WvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o Thread.o Mutex.o Skini.o Voicer.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o threebees threebees.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/Skini.o $(OBJECT_PATH)/Voicer.o $(LIBRARY)
|
||||
threebees: threebees.cpp Stk.o FileRead.o WvIn.o FileWvIn.o WaveLoop.o FM.o RtAudio.o Instrmnt.o Filter.o TwoZero.o Generator.o SineWave.o Envelope.o ADSR.o BeeThree.o Messager.o RtMidi.o Socket.o TcpServer.o Thread.o Mutex.o Skini.o Voicer.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o threebees threebees.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/WvIn.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/FileWvIn.o $(OBJECT_PATH)/WaveLoop.o $(OBJECT_PATH)/FM.o $(OBJECT_PATH)/RtAudio.o $(OBJECT_PATH)/Instrmnt.o $(OBJECT_PATH)/Filter.o $(OBJECT_PATH)/TwoZero.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/SineWave.o $(OBJECT_PATH)/Envelope.o $(OBJECT_PATH)/ADSR.o $(OBJECT_PATH)/BeeThree.o $(OBJECT_PATH)/Messager.o $(OBJECT_PATH)/RtMidi.o $(OBJECT_PATH)/Socket.o $(OBJECT_PATH)/TcpServer.o $(OBJECT_PATH)/Thread.o $(OBJECT_PATH)/Mutex.o $(OBJECT_PATH)/Skini.o $(OBJECT_PATH)/Voicer.o $(LIBRARY)
|
||||
|
||||
playsmf: playsmf.cpp Stk.o MidiFileIn.o RtMidi.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o playsmf playsmf.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/MidiFileIn.o $(OBJECT_PATH)/RtMidi.o $(LIBRARY)
|
||||
|
||||
grains: grains.cpp Stk.o Generator.o Granulate.o Noise.o FileRead.o RtAudio.o
|
||||
$(CC) $(CFLAGS) $(DEFS) -o grains grains.cpp $(OBJECT_PATH)/Stk.o $(OBJECT_PATH)/Generator.o $(OBJECT_PATH)/Granulate.o $(OBJECT_PATH)/Noise.o $(OBJECT_PATH)/FileRead.o $(OBJECT_PATH)/RtAudio.o $(LIBRARY)
|
||||
|
||||
@@ -103,6 +103,14 @@ SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -127,6 +135,10 @@ SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -163,6 +175,14 @@ SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -183,6 +203,10 @@ SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\SineWave.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -104,6 +104,14 @@ SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -140,6 +148,10 @@ SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SKINI.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -152,6 +164,10 @@ SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -228,6 +244,10 @@ SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TwoZero.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
81
projects/examples/crtblit.cpp
Normal file
81
projects/examples/crtblit.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
// crtblit.cpp STK tutorial program
|
||||
|
||||
#include "Blit.h"
|
||||
#include "BlitSaw.h"
|
||||
#include "RtAudio.h"
|
||||
|
||||
unsigned long counter = 0;
|
||||
StkFloat frequency = 200.0;
|
||||
|
||||
// This tick() function handles sample computation only. It will be
|
||||
// called automatically when the system needs a new buffer of audio
|
||||
// samples.
|
||||
int tick(char *buffer, int bufferSize, void *dataPointer)
|
||||
{
|
||||
BlitSaw *blit = (BlitSaw *) dataPointer;
|
||||
register StkFloat *samples = (StkFloat *) buffer;
|
||||
|
||||
for ( int i=0; i<bufferSize; i++ ) {
|
||||
*samples++ = blit->tick();
|
||||
|
||||
if ( counter++ % 500 == 0 && frequency < 3000.0 ) {
|
||||
frequency *= 1.01;
|
||||
blit->setFrequency( frequency );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
Stk::showWarnings( true );
|
||||
|
||||
BlitSaw blit;
|
||||
RtAudio *dac = 0;
|
||||
|
||||
// Figure out how many bytes in an StkFloat and setup the RtAudio object.
|
||||
RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
|
||||
int bufferSize = RT_BUFFER_SIZE;
|
||||
try {
|
||||
dac = new RtAudio(0, 1, 0, 0, format, (int)Stk::sampleRate(), &bufferSize, 4);
|
||||
}
|
||||
catch (RtError& error) {
|
||||
error.printMessage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
blit.setFrequency( frequency );
|
||||
blit.setHarmonics( 20 );
|
||||
|
||||
try {
|
||||
dac->setStreamCallback(&tick, (void *)&blit);
|
||||
dac->startStream();
|
||||
}
|
||||
catch (RtError &error) {
|
||||
error.printMessage();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Block waiting here.
|
||||
char keyhit;
|
||||
std::cout << "\nPlaying ... press <enter> to quit.\n";
|
||||
std::cin.get(keyhit);
|
||||
|
||||
// Shut down the callback and output stream.
|
||||
try {
|
||||
dac->cancelStreamCallback();
|
||||
dac->closeStream();
|
||||
}
|
||||
catch (RtError &error) {
|
||||
error.printMessage();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
delete dac;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// crtsine.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "SineWave.h"
|
||||
#include "RtAudio.h"
|
||||
|
||||
// This tick() function handles sample computation only. It will be
|
||||
@@ -8,7 +8,7 @@
|
||||
// samples.
|
||||
int tick(char *buffer, int bufferSize, void *dataPointer)
|
||||
{
|
||||
WaveLoop *sine = (WaveLoop *) dataPointer;
|
||||
SineWave *sine = (SineWave *) dataPointer;
|
||||
register StkFloat *samples = (StkFloat *) buffer;
|
||||
|
||||
for ( int i=0; i<bufferSize; i++ )
|
||||
@@ -22,7 +22,7 @@ int main()
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *sine = 0;
|
||||
SineWave sine;
|
||||
RtAudio *dac = 0;
|
||||
|
||||
// Figure out how many bytes in an StkFloat and setup the RtAudio object.
|
||||
@@ -33,21 +33,13 @@ int main()
|
||||
}
|
||||
catch (RtError& error) {
|
||||
error.printMessage();
|
||||
goto cleanup;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sine.setFrequency(440.0);
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
sine = new WaveLoop( "rawwaves/sinewave.raw", true );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
sine->setFrequency(440.0);
|
||||
|
||||
try {
|
||||
dac->setStreamCallback(&tick, (void *)sine);
|
||||
dac->setStreamCallback(&tick, (void *)&sine);
|
||||
dac->startStream();
|
||||
}
|
||||
catch (RtError &error) {
|
||||
@@ -71,7 +63,6 @@ int main()
|
||||
|
||||
cleanup:
|
||||
|
||||
delete sine;
|
||||
delete dac;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "crtsine - Win32 Debug"
|
||||
@@ -65,15 +65,15 @@ LINK32=link.exe
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
@@ -91,10 +91,26 @@ SOURCE=.\crtsine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -51,6 +51,42 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "grains"=".\grains.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "inetIn"=".\inetIn.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "inetOut"=".\inetOut.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "io"=".\io.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@@ -75,6 +111,18 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "playsmf"=".\playsmf.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "record"=".\record.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
@@ -123,30 +171,6 @@ Package=<4>
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "tcpIn"=".\tcpIn.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "tcpOut"=".\tcpOut.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "threebees"=".\threebees.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
|
||||
@@ -1,54 +1,40 @@
|
||||
// foursine.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
#include "SineWave.h"
|
||||
#include "FileWvOut.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
int i, j;
|
||||
WvOut *output = 0;
|
||||
WaveLoop *inputs[4];
|
||||
for ( i=0; i<4; i++ ) inputs[i] = 0;
|
||||
int i;
|
||||
FileWvOut output;
|
||||
SineWave inputs[4];
|
||||
|
||||
// Define and load the sine waves
|
||||
try {
|
||||
for ( i=0; i<4; i++ ) {
|
||||
inputs[i] = new WaveLoop( "rawwaves/sinewave.raw", true );
|
||||
inputs[i]->setFrequency( 220.0 * (i+1) );
|
||||
}
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
// Set the sine wave frequencies.
|
||||
for ( i=0; i<4; i++ )
|
||||
inputs[i].setFrequency( 220.0 * (i+1) );
|
||||
|
||||
// Define and open a 16-bit, four-channel AIFF formatted output file
|
||||
try {
|
||||
output = new WvOut( "foursine.aif", 4, WvOut::WVOUT_AIF, Stk::STK_SINT16 );
|
||||
output.openFile( "foursine.aif", 4, FileWrite::FILE_AIF, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Write two seconds of four sines to the output file
|
||||
StkFloat frame[4];
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
for ( i=0; i<4; i++ )
|
||||
frame[i] = inputs[i]->tick();
|
||||
StkFrames frames( 88200, 4 );
|
||||
for ( i=0; i<4; i++ )
|
||||
inputs[i].tick( frames, i );
|
||||
|
||||
output->tickFrame( frame );
|
||||
}
|
||||
output.tickFrame( frames );
|
||||
|
||||
// Now write the first sine to all four channels for two seconds
|
||||
for ( j=0; j<88200; j++ ) {
|
||||
output->tick( inputs[0]->tick() );
|
||||
for ( i=0; i<88200; i++ ) {
|
||||
output.tick( inputs[0].tick() );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
for ( i=0; i<4; i++ ) delete inputs[i];
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,34 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWrite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\foursine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -109,6 +133,14 @@ SOURCE=..\..\src\WvOut.cpp
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWrite.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
105
projects/examples/grains.cpp
Normal file
105
projects/examples/grains.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
// grains.cpp
|
||||
//
|
||||
// A simple test program for the STK Granulate class.
|
||||
|
||||
#include "Granulate.h"
|
||||
#include "RtAudio.h"
|
||||
|
||||
// This tick() function handles sample computation only. It will be
|
||||
// called automatically when the system needs a new buffer of audio
|
||||
// samples.
|
||||
int tick(char *buffer, int bufferSize, void *dataPointer)
|
||||
{
|
||||
Granulate *grani = (Granulate *) dataPointer;
|
||||
register StkFloat *samples = (StkFloat *) buffer;
|
||||
|
||||
for ( int i=0; i<bufferSize; i++ )
|
||||
*samples++ = grani->tick();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
printf("\nuseage: grains file N dur ramp offset delay stretch ramdomness\n");
|
||||
printf(" where file = a soundfile to granulate,\n");
|
||||
printf(" N = the number of grain voices to use,\n");
|
||||
printf(" dur = the grain duration (ms),\n");
|
||||
printf(" ramp = the envelope percent (0-100),\n");
|
||||
printf(" offset = hop time between grains (ms),\n");
|
||||
printf(" delay = pause time between grains (ms),\n");
|
||||
printf(" stretch = stetch factor (1-1000),\n");
|
||||
printf(" and randomness = factor between 0 - 1.0 to control grain parameter randomness.\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
// Minimal command-line checking.
|
||||
if (argc != 9) usage();
|
||||
unsigned int N = (unsigned int) atoi(argv[2]);
|
||||
unsigned int duration = (unsigned int) atoi(argv[3]);
|
||||
unsigned int ramp = (unsigned int) atoi(argv[4]);
|
||||
unsigned int offset = (unsigned int) atoi(argv[5]);
|
||||
unsigned int delay = (unsigned int) atoi(argv[6]);
|
||||
unsigned int stretch = (unsigned int) atoi(argv[7]);
|
||||
StkFloat random = (StkFloat) atof(argv[8]);
|
||||
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
RtAudio *dac = 0;
|
||||
Granulate grani;
|
||||
grani.setRandomFactor( random );
|
||||
grani.setStretch( stretch );
|
||||
grani.setGrainParameters( duration, ramp, offset, delay );
|
||||
|
||||
try {
|
||||
grani.openFile( argv[1] );
|
||||
}
|
||||
catch ( StkError& ) {
|
||||
exit(0);
|
||||
}
|
||||
grani.setVoices( N );
|
||||
|
||||
// Figure out how many bytes in an StkFloat and setup the RtAudio object.
|
||||
RtAudioFormat format = ( sizeof(StkFloat) == 8 ) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
|
||||
int bufferSize = RT_BUFFER_SIZE;
|
||||
try {
|
||||
dac = new RtAudio(0, 1, 0, 0, format, (int)Stk::sampleRate(), &bufferSize, 4);
|
||||
}
|
||||
catch (RtError& error) {
|
||||
error.printMessage();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
try {
|
||||
dac->setStreamCallback(&tick, (void *)&grani);
|
||||
dac->startStream();
|
||||
}
|
||||
catch (RtError &error) {
|
||||
error.printMessage();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
// Block waiting here.
|
||||
char keyhit;
|
||||
std::cout << "\nPlaying ... press <enter> to quit.\n";
|
||||
std::cin.get(keyhit);
|
||||
|
||||
// Shut down the callback and output stream.
|
||||
try {
|
||||
dac->cancelStreamCallback();
|
||||
dac->closeStream();
|
||||
}
|
||||
catch (RtError &error) {
|
||||
error.printMessage();
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete dac;
|
||||
|
||||
return 0;
|
||||
}
|
||||
114
projects/examples/tcpOut.dsp → projects/examples/grains.dsp
Normal file → Executable file
114
projects/examples/tcpOut.dsp → projects/examples/grains.dsp
Normal file → Executable file
@@ -1,24 +1,24 @@
|
||||
# Microsoft Developer Studio Project File - Name="tcpOut" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Project File - Name="grains" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=tcpOut - Win32 Debug
|
||||
CFG=grains - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tcpOut.mak".
|
||||
!MESSAGE NMAKE /f "grains.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tcpOut.mak" CFG="tcpOut - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "grains.mak" CFG="grains - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "tcpOut - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "tcpOut - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "grains - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "grains - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
@@ -28,111 +28,119 @@ CFG=tcpOut - Win32 Debug
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "tcpOut - Win32 Release"
|
||||
!IF "$(CFG)" == "grains - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "tcpOut___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "tcpOut___Win32_Release"
|
||||
# PROP BASE Output_Dir "grains___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "grains___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "__WINDOWS_DS__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_MM__" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "tcpOut - Win32 Debug"
|
||||
!ELSEIF "$(CFG)" == "grains - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "tcpOut___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "tcpOut___Win32_Debug"
|
||||
# PROP BASE Output_Dir "grains___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "grains___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "__WINDOWS_DS__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_MM__" /YX /FD /GZ /c
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "tcpOut - Win32 Release"
|
||||
# Name "tcpOut - Win32 Debug"
|
||||
# Name "grains - Win32 Release"
|
||||
# Name "grains - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Socket.cpp
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\grains.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Granulate.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Noise.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tcpOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Socket.h
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Generator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Granulate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Noise.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
81
projects/examples/inetIn.cpp
Normal file
81
projects/examples/inetIn.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
/******************************************/
|
||||
/*
|
||||
Example program to read N channels of audio data that are streamed
|
||||
over a network connection.
|
||||
|
||||
by Gary P. Scavone, 2000
|
||||
|
||||
NOTE: This program makes use of blocking audio input/output
|
||||
routines. On systems where the underlying audio API is based on a
|
||||
callback scheme (Macintosh OS-X, Windows ASIO, and Linux JACK),
|
||||
these routines are not fully robust (over/underruns can happen with
|
||||
some frequency). See the STK tutorial for example programs using
|
||||
callback schemes and/or visit the RtAudio tutorial page
|
||||
(http://music.mcgill.ca/~gary/rtaudio/) for more information.
|
||||
|
||||
This program is currently written to play the input data in
|
||||
realtime. However, it is simple to replace the instance of RtWvOut
|
||||
with FileWvOut for writing to a soundfile.
|
||||
|
||||
The streamed data format is assumed to be signed 16-bit integers.
|
||||
However, both InetWvIn and InetWvOut can be initialized to
|
||||
read/write any of the defined StkFormats.
|
||||
|
||||
The class InetWvIn sets up a socket server and waits for a
|
||||
connection. Therefore, this program needs to be started before the
|
||||
streaming client. This program will terminate when the socket
|
||||
connection is closed.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "InetWvIn.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
printf("\nuseage: inetIn N fs \n");
|
||||
printf(" where N = number of channels,\n");
|
||||
printf(" and fs = the data sample rate.\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Minimal command-line checking.
|
||||
if (argc != 3) usage();
|
||||
|
||||
Stk::showWarnings( true );
|
||||
Stk::setSampleRate( atof(argv[2]) );
|
||||
int channels = (int) atoi(argv[1]);
|
||||
StkFrames frame( 1, channels );
|
||||
|
||||
// Create instances and pointers.
|
||||
InetWvIn input;
|
||||
RtWvOut *output = 0;
|
||||
|
||||
// Listen for a socket connection.
|
||||
try {
|
||||
//input.listen( 2006, channels, Stk::STK_SINT16, Socket::PROTO_UDP );
|
||||
input.listen( 2006, channels, Stk::STK_SINT16, Socket::PROTO_TCP );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Open the realtime output device.
|
||||
try {
|
||||
output = new RtWvOut( channels );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Here's the runtime loop.
|
||||
while ( input.isConnected() )
|
||||
output->tickFrame( input.tickFrame( frame ) );
|
||||
|
||||
cleanup:
|
||||
delete output;
|
||||
return 0;
|
||||
}
|
||||
78
projects/examples/tcpIn.dsp → projects/examples/inetIn.dsp
Normal file → Executable file
78
projects/examples/tcpIn.dsp → projects/examples/inetIn.dsp
Normal file → Executable file
@@ -1,24 +1,24 @@
|
||||
# Microsoft Developer Studio Project File - Name="tcpIn" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Project File - Name="inetIn" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=tcpIn - Win32 Debug
|
||||
CFG=inetIn - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tcpIn.mak".
|
||||
!MESSAGE NMAKE /f "inetIn.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "tcpIn.mak" CFG="tcpIn - Win32 Debug"
|
||||
!MESSAGE NMAKE /f "inetIn.mak" CFG="inetIn - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "tcpIn - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "tcpIn - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "inetIn - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "inetIn - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
@@ -28,65 +28,73 @@ CFG=tcpIn - Win32 Debug
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "tcpIn - Win32 Release"
|
||||
!IF "$(CFG)" == "inetIn - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Output_Dir "inetIn___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "inetIn___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "__WINDOWS_DS__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_MM__" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib WSock32.lib dsound.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib wsock32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "tcpIn - Win32 Debug"
|
||||
!ELSEIF "$(CFG)" == "inetIn - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "tcpIn___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "tcpIn___Win32_Debug"
|
||||
# PROP BASE Output_Dir "inetIn___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "inetIn___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "__WINDOWS_DS__" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_MM__" /YX /FD /GZ /c
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib WSock32.lib dsound.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib dsound.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "tcpIn - Win32 Release"
|
||||
# Name "tcpIn - Win32 Debug"
|
||||
# Name "inetIn - Win32 Release"
|
||||
# Name "inetIn - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\inetIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\InetWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Mutex.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -107,11 +115,7 @@ SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tcpIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpWvIn.cpp
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -119,6 +123,10 @@ SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\UdpSocket.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -131,6 +139,10 @@ SOURCE=..\..\src\WvOut.cpp
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\InetWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -139,19 +151,11 @@ SOURCE=..\..\include\RtWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Socket.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Thread.h
|
||||
SOURCE=..\..\include\UdpSocket.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
78
projects/examples/inetOut.cpp
Normal file
78
projects/examples/inetOut.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/******************************************/
|
||||
/*
|
||||
Example program to output N channels of audio
|
||||
data over a network socket connection.
|
||||
|
||||
by Gary P. Scavone, 2000
|
||||
|
||||
This program will load a specified WAV, SND, AIFF, STK RAW, or
|
||||
MAT-file formatted file. The output data format is set for signed
|
||||
16-bit integers. However, it is easy to change the InetWvOut
|
||||
setting to any of the other defined StkFormats. If using tcpIn, it
|
||||
will be necessary to change the expected data format there as well.
|
||||
|
||||
The class InetWvOut first attempts to establish a socket connection
|
||||
to a socket server running on port 2006. Therefore, this program
|
||||
needs to be started AFTER the streaming server.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "FileWvIn.h"
|
||||
#include "InetWvOut.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
printf("\nuseage: inetOut file host <rate>\n");
|
||||
printf(" where file = the file to load,\n");
|
||||
printf(" host = the hostname where the receiving\n");
|
||||
printf(" application is running.\n");
|
||||
printf(" and rate = an optional playback rate for the file.\n");
|
||||
printf(" (default = 1.0, can be negative)\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Minimal command-line checking.
|
||||
if (argc < 3 || argc > 4) usage();
|
||||
|
||||
FileWvIn input;
|
||||
InetWvOut output;
|
||||
|
||||
// Load the file.
|
||||
try {
|
||||
input.openFile( (char *)argv[1] );
|
||||
}
|
||||
catch (StkError &) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Set the global STK sample rate to the file rate.
|
||||
Stk::setSampleRate( input.getFileRate() );
|
||||
|
||||
// Set input read rate.
|
||||
double rate = 1.0;
|
||||
if ( argc == 4 ) rate = atof(argv[3]);
|
||||
input.setRate( rate );
|
||||
|
||||
// Find out how many channels we have.
|
||||
int channels = input.getChannels();
|
||||
StkFrames frames( 4096, channels );
|
||||
|
||||
// Attempt to connect to the socket server.
|
||||
try {
|
||||
//output.connect( 2006, Socket::PROTO_UDP, (char *)argv[2], channels, Stk::STK_SINT16 );
|
||||
output.connect( 2006, Socket::PROTO_TCP, (char *)argv[2], channels, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Here's the runtime loop
|
||||
while ( !input.isFinished() )
|
||||
output.tickFrame( input.tickFrame( frames ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
162
projects/examples/inetOut.dsp
Executable file
162
projects/examples/inetOut.dsp
Executable file
@@ -0,0 +1,162 @@
|
||||
# Microsoft Developer Studio Project File - Name="inetOut" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=inetOut - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "inetOut.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "inetOut.mak" CFG="inetOut - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "inetOut - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "inetOut - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "inetOut - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "inetOut___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "inetOut___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "inetOut - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "inetOut___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "inetOut___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_DS__" /D "__LITTLE_ENDIAN__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "inetOut - Win32 Release"
|
||||
# Name "inetOut - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\inetOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\InetWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Socket.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpClient.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\UdpSocket.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvOut.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\InetWvOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpClient.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WvOut.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,6 +1,6 @@
|
||||
### STK examples Makefile - for various flavors of unix
|
||||
|
||||
PROGRAMS = sine play record io tcpIn tcpOut sineosc rtsine crtsine bethree controlbee foursine threebees playsmf
|
||||
PROGRAMS = sine play record io inetIn inetOut sineosc rtsine crtsine bethree controlbee foursine threebees playsmf grains
|
||||
RM = /bin/rm
|
||||
|
||||
INCLUDE = @include@
|
||||
@@ -20,7 +20,6 @@ LIBRARY += @frameworks@
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
DEFS += @audio_apis@
|
||||
DEFS += @midiator@
|
||||
endif
|
||||
|
||||
RAWWAVES = @rawwaves@
|
||||
@@ -39,7 +38,6 @@ clean :
|
||||
strip :
|
||||
strip $(PROGRAMS)
|
||||
|
||||
#play: play.cpp Stk.o WvIn.o WvOut.o RtWvOut.o RtAudio.o
|
||||
play: play.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o play play.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
@@ -52,11 +50,11 @@ sine: sine.cpp
|
||||
io: io.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o io io.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
tcpIn: tcpIn.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o tcpIn tcpIn.cpp -L../../src $(LIBRARY) -lstk
|
||||
inetIn: inetIn.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o inetIn inetIn.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
tcpOut: tcpOut.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o tcpOut tcpOut.cpp -L../../src $(LIBRARY) -lstk
|
||||
inetOut: inetOut.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o inetOut inetOut.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
sineosc: sineosc.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o sineosc sineosc.cpp -L../../src $(LIBRARY) -lstk
|
||||
@@ -82,3 +80,6 @@ threebees: threebees.cpp
|
||||
playsmf: playsmf.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o playsmf playsmf.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
grains: grains.cpp
|
||||
$(CC) $(CFLAGS) $(DEFS) -o grains grains.cpp -L../../src $(LIBRARY) -lstk
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "WvIn.h"
|
||||
#include "FileWvIn.h"
|
||||
#include "RtAudio.h"
|
||||
|
||||
#include <signal.h>
|
||||
@@ -40,7 +40,7 @@ void usage(void) {
|
||||
// samples.
|
||||
int tick(char *buffer, int bufferSize, void *dataPointer)
|
||||
{
|
||||
WvIn *input = (WvIn *) dataPointer;
|
||||
FileWvIn *input = (FileWvIn *) dataPointer;
|
||||
register StkFloat *samples = (StkFloat *) buffer;
|
||||
|
||||
input->tickFrame( frames );
|
||||
@@ -65,11 +65,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Initialize our WvIn and RtAudio pointers.
|
||||
RtAudio *dac = 0;
|
||||
WvIn *input = 0;
|
||||
FileWvIn *input = 0;
|
||||
|
||||
// Try to load the soundfile.
|
||||
try {
|
||||
input = new WvIn( argv[1] );
|
||||
input = new FileWvIn( argv[1] );
|
||||
}
|
||||
catch (StkError &) {
|
||||
exit(0);
|
||||
|
||||
@@ -87,6 +87,14 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\play.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "MidiFileIn.h"
|
||||
#include "RtMidi.h"
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool done = false;
|
||||
static void finish(int ignore){ done = true; }
|
||||
|
||||
126
projects/examples/playsmf.dsp
Normal file
126
projects/examples/playsmf.dsp
Normal file
@@ -0,0 +1,126 @@
|
||||
# Microsoft Developer Studio Project File - Name="playsmf" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=playsmf - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "playsmf.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "playsmf.mak" CFG="playsmf - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "playsmf - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "playsmf - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "playsmf - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /D "__WINDOWS_MM__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "playsmf - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "playsmf___Win32_Debug"
|
||||
# PROP BASE Intermediate_Dir "playsmf___Win32_Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir ""
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__LITTLE_ENDIAN__" /D "__WINDOWS_DS__" /D "__WINDOWS_MM__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "playsmf - Win32 Release"
|
||||
# Name "playsmf - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\MidiFileIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\playsmf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtMidi.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\MidiFileIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtMidi.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -23,7 +23,7 @@
|
||||
/******************************************/
|
||||
|
||||
#include "RtWvIn.h"
|
||||
#include "WvOut.h"
|
||||
#include "FileWvOut.h"
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
@@ -41,17 +41,20 @@ int main(int argc, char *argv[])
|
||||
// minimal command-line checking
|
||||
if (argc != 5) usage();
|
||||
|
||||
Stk::showWarnings( true );
|
||||
|
||||
int channels = (int) atoi(argv[1]);
|
||||
double sample_rate = atof(argv[4]);
|
||||
double time = atof(argv[3]);
|
||||
long samples, i;
|
||||
StkFrames frame( 1, channels );
|
||||
|
||||
// Set the global sample rate.
|
||||
Stk::setSampleRate( sample_rate );
|
||||
|
||||
// Initialize our WvIn/WvOut pointers.
|
||||
RtWvIn *input = 0;
|
||||
WvOut *output = 0;
|
||||
FileWvOut *output = 0;
|
||||
|
||||
// Open the realtime input device
|
||||
try {
|
||||
@@ -63,7 +66,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Open the soundfile for output.
|
||||
try {
|
||||
output = new WvOut(argv[2], channels, WvOut::WVOUT_WAV);
|
||||
output = new FileWvOut(argv[2], channels, FileWrite::FILE_WAV);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
@@ -71,8 +74,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Here's the runtime loop
|
||||
samples = (long) (time * Stk::sampleRate());
|
||||
for ( i=0; i<samples; i++ )
|
||||
output->tickFrame( input->tickFrame() );
|
||||
for ( i=0; i<samples; i++ ) {
|
||||
output->tickFrame( input->tickFrame( frame ) );
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
|
||||
@@ -89,6 +89,14 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWrite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\record.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// rtsine.cpp STK tutorial program
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "SineWave.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
int main()
|
||||
@@ -8,27 +8,24 @@ int main()
|
||||
// Set the global sample rate before creating class instances.
|
||||
Stk::setSampleRate( 44100.0 );
|
||||
|
||||
WaveLoop *sine = 0;
|
||||
SineWave sine;
|
||||
RtWvOut *dac = 0;
|
||||
|
||||
try {
|
||||
// Define and load the sine wave file
|
||||
sine = new WaveLoop( "rawwaves/sinewave.raw", true );
|
||||
|
||||
// Define and open the default realtime output device for one-channel playback
|
||||
dac = new RtWvOut(1);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sine->setFrequency(440.0);
|
||||
sine.setFrequency(440.0);
|
||||
|
||||
// Play the oscillator for 40000 samples
|
||||
int i;
|
||||
for ( i=0; i<40000; i++ ) {
|
||||
try {
|
||||
dac->tick( sine->tick() );
|
||||
dac->tick( sine.tick() );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
@@ -36,7 +33,6 @@ int main()
|
||||
}
|
||||
|
||||
cleanup:
|
||||
delete sine;
|
||||
delete dac;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -87,6 +87,18 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\RtAudio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -99,6 +111,10 @@ SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -119,6 +135,14 @@ SOURCE=..\..\src\WvOut.cpp
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\RtAudio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
By default, the program will write an
|
||||
N channel WAV file. However, it is
|
||||
simple to change the file type argument
|
||||
in the WvOut constructor.
|
||||
in the FileWvOut constructor.
|
||||
|
||||
By Gary P. Scavone, 2000 - 2002.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "WaveLoop.h"
|
||||
#include "WvOut.h"
|
||||
#include "SineWave.h"
|
||||
#include "FileWvOut.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void usage(void) {
|
||||
@@ -31,7 +31,6 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
float base_freq = 220.0;
|
||||
int samples;
|
||||
int i;
|
||||
|
||||
// Minimal command-line checking.
|
||||
@@ -41,55 +40,47 @@ main(int argc, char *argv[])
|
||||
double time = atof(argv[3]);
|
||||
double srate = atof(argv[4]);
|
||||
|
||||
// Initialize our object and data pointers.
|
||||
WvOut *output = 0;
|
||||
StkFloat *vector = 0;
|
||||
WaveLoop **oscs = (WaveLoop **) malloc( channels * sizeof(WaveLoop *) );
|
||||
// Create our object instances.
|
||||
FileWvOut output;
|
||||
SineWave **oscs = (SineWave **) malloc( channels * sizeof(SineWave *) );
|
||||
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 and load the rawwave file(s) ... the path is critical.
|
||||
try {
|
||||
for (i=0; i<channels; i++)
|
||||
oscs[i] = new WaveLoop( "../../rawwaves/sinewave.raw", true );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
// Define the sinewaves.
|
||||
for (i=0; i<channels; i++)
|
||||
oscs[i] = new SineWave;
|
||||
|
||||
// Set oscillator frequency(ies) here ... somewhat random.
|
||||
for (i=0; i<channels; i++)
|
||||
oscs[i]->setFrequency( base_freq + i*(45.0) );
|
||||
|
||||
// Define and open the soundfile for output. Other file
|
||||
// format options include: WVOUT_SND, WVOUT_AIF, WVOUT_MAT,
|
||||
// and WVOUT_RAW. Other data type options include:
|
||||
// STK_SINT8, STK_SINT32, StkFloat32, and StkFloat64.
|
||||
long nFrames = (long) ( time * Stk::sampleRate() );
|
||||
StkFrames frames( nFrames, channels );
|
||||
|
||||
// Open the soundfile for output. Other file format options
|
||||
// include: FILE_SND, FILE_AIF, FILE_MAT, and FILE_RAW. Other data
|
||||
// type options include: STK_SINT8, STK_SINT32, StkFloat32, and
|
||||
// StkFloat64.
|
||||
try {
|
||||
output = new WvOut( argv[2], channels, WvOut::WVOUT_WAV, Stk::STK_SINT16 );
|
||||
output.openFile( argv[2], channels, FileWrite::FILE_WAV, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Here's the runtime loop
|
||||
samples = (int) ( time * Stk::sampleRate() );
|
||||
vector = (StkFloat *) new StkFloat[channels];
|
||||
for ( i=0; i<samples; i++ ) {
|
||||
for (int j=0; j<channels; j++) {
|
||||
vector[j] = oscs[j]->tick();
|
||||
}
|
||||
output->tickFrame(vector);
|
||||
}
|
||||
// Here's the runtime code ... no loop
|
||||
for ( i=0; i<channels; i++)
|
||||
oscs[i]->tick( frames, i );
|
||||
|
||||
output.tickFrame( frames );
|
||||
|
||||
cleanup:
|
||||
for (i=0; i<channels; i++)
|
||||
for ( i=0; i<channels; i++ )
|
||||
delete oscs[i];
|
||||
free(oscs);
|
||||
delete [] vector;
|
||||
delete output;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -87,10 +87,34 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWrite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sine.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source 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;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,26 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWrite.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sineosc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -110,6 +130,10 @@ SOURCE=..\..\src\WvOut.cpp
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Generator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Stk.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
/******************************************/
|
||||
/*
|
||||
Example program to read N channels of audio
|
||||
data that are streamed over a TCP network
|
||||
connection.
|
||||
|
||||
by Gary P. Scavone, 2000
|
||||
|
||||
NOTE: This program makes use of blocking audio
|
||||
input/output routines. On systems where the
|
||||
underlying audio API is based on a callback scheme
|
||||
(Macintosh OS-X, Windows ASIO, and Linux JACK), these
|
||||
routines are not fully robust (over/underruns can
|
||||
happen with some frequency). See the STK tutorial
|
||||
for example programs using callback schemes and/or
|
||||
visit the RtAudio tutorial page
|
||||
(http://music.mcgill.ca/~gary/rtaudio/) for more
|
||||
information.
|
||||
|
||||
This program is currently written to play
|
||||
the input data in realtime. However, it
|
||||
is simple to replace the instance of
|
||||
RtWvOut with WvOut for writing to a
|
||||
soundfile.
|
||||
|
||||
The streamed data format is assumed to be
|
||||
signed 16-bit integers. However, both
|
||||
TcpWvIn and TcpWvOut can be initialized
|
||||
to read/write any of the defined StkFormats.
|
||||
|
||||
The class TcpWvIn sets up a socket server
|
||||
and waits for a connection. Therefore,
|
||||
this program needs to be started before
|
||||
the streaming client. This program will
|
||||
terminate when the socket connection is
|
||||
closed.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "TcpWvIn.h"
|
||||
#include "RtWvOut.h"
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
printf("\nuseage: tcpIn N fs \n");
|
||||
printf(" where N = number of channels,\n");
|
||||
printf(" and fs = the data sample rate.\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Minimal command-line checking.
|
||||
if (argc != 3) usage();
|
||||
|
||||
Stk::setSampleRate( atof(argv[2]) );
|
||||
int channels = (int) atoi(argv[1]);
|
||||
|
||||
// Initialize the object pointers.
|
||||
RtWvOut *output = 0;
|
||||
TcpWvIn *input = 0;
|
||||
|
||||
// Instantiate the TcpWvIn object.
|
||||
try {
|
||||
input = new TcpWvIn();
|
||||
input->listen( channels, Stk::STK_SINT16 );
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Open the realtime output device.
|
||||
try {
|
||||
output = new RtWvOut(channels);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Here's the runtime loop.
|
||||
while ( input->isConnected() )
|
||||
output->tickFrame( input->tickFrame() );
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/******************************************/
|
||||
/*
|
||||
Example program to output N channels of audio
|
||||
data over a TCP network socket connection.
|
||||
|
||||
by Gary P. Scavone, 2000
|
||||
|
||||
This program will load a specified WAV,
|
||||
SND, AIFF, STK RAW, or MAT-file formatted
|
||||
file. The output data format is set for
|
||||
signed 16-bit integers. However, it is
|
||||
easy to change the TcpWvOut setting to
|
||||
any of the other defined StkFormats.
|
||||
If using tcpIn, it will be necessary to
|
||||
change the expected data format there
|
||||
as well.
|
||||
|
||||
The class StrmWvOut first attempts to
|
||||
establish a socket connection to a socket
|
||||
server running on port 2006. Therefore,
|
||||
this program needs to be started AFTER the
|
||||
streaming server.
|
||||
*/
|
||||
/******************************************/
|
||||
|
||||
#include "WvIn.h"
|
||||
#include "TcpWvOut.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line
|
||||
// argument specifications.
|
||||
printf("\nuseage: tcpOut file host <rate>\n");
|
||||
printf(" where file = the file to load,\n");
|
||||
printf(" host = the hostname where the receiving\n");
|
||||
printf(" application is running.\n");
|
||||
printf(" and rate = an optional playback rate for the file.\n");
|
||||
printf(" (default = 1.0, can be negative)\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Minimal command-line checking.
|
||||
if (argc < 3 || argc > 4) usage();
|
||||
|
||||
// Initialize the object pointers.
|
||||
TcpWvOut *output = 0;
|
||||
WvIn *input = 0;
|
||||
|
||||
// Load the file.
|
||||
try {
|
||||
input = new WvIn( (char *)argv[1] );
|
||||
}
|
||||
catch (StkError &) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Set the global STK sample rate to the file rate.
|
||||
Stk::setSampleRate( input->getFileRate() );
|
||||
|
||||
// Set input read rate.
|
||||
double rate = 1.0;
|
||||
if ( argc == 4 ) rate = atof(argv[3]);
|
||||
input->setRate( rate );
|
||||
|
||||
// Find out how many channels we have.
|
||||
int channels = input->getChannels();
|
||||
|
||||
// Define and open the output device
|
||||
try {
|
||||
output = new TcpWvOut(2006, (char *)argv[2], channels, Stk::STK_SINT16);
|
||||
}
|
||||
catch (StkError &) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// Here's the runtime loop
|
||||
while ( !input->isFinished() )
|
||||
output->tickFrame( input->tickFrame() );
|
||||
|
||||
cleanup:
|
||||
delete input;
|
||||
delete output;
|
||||
return 0;
|
||||
}
|
||||
@@ -99,6 +99,14 @@ SOURCE=..\..\src\Envelope.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -135,6 +143,10 @@ SOURCE=..\..\src\RtWvOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SineWave.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\SKINI.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -147,6 +159,10 @@ SOURCE=..\..\src\Stk.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -13,13 +13,13 @@
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Drone.h"
|
||||
|
||||
Drone :: Drone(StkFloat lowestFrequency)
|
||||
Drone :: Drone( StkFloat lowestFrequency )
|
||||
{
|
||||
length_ = (unsigned long) (Stk::sampleRate() / lowestFrequency + 1);
|
||||
loopGain_ = 0.999;
|
||||
@@ -39,7 +39,7 @@ void Drone :: clear()
|
||||
loopFilter_.clear();
|
||||
}
|
||||
|
||||
void Drone :: setFrequency(StkFloat frequency)
|
||||
void Drone :: setFrequency( StkFloat frequency )
|
||||
{
|
||||
StkFloat freakency = frequency;
|
||||
if ( frequency <= 0.0 ) {
|
||||
@@ -59,12 +59,12 @@ void Drone :: setFrequency(StkFloat frequency)
|
||||
if ( loopGain_ >= 1.0 ) loopGain_ = 0.99999;
|
||||
}
|
||||
|
||||
void Drone :: pluck(StkFloat amplitude)
|
||||
void Drone :: pluck( StkFloat amplitude )
|
||||
{
|
||||
envelope_.keyOn();
|
||||
}
|
||||
|
||||
void Drone :: noteOn(StkFloat frequency, StkFloat amplitude)
|
||||
void Drone :: noteOn( StkFloat frequency, StkFloat amplitude )
|
||||
{
|
||||
this->setFrequency( frequency );
|
||||
this->pluck( amplitude );
|
||||
@@ -75,7 +75,7 @@ void Drone :: noteOn(StkFloat frequency, StkFloat amplitude)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Drone :: noteOff(StkFloat amplitude)
|
||||
void Drone :: noteOff( StkFloat amplitude )
|
||||
{
|
||||
loopGain_ = 1.0 - amplitude;
|
||||
if ( loopGain_ < 0.0 ) {
|
||||
@@ -95,19 +95,11 @@ void Drone :: noteOff(StkFloat amplitude)
|
||||
#endif
|
||||
}
|
||||
|
||||
StkFloat Drone :: tick()
|
||||
StkFloat Drone :: computeSample()
|
||||
{
|
||||
// Here's the whole inner loop of the instrument!!
|
||||
lastOutput_ = delayLine_.tick( loopFilter_.tick( delayLine_.lastOut() * loopGain_ ) + (0.005 * envelope_.tick() * noise_.tick()));
|
||||
lastOutput_ = delayLine_.tick( loopFilter_.tick( delayLine_.lastOut() * loopGain_ )
|
||||
+ (0.005 * envelope_.tick() * noise_.tick()));
|
||||
return lastOutput_;
|
||||
}
|
||||
|
||||
StkFloat *Drone :: tick(StkFloat *vector, unsigned int vectorSize)
|
||||
{
|
||||
return Instrmnt::tick( vector, vectorSize );
|
||||
}
|
||||
|
||||
StkFrames& Drone :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return Instrmnt::tick( frames, channel );
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Stanford, bearing the names of Karplus and/or
|
||||
Strong.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -50,22 +50,10 @@ class Drone : public Instrmnt
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
virtual void noteOff(StkFloat amplitude);
|
||||
|
||||
//! Compute one output sample.
|
||||
virtual StkFloat tick();
|
||||
protected:
|
||||
|
||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
||||
virtual StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
||||
StkFloat computeSample( void );
|
||||
|
||||
//! Fill a channel of the StkFrames object with computed outputs.
|
||||
/*!
|
||||
The \c channel argument should be one or greater (the first
|
||||
channel is specified by 1). An StkError will be thrown if the \c
|
||||
channel argument is zero or it is greater than the number of
|
||||
channels in the StkFrames object.
|
||||
*/
|
||||
virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
||||
|
||||
protected:
|
||||
DelayA delayLine_;
|
||||
OneZero loopFilter_;
|
||||
ADSR envelope_;
|
||||
|
||||
@@ -10,7 +10,7 @@ OBJECTS = Stk.o Generator.o Noise.o Envelope.o ADSR.o \
|
||||
Filter.o DelayA.o Delay.o \
|
||||
OnePole.o OneZero.o Skini.o \
|
||||
Tabla.o Instrmnt.o Sitar.o \
|
||||
Drone.o VoicDrum.o WvOut.o WvIn.o \
|
||||
Drone.o VoicDrum.o FileRead.o WvOut.o WvIn.o FileWvIn.o \
|
||||
Effect.o JCRev.o Messager.o
|
||||
|
||||
INCLUDE = @include@
|
||||
@@ -29,7 +29,7 @@ LIBRARY += @frameworks@
|
||||
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Mutex.o Socket.o
|
||||
OBJECTS += RtMidi.o RtAudio.o RtWvOut.o Thread.o Mutex.o Socket.o TcpServer.o
|
||||
DEFS += @audio_apis@
|
||||
endif
|
||||
|
||||
|
||||
@@ -2,39 +2,49 @@
|
||||
/*! \class Tabla
|
||||
\brief STK tabla drum class.
|
||||
|
||||
This class implements a drum sampling
|
||||
synthesizer using WvIn objects and one-pole
|
||||
filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately
|
||||
interpolated for other sample rates. You can
|
||||
specify the maximum polyphony (maximum number
|
||||
of simultaneous voices) in Drummer.h.
|
||||
This class implements a drum sampling synthesizer using FileWvIn
|
||||
objects and one-pole filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately interpolated for other
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in Tabla.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Tabla.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
Tabla :: Tabla() : Instrmnt()
|
||||
{
|
||||
for ( int i=0; i<TABLA_POLYPHONY; i++ ) {
|
||||
filters_[i] = new OnePole;
|
||||
sounding_[i] = -1;
|
||||
}
|
||||
|
||||
// This counts the number of sounding voices.
|
||||
nSounding_ = 0;
|
||||
soundOrder_ = std::vector<int> (TABLA_POLYPHONY, -1);
|
||||
soundNumber_ = std::vector<int> (TABLA_POLYPHONY, -1);
|
||||
}
|
||||
|
||||
Tabla :: ~Tabla()
|
||||
{
|
||||
int i;
|
||||
for ( i=0; i<nSounding_; i++ ) delete waves_[i];
|
||||
for ( i=0; i<TABLA_POLYPHONY; i++ ) delete filters_[i];
|
||||
}
|
||||
|
||||
static char tablaWaves[TABLA_NUMWAVES][16] =
|
||||
{ "Drdak2.raw",
|
||||
"Drdak3.raw",
|
||||
"Drdak4.raw",
|
||||
"Drddak1.raw",
|
||||
"Drdee1.raw",
|
||||
"Drdee2.raw",
|
||||
"Drdoo1.raw",
|
||||
"Drdoo2.raw",
|
||||
"Drdoo3.raw",
|
||||
"Drjun1.raw",
|
||||
"Drjun2.raw",
|
||||
"DrDoi1.raw",
|
||||
"DrDoi2.raw",
|
||||
"DrTak1.raw",
|
||||
"DrTak2.raw"
|
||||
};
|
||||
|
||||
void Tabla :: noteOn(StkFloat instrument, StkFloat amplitude)
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
@@ -54,68 +64,54 @@ void Tabla :: noteOn(StkFloat instrument, StkFloat amplitude)
|
||||
return;
|
||||
}
|
||||
|
||||
static char tablaWaves[TABLA_NUMWAVES][16] =
|
||||
{ "Drdak2.raw",
|
||||
"Drdak3.raw",
|
||||
"Drdak4.raw",
|
||||
"Drddak1.raw",
|
||||
"Drdee1.raw",
|
||||
"Drdee2.raw",
|
||||
"Drdoo1.raw",
|
||||
"Drdoo2.raw",
|
||||
"Drdoo3.raw",
|
||||
"Drjun1.raw",
|
||||
"Drjun2.raw",
|
||||
"DrDoi1.raw",
|
||||
"DrDoi2.raw",
|
||||
"DrTak1.raw",
|
||||
"DrTak2.raw"
|
||||
};
|
||||
int noteNumber = ( (int) instrument ) % 16;
|
||||
|
||||
int noteNum = ( (int) instrument ) % 16;
|
||||
|
||||
// Check first to see if there's already one like this sounding.
|
||||
int i, waveIndex = -1;
|
||||
for ( i=0; i<TABLA_POLYPHONY; i++ ) {
|
||||
if ( sounding_[i] == noteNum ) waveIndex = i;
|
||||
}
|
||||
|
||||
if ( waveIndex >= 0 ) {
|
||||
// Reset this sound.
|
||||
waves_[waveIndex]->reset();
|
||||
filters_[waveIndex]->setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[waveIndex]->setGain( gain );
|
||||
}
|
||||
else {
|
||||
if ( nSounding_ == TABLA_POLYPHONY ) {
|
||||
// If we're already at maximum polyphony, then preempt the oldest voice.
|
||||
delete waves_[0];
|
||||
filters_[0]->clear();
|
||||
OnePole *tempFilt = filters_[0];
|
||||
// Re-order the list.
|
||||
for ( i=0; i<TABLA_POLYPHONY-1; i++ ) {
|
||||
waves_[i] = waves_[i+1];
|
||||
filters_[i] = filters_[i+1];
|
||||
// If we already have a wave of this note number loaded, just reset
|
||||
// it. Otherwise, look first for an unused wave or preempt the
|
||||
// oldest if already at maximum polyphony.
|
||||
int iWave;
|
||||
for ( iWave=0; iWave<TABLA_POLYPHONY; iWave++ ) {
|
||||
if ( soundNumber_[iWave] == noteNumber ) {
|
||||
if ( waves_[iWave].isFinished() ) {
|
||||
soundOrder_[iWave] = nSounding_;
|
||||
nSounding_++;
|
||||
}
|
||||
waves_[TABLA_POLYPHONY-1] = 0;
|
||||
filters_[TABLA_POLYPHONY-1] = tempFilt;
|
||||
waves_[iWave].reset();
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
break;
|
||||
}
|
||||
else
|
||||
nSounding_ += 1;
|
||||
}
|
||||
|
||||
sounding_[nSounding_-1] = noteNum;
|
||||
// Concatenate the rawwave path to the file name.
|
||||
waves_[nSounding_-1] = new WvIn( (std::string("rawwaves/") + tablaWaves[noteNum]).c_str(), true );
|
||||
waves_[nSounding_-1]->normalize(0.4);
|
||||
if ( iWave == TABLA_POLYPHONY ) { // This note number is not currently loaded.
|
||||
if ( nSounding_ < TABLA_POLYPHONY ) {
|
||||
for ( iWave=0; iWave<TABLA_POLYPHONY; iWave++ )
|
||||
if ( soundOrder_[iWave] < 0 ) break;
|
||||
nSounding_ += 1;
|
||||
}
|
||||
else {
|
||||
for ( iWave=0; iWave<TABLA_POLYPHONY; iWave++ )
|
||||
if ( soundOrder_[iWave] == 0 ) break;
|
||||
// Re-order the list.
|
||||
for ( int j=0; j<TABLA_POLYPHONY; j++ ) {
|
||||
if ( soundOrder_[j] > soundOrder_[iWave] )
|
||||
soundOrder_[j] -= 1;
|
||||
}
|
||||
}
|
||||
soundOrder_[iWave] = nSounding_ - 1;
|
||||
soundNumber_[iWave] = noteNumber;
|
||||
|
||||
// Concatenate the rawwave path to the rawwave file
|
||||
waves_[iWave].openFile( (std::string("rawwaves/") + tablaWaves[ noteNumber ]).c_str(), true );
|
||||
if ( Stk::sampleRate() != 22050.0 )
|
||||
waves_[nSounding_-1]->setRate( 22050.0 / Stk::sampleRate() );
|
||||
filters_[nSounding_-1]->setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[nSounding_-1]->setGain( gain );
|
||||
waves_[iWave].setRate( 22050.0 / Stk::sampleRate() );
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
}
|
||||
|
||||
#if defined(_STK_DEBUG_)
|
||||
errorString_ << "Tabla::noteOn: number sounding = " << nSounding_ << '\n';
|
||||
for (i=0; i<nSounding_; i++) errorString_ << sounding_[i] << " ";
|
||||
for (i=0; i<nSounding_; i++) errorString_ << soundNumber_[i] << " ";
|
||||
errorString_ << '\n';
|
||||
handleError( StkError::DEBUG_WARNING );
|
||||
#endif
|
||||
@@ -125,46 +121,30 @@ void Tabla :: noteOff(StkFloat amplitude)
|
||||
{
|
||||
// Set all sounding wave filter gains low.
|
||||
int i = 0;
|
||||
while ( i < nSounding_ )
|
||||
filters_[i++]->setGain( amplitude * 0.01 );
|
||||
while ( i < nSounding_ ) filters_[i++].setGain( amplitude * 0.01 );
|
||||
}
|
||||
|
||||
StkFloat Tabla :: tick()
|
||||
StkFloat Tabla :: computeSample()
|
||||
{
|
||||
OnePole *tempFilt;
|
||||
|
||||
int j, i = 0;
|
||||
lastOutput_ = 0.0;
|
||||
while ( i < nSounding_ ) {
|
||||
if ( waves_[i]->isFinished() ) {
|
||||
delete waves_[i];
|
||||
tempFilt = filters_[i];
|
||||
// Re-order the list.
|
||||
for ( j=i; j<nSounding_-1; j++ ) {
|
||||
sounding_[j] = sounding_[j+1];
|
||||
waves_[j] = waves_[j+1];
|
||||
filters_[j] = filters_[j+1];
|
||||
if ( nSounding_ == 0 ) return lastOutput_;
|
||||
|
||||
for ( int i=0; i<TABLA_POLYPHONY; i++ ) {
|
||||
if ( soundOrder_[i] >= 0 ) {
|
||||
if ( waves_[i].isFinished() ) {
|
||||
// Re-order the list.
|
||||
for ( int j=0; j<TABLA_POLYPHONY; j++ ) {
|
||||
if ( soundOrder_[j] > soundOrder_[i] )
|
||||
soundOrder_[j] -= 1;
|
||||
}
|
||||
soundOrder_[i] = -1;
|
||||
nSounding_--;
|
||||
}
|
||||
filters_[j] = tempFilt;
|
||||
filters_[j]->clear();
|
||||
sounding_[j] = -1;
|
||||
nSounding_ -= 1;
|
||||
i -= 1;
|
||||
else
|
||||
lastOutput_ += filters_[i].tick( waves_[i].tick() );
|
||||
}
|
||||
else
|
||||
lastOutput_ += filters_[i]->tick( waves_[i]->tick() );
|
||||
i++;
|
||||
}
|
||||
|
||||
return lastOutput_;
|
||||
}
|
||||
|
||||
StkFloat *Tabla :: tick(StkFloat *vector, unsigned int vectorSize)
|
||||
{
|
||||
return Instrmnt::tick( vector, vectorSize );
|
||||
}
|
||||
|
||||
StkFrames& Tabla :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return Instrmnt::tick( frames, channel );
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
/*! \class Tabla
|
||||
\brief STK tabla drum class.
|
||||
|
||||
This class implements a drum sampling
|
||||
synthesizer using WvIn objects and one-pole
|
||||
filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately
|
||||
interpolated for other sample rates. You can
|
||||
specify the maximum polyphony (maximum number
|
||||
of simultaneous voices) in Drummer.h.
|
||||
This class implements a drum sampling synthesizer using FileWvIn
|
||||
objects and one-pole filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately interpolated for other
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in Tabla.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -18,7 +16,7 @@
|
||||
#define STK_TABLA_H
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include "WvIn.h"
|
||||
#include "FileWvIn.h"
|
||||
#include "OnePole.h"
|
||||
|
||||
const int TABLA_NUMWAVES = 15;
|
||||
@@ -39,25 +37,14 @@ class Tabla : public Instrmnt
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
void noteOff(StkFloat amplitude);
|
||||
|
||||
//! Compute one output sample.
|
||||
StkFloat tick();
|
||||
protected:
|
||||
|
||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
||||
StkFloat computeSample( void );
|
||||
|
||||
//! Fill a channel of the StkFrames object with computed outputs.
|
||||
/*!
|
||||
The \c channel argument should be one or greater (the first
|
||||
channel is specified by 1). An StkError will be thrown if the \c
|
||||
channel argument is zero or it is greater than the number of
|
||||
channels in the StkFrames object.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
||||
|
||||
protected:
|
||||
WvIn *waves_[TABLA_POLYPHONY];
|
||||
OnePole *filters_[TABLA_POLYPHONY];
|
||||
int sounding_[TABLA_POLYPHONY];
|
||||
FileWvIn waves_[TABLA_POLYPHONY];
|
||||
OnePole filters_[TABLA_POLYPHONY];
|
||||
std::vector<int> soundOrder_;
|
||||
std::vector<int> soundNumber_;
|
||||
int nSounding_;
|
||||
|
||||
};
|
||||
|
||||
@@ -2,39 +2,46 @@
|
||||
/*! \class VoicDrum
|
||||
\brief STK vocal drum sample player class.
|
||||
|
||||
This class implements a drum sampling
|
||||
synthesizer using WvIn objects and one-pole
|
||||
filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately
|
||||
interpolated for other sample rates. You can
|
||||
specify the maximum polyphony (maximum number
|
||||
of simultaneous voices) in Drummer.h.
|
||||
This class implements a drum sampling synthesizer using FileWvIn
|
||||
objects and one-pole filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately interpolated for other
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in VoicDrum.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "VoicDrum.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
VoicDrum :: VoicDrum() : Instrmnt()
|
||||
{
|
||||
for ( int i=0; i<VOICE_POLYPHONY; i++ ) {
|
||||
filters_[i] = new OnePole;
|
||||
sounding_[i] = -1;
|
||||
}
|
||||
|
||||
// This counts the number of sounding voices.
|
||||
nSounding_ = 0;
|
||||
soundOrder_ = std::vector<int> (VOICE_POLYPHONY, -1);
|
||||
soundNumber_ = std::vector<int> (VOICE_POLYPHONY, -1);
|
||||
}
|
||||
|
||||
VoicDrum :: ~VoicDrum()
|
||||
{
|
||||
int i;
|
||||
for ( i=0; i<nSounding_; i++ ) delete waves_[i];
|
||||
for ( i=0; i<VOICE_POLYPHONY; i++ ) delete filters_[i];
|
||||
}
|
||||
|
||||
char voiceNames[VOICE_NUMWAVES][11] =
|
||||
{
|
||||
"tak2.raw",
|
||||
"tak1.raw",
|
||||
"bee1.raw",
|
||||
"dee1.raw",
|
||||
"dee2.raw",
|
||||
"din1.raw",
|
||||
"gun1.raw",
|
||||
"jun1.raw",
|
||||
"jun2.raw",
|
||||
"tak3.raw",
|
||||
"tak4.raw"
|
||||
};
|
||||
|
||||
void VoicDrum :: noteOn( StkFloat instrument, StkFloat amplitude )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
@@ -54,65 +61,54 @@ void VoicDrum :: noteOn( StkFloat instrument, StkFloat amplitude )
|
||||
return;
|
||||
}
|
||||
|
||||
char voiceNames[VOICE_NUMWAVES][11] =
|
||||
{
|
||||
"tak2.raw",
|
||||
"tak1.raw",
|
||||
"bee1.raw",
|
||||
"dee1.raw",
|
||||
"dee2.raw",
|
||||
"din1.raw",
|
||||
"gun1.raw",
|
||||
"jun1.raw",
|
||||
"jun2.raw",
|
||||
"tak3.raw",
|
||||
"tak4.raw"
|
||||
};
|
||||
int noteNumber = ( (int) instrument ) % 11;
|
||||
|
||||
int noteNum = ( (int) instrument ) % 11;
|
||||
|
||||
// Check first to see if there's already one like this sounding.
|
||||
int i, waveIndex = -1;
|
||||
for ( i=0; i<VOICE_POLYPHONY; i++ ) {
|
||||
if ( sounding_[i] == noteNum ) waveIndex = i;
|
||||
}
|
||||
|
||||
if ( waveIndex >= 0 ) {
|
||||
// Reset this sound.
|
||||
waves_[waveIndex]->reset();
|
||||
filters_[waveIndex]->setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[waveIndex]->setGain( gain );
|
||||
}
|
||||
else {
|
||||
if ( nSounding_ == VOICE_POLYPHONY ) {
|
||||
// If we're already at maximum polyphony, then preempt the oldest voice.
|
||||
delete waves_[0];
|
||||
filters_[0]->clear();
|
||||
OnePole *tempFilt = filters_[0];
|
||||
// Re-order the list.
|
||||
for ( i=0; i<VOICE_POLYPHONY-1; i++ ) {
|
||||
waves_[i] = waves_[i+1];
|
||||
filters_[i] = filters_[i+1];
|
||||
// If we already have a wave of this note number loaded, just reset
|
||||
// it. Otherwise, look first for an unused wave or preempt the
|
||||
// oldest if already at maximum polyphony.
|
||||
int iWave;
|
||||
for ( iWave=0; iWave<VOICE_POLYPHONY; iWave++ ) {
|
||||
if ( soundNumber_[iWave] == noteNumber ) {
|
||||
if ( waves_[iWave].isFinished() ) {
|
||||
soundOrder_[iWave] = nSounding_;
|
||||
nSounding_++;
|
||||
}
|
||||
waves_[VOICE_POLYPHONY-1] = 0;
|
||||
filters_[VOICE_POLYPHONY-1] = tempFilt;
|
||||
waves_[iWave].reset();
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
break;
|
||||
}
|
||||
else
|
||||
nSounding_ += 1;
|
||||
}
|
||||
|
||||
sounding_[nSounding_-1] = noteNum;
|
||||
// Concatenate the rawwave path to the file name.
|
||||
waves_[nSounding_-1] = new WvIn( (std::string("rawwaves/") + voiceNames[noteNum]).c_str(), true );
|
||||
waves_[nSounding_-1]->normalize(0.4);
|
||||
if (Stk::sampleRate() != 22050.0)
|
||||
waves_[nSounding_-1]->setRate( 22050.0 / Stk::sampleRate() );
|
||||
filters_[nSounding_-1]->setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[nSounding_-1]->setGain( gain );
|
||||
if ( iWave == VOICE_POLYPHONY ) { // This note number is not currently loaded.
|
||||
if ( nSounding_ < VOICE_POLYPHONY ) {
|
||||
for ( iWave=0; iWave<VOICE_POLYPHONY; iWave++ )
|
||||
if ( soundOrder_[iWave] < 0 ) break;
|
||||
nSounding_ += 1;
|
||||
}
|
||||
else {
|
||||
for ( iWave=0; iWave<VOICE_POLYPHONY; iWave++ )
|
||||
if ( soundOrder_[iWave] == 0 ) break;
|
||||
// Re-order the list.
|
||||
for ( int j=0; j<VOICE_POLYPHONY; j++ ) {
|
||||
if ( soundOrder_[j] > soundOrder_[iWave] )
|
||||
soundOrder_[j] -= 1;
|
||||
}
|
||||
}
|
||||
soundOrder_[iWave] = nSounding_ - 1;
|
||||
soundNumber_[iWave] = noteNumber;
|
||||
|
||||
// Concatenate the rawwave path to the rawwave file
|
||||
waves_[iWave].openFile( (std::string("rawwaves/") + voiceNames[ noteNumber ]).c_str(), true );
|
||||
if ( Stk::sampleRate() != 22050.0 )
|
||||
waves_[iWave].setRate( 22050.0 / Stk::sampleRate() );
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
}
|
||||
|
||||
#if defined(_STK_DEBUG_)
|
||||
errorString_ << "VoicDrum::noteOn: number sounding = " << nSounding_ << '\n';
|
||||
for (i=0; i<nSounding_; i++) errorString_ << sounding_[i] << " ";
|
||||
for (i=0; i<nSounding_; i++) errorString_ << soundNumber_[i] << " ";
|
||||
errorString_ << '\n';
|
||||
handleError( StkError::DEBUG_WARNING );
|
||||
#endif
|
||||
@@ -122,45 +118,29 @@ void VoicDrum :: noteOff(StkFloat amplitude)
|
||||
{
|
||||
// Set all sounding wave filter gains low.
|
||||
int i = 0;
|
||||
while ( i < nSounding_ ) filters_[i++]->setGain( amplitude * 0.01 );
|
||||
while ( i < nSounding_ ) filters_[i++].setGain( amplitude * 0.01 );
|
||||
}
|
||||
|
||||
StkFloat VoicDrum :: tick()
|
||||
StkFloat VoicDrum :: computeSample()
|
||||
{
|
||||
OnePole *tempFilt;
|
||||
|
||||
int j, i = 0;
|
||||
lastOutput_ = 0.0;
|
||||
while ( i < nSounding_ ) {
|
||||
if ( waves_[i]->isFinished() ) {
|
||||
delete waves_[i];
|
||||
tempFilt = filters_[i];
|
||||
// Re-order the list.
|
||||
for ( j=i; j<nSounding_-1; j++ ) {
|
||||
sounding_[j] = sounding_[j+1];
|
||||
waves_[j] = waves_[j+1];
|
||||
filters_[j] = filters_[j+1];
|
||||
if ( nSounding_ == 0 ) return lastOutput_;
|
||||
|
||||
for ( int i=0; i<VOICE_POLYPHONY; i++ ) {
|
||||
if ( soundOrder_[i] >= 0 ) {
|
||||
if ( waves_[i].isFinished() ) {
|
||||
// Re-order the list.
|
||||
for ( int j=0; j<VOICE_POLYPHONY; j++ ) {
|
||||
if ( soundOrder_[j] > soundOrder_[i] )
|
||||
soundOrder_[j] -= 1;
|
||||
}
|
||||
soundOrder_[i] = -1;
|
||||
nSounding_--;
|
||||
}
|
||||
filters_[j] = tempFilt;
|
||||
filters_[j]->clear();
|
||||
sounding_[j] = -1;
|
||||
nSounding_ -= 1;
|
||||
i -= 1;
|
||||
else
|
||||
lastOutput_ += filters_[i].tick( waves_[i].tick() );
|
||||
}
|
||||
else
|
||||
lastOutput_ += filters_[i]->tick( waves_[i]->tick() );
|
||||
i++;
|
||||
}
|
||||
|
||||
return lastOutput_;
|
||||
}
|
||||
|
||||
StkFloat *VoicDrum :: tick(StkFloat *vector, unsigned int vectorSize)
|
||||
{
|
||||
return Instrmnt::tick( vector, vectorSize );
|
||||
}
|
||||
|
||||
StkFrames& VoicDrum :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return Instrmnt::tick( frames, channel );
|
||||
}
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
/*! \class VoicDrum
|
||||
\brief STK vocal drum sample player class.
|
||||
|
||||
This class implements a drum sampling
|
||||
synthesizer using WvIn objects and one-pole
|
||||
filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately
|
||||
interpolated for other sample rates. You can
|
||||
specify the maximum polyphony (maximum number
|
||||
of simultaneous voices) in Drummer.h.
|
||||
This class implements a drum sampling synthesizer using FileWvIn
|
||||
objects and one-pole filters. The drum rawwave files are sampled
|
||||
at 22050 Hz, but will be appropriately interpolated for other
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in VoicDrum.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -18,7 +16,7 @@
|
||||
#define STK_VOICDRUM_H
|
||||
|
||||
#include "Instrmnt.h"
|
||||
#include "WvIn.h"
|
||||
#include "FileWvIn.h"
|
||||
#include "OnePole.h"
|
||||
|
||||
const int VOICE_NUMWAVES = 11;
|
||||
@@ -39,25 +37,14 @@ class VoicDrum : public Instrmnt
|
||||
//! Stop a note with the given amplitude (speed of decay).
|
||||
void noteOff(StkFloat amplitude);
|
||||
|
||||
//! Compute one output sample.
|
||||
StkFloat tick();
|
||||
protected:
|
||||
|
||||
//! Computer \e vectorSize outputs and return them in \e vector.
|
||||
StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
|
||||
StkFloat computeSample( void );
|
||||
|
||||
//! Fill a channel of the StkFrames object with computed outputs.
|
||||
/*!
|
||||
The \c channel argument should be one or greater (the first
|
||||
channel is specified by 1). An StkError will be thrown if the \c
|
||||
channel argument is zero or it is greater than the number of
|
||||
channels in the StkFrames object.
|
||||
*/
|
||||
StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
|
||||
|
||||
protected:
|
||||
WvIn *waves_[VOICE_POLYPHONY];
|
||||
OnePole *filters_[VOICE_POLYPHONY];
|
||||
int sounding_[VOICE_POLYPHONY];
|
||||
FileWvIn waves_[VOICE_POLYPHONY];
|
||||
OnePole filters_[VOICE_POLYPHONY];
|
||||
std::vector<int> soundOrder_;
|
||||
std::vector<int> soundNumber_;
|
||||
int nSounding_;
|
||||
|
||||
};
|
||||
|
||||
@@ -188,24 +188,22 @@ int tick(char *buffer, int bufferSize, void *dataPointer)
|
||||
// Do a bunch of random controls unless settling down to end.
|
||||
if ( data->settling ) {
|
||||
if ( data->counter == 0 ) {
|
||||
if ( data->endPhase++ == 0 ) {
|
||||
data->counter = (int) (data->t60 * Stk::sampleRate());
|
||||
data->counter = (int) (data->t60 * Stk::sampleRate());
|
||||
if ( data->endPhase == 0 ) {
|
||||
data->drones[2].noteOn( droneFreqs[2], 0.1 );
|
||||
std::cout << "What Need Have I for This?\n";
|
||||
}
|
||||
else if ( data->endPhase == 1 ) {
|
||||
data->counter = (int) (data->t60 * Stk::sampleRate());
|
||||
data->drones[0].noteOn( droneFreqs[0], 0.1 );
|
||||
std::cout << "RagaMatic finished ... \n";
|
||||
}
|
||||
else if ( data->endPhase == 2 ) {
|
||||
data->counter = (int) (data->t60 * Stk::sampleRate());
|
||||
std::cout << "All is Bliss ...\n";
|
||||
}
|
||||
else if ( data->endPhase == 3 ) {
|
||||
std::cout << "All is Bliss ...\n";
|
||||
data->counter = (int) (data->t60 * Stk::sampleRate());
|
||||
}
|
||||
data->endPhase++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -140,6 +140,22 @@ SOURCE=..\..\include\Envelope.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileRead.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileRead.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\FileWvIn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -272,6 +288,14 @@ SOURCE=.\Tabla.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\TcpServer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\TcpServer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Thread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
Reference in New Issue
Block a user