mirror of
https://github.com/thestk/stk
synced 2026-02-05 00:56:14 +00:00
Version 4.4.0
This commit is contained in:
committed by
Stephen Sinclair
parent
d199342e86
commit
eccd8c9981
@@ -20,18 +20,16 @@ endif
|
||||
vpath %.h $(INCLUDE)
|
||||
|
||||
CC = @CXX@
|
||||
DEFS = @byte_order@
|
||||
DEFS += @debug@
|
||||
CFLAGS = @cflags@
|
||||
CFLAGS += @warn@ -I$(INCLUDE) -I../../src/include
|
||||
DEFS = @CPPFLAGS@
|
||||
DEFS += @byte_order@
|
||||
CFLAGS = @CXXFLAGS@
|
||||
CFLAGS += -I$(INCLUDE) -I$(INCLUDE)/../src/include
|
||||
LIBRARY = @LIBS@
|
||||
LIBRARY += @frameworks@
|
||||
|
||||
REALTIME = @realtime@
|
||||
ifeq ($(REALTIME),yes)
|
||||
PROGRAMS += effects
|
||||
OBJECTS += RtMidi.o RtAudio.o Thread.o Mutex.o Socket.o TcpServer.o @objects@
|
||||
DEFS += @audio_apis@
|
||||
endif
|
||||
|
||||
RAWWAVES = @rawwaves@
|
||||
@@ -59,6 +57,7 @@ $(OBJECTS) : Stk.h
|
||||
clean :
|
||||
-rm $(OBJECT_PATH)/*.o
|
||||
-rm $(PROGRAMS) *.exe
|
||||
-rm -fR *.dSYM
|
||||
|
||||
strip :
|
||||
strip $(PROGRAMS)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
The Synthesis ToolKit in C++ (STK)
|
||||
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2007.
|
||||
By Perry R. Cook and Gary P. Scavone, 1995-2009.
|
||||
|
||||
EFFECTS PROJECT:
|
||||
|
||||
|
||||
@@ -13,10 +13,13 @@
|
||||
#include "RtAudio.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
using std::min;
|
||||
|
||||
using namespace stk;
|
||||
|
||||
void usage(void) {
|
||||
// Error function in case of incorrect command-line argument specifications
|
||||
std::cout << "\nuseage: effects flags \n";
|
||||
@@ -33,7 +36,7 @@ static void finish(int ignore){ done = true; }
|
||||
// The TickData structure holds all the class instances and data that
|
||||
// are shared by the various processing functions.
|
||||
struct TickData {
|
||||
Effect *effect;
|
||||
unsigned int effectId;
|
||||
PRCRev prcrev;
|
||||
JCRev jcrev;
|
||||
NRev nrev;
|
||||
@@ -51,7 +54,7 @@ struct TickData {
|
||||
|
||||
// Default constructor.
|
||||
TickData()
|
||||
: effect(0), t60(1.0), counter(0),
|
||||
: effectId(0), t60(1.0), counter(0),
|
||||
settling( false ), haveMessage( false ) {}
|
||||
};
|
||||
|
||||
@@ -90,18 +93,7 @@ void processMessage( TickData* data )
|
||||
|
||||
case 20: { // effect type change
|
||||
int type = data->message.intValues[1];
|
||||
if ( type == 0 )
|
||||
data->effect = &(data->echo);
|
||||
else if ( type == 1 )
|
||||
data->effect = &(data->shifter);
|
||||
else if ( type == 2 )
|
||||
data->effect = &(data->chorus);
|
||||
else if ( type == 3 )
|
||||
data->effect = &(data->prcrev);
|
||||
else if ( type == 4 )
|
||||
data->effect = &(data->jcrev);
|
||||
else if ( type == 5 )
|
||||
data->effect = &(data->nrev);
|
||||
data->effectId = (unsigned int) type;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -153,6 +145,7 @@ int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
|
||||
TickData *data = (TickData *) dataPointer;
|
||||
register StkFloat *oSamples = (StkFloat *) outputBuffer, *iSamples = (StkFloat *) inputBuffer;
|
||||
register StkFloat sample;
|
||||
Effect *effect;
|
||||
int i, counter, nTicks = (int) nBufferFrames;
|
||||
|
||||
while ( nTicks > 0 && !done ) {
|
||||
@@ -170,9 +163,35 @@ int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
|
||||
counter = min( nTicks, data->counter );
|
||||
data->counter -= counter;
|
||||
for ( i=0; i<counter; i++ ) {
|
||||
sample = data->envelope.tick() * data->effect->tick( *iSamples++ );
|
||||
*oSamples++ = sample; // two channels interleaved
|
||||
*oSamples++ = sample;
|
||||
if ( data->effectId < 2 ) { // Echo and PitShift ... mono output
|
||||
if ( data->effectId == 0 )
|
||||
sample = data->envelope.tick() * data->echo.tick( *iSamples++ );
|
||||
else
|
||||
sample = data->envelope.tick() * data->shifter.tick( *iSamples++ );
|
||||
*oSamples++ = sample; // two channels interleaved
|
||||
*oSamples++ = sample;
|
||||
}
|
||||
else { // Chorus or a reverb ... stereo output
|
||||
if ( data->effectId == 2 ) {
|
||||
data->chorus.tick( *iSamples++ );
|
||||
effect = (Effect *) &(data->chorus);
|
||||
}
|
||||
else if ( data->effectId == 3 ) {
|
||||
data->prcrev.tick( *iSamples++ );
|
||||
effect = (Effect *) &(data->prcrev);
|
||||
}
|
||||
else if ( data->effectId == 4 ) {
|
||||
data->jcrev.tick( *iSamples++ );
|
||||
effect = (Effect *) &(data->jcrev);
|
||||
}
|
||||
else {
|
||||
data->nrev.tick( *iSamples++ );
|
||||
effect = (Effect *) &(data->nrev);
|
||||
}
|
||||
const StkFrames& samples = effect->lastFrame();
|
||||
*oSamples++ = data->envelope.tick() * samples[0];
|
||||
*oSamples++ = data->envelope.lastOut() * samples[1];
|
||||
}
|
||||
nTicks--;
|
||||
}
|
||||
if ( nTicks == 0 ) break;
|
||||
@@ -184,7 +203,6 @@ int tick( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
TickData data;
|
||||
@@ -230,7 +248,6 @@ int main( int argc, char *argv[] )
|
||||
}
|
||||
|
||||
data.envelope.setRate( 0.001 );
|
||||
data.effect = &( data.echo );
|
||||
|
||||
// Install an interrupt handler function.
|
||||
(void) signal( SIGINT, finish );
|
||||
|
||||
@@ -118,10 +118,6 @@ SOURCE=..\..\include\Echo.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Effect.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Effect.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -154,18 +150,10 @@ SOURCE=..\..\include\FileWvIn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Filter.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Filter.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\Generator.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\Generator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -282,15 +270,11 @@ SOURCE=..\..\include\Thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WaveLoop.cpp
|
||||
SOURCE=..\..\src\FileLoop.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\WaveLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\src\WvIn.cpp
|
||||
SOURCE=..\..\include\FileLoop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
||||
Reference in New Issue
Block a user