Version 4.2.1

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

View File

@@ -1,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)

View File

@@ -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

View 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

View 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;
}

View File

@@ -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;

View File

@@ -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

View 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>

View File

@@ -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;
}

View File

@@ -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

View 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;
}

View 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"

View 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;
}

View 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

View 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
View 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

View 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
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

View File

@@ -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);

View File

@@ -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

View 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; }

View 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

View File

@@ -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;

View File

@@ -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

View 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;

View File

@@ -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

View 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;
}

View File

@@ -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

View File

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

View File

@@ -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

View 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;
}

View File

@@ -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;
}

View File

@@ -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