From 363ca0a4a7b39f7d357cd5e71bd480a9ecccf5a7 Mon Sep 17 00:00:00 2001 From: Guenter Geiger Date: Sun, 17 Oct 2004 20:04:36 +0000 Subject: updated stk to stk version 4.2.0, added README file svn path=/trunk/externals/ggee/; revision=2112 --- experimental/README.stk | 25 +++++++ experimental/makefile | 46 ++++++++++++ experimental/stk.cpp | 80 ++++++++++----------- experimental/stk.h | 183 ++++++++++++++++++++++++------------------------ 4 files changed, 203 insertions(+), 131 deletions(-) create mode 100644 experimental/README.stk create mode 100644 experimental/makefile diff --git a/experimental/README.stk b/experimental/README.stk new file mode 100644 index 0000000..4b1a1b3 --- /dev/null +++ b/experimental/README.stk @@ -0,0 +1,25 @@ + + +In order to compile the stk external you have to put the latest +stk release (4.2.0) in this directory. + +* First compile stk + +if stk is compiled just do a make stk.pd_linux. + + +Hint: +You may have to set the rawwaves path in stk in so that the external +can find them. See the STK INSTALL file for details. +You do not have to specify a special audio API, as audio I/O is done +through pd. + +The stk configure command should be something like this: + +./configure RAWWAVE_PATH="/home/gary/rawwaves/" + + +Guenter Geiger + + + diff --git a/experimental/makefile b/experimental/makefile new file mode 100644 index 0000000..4c0c51a --- /dev/null +++ b/experimental/makefile @@ -0,0 +1,46 @@ + +EXTERNALS = $(shell ls *.c) +CPPEXTERNALS = $(shell ls *.cpp) + +STRIP = strip --strip-unneeded -R .note -R .comment + +all: $(EXTERNALS:.c=.pd_linux) $(CPPEXTERNALS:.cpp=.pd_linux) + +# this might be a better way to do this: +# EXTERNALS := ${patsubst %.c, %.o, ${wildcard *.c}} +# all: ${EXTERNALS} + +.SUFFIXES: .pd_linux + +STK = $(shell ls -d stk*/) + +CFLAGS = -I$(STK)include + +# cross-platform default +CPU_FLAGS = -O2 +OPTIM_FLAGS = -funroll-loops -fomit-frame-pointer $(CPU_FLAGS) + +FLAGS = -fPIC -DPD -DUNIX $(OPTIM_FLAGS) \ + -Wall -W -Wshadow -Wstrict-prototypes \ + -Wno-unused -Wno-parentheses -Wno-switch $(CFLAGS) + +INCLUDES = -I. -I.. -I../../build/include + +%.pd_linux: %.c + $(CC) $(FLAGS) $(INCLUDES) -o "$*.o" -c "$+" + gcc -Wl,-export_dynamic -shared -o "$@" "$*.o" -lc -lm + chmod a-x "$@" + $(STRIP) $@ + rm -f "$*.o" + +%.pd_linux: %.cpp + $(CXX) $(FLAGS) $(INCLUDES) -o "$*.o" -c "$+" + $(CXX) -Wl,-export_dynamic -shared -o "$@" "$*.o" -lc -lm $(STK)src/libstk.a + chmod a-x "$@" + $(STRIP) $@ + rm -f "$*.o" + +clean: + -rm *.pd_linux *~ *.o + -rm link.stamp + diff --git a/experimental/stk.cpp b/experimental/stk.cpp index e6229f7..6538238 100755 --- a/experimental/stk.cpp +++ b/experimental/stk.cpp @@ -32,52 +32,52 @@ void stk_print(t_stk* x) { } -#define DECL_INST(name) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ +#define DI(name) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ { x->instrument = new name;} -#define DECL_INST2(name) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ -{ x->instrument = new name(80.);} +#define DI2(name,y) if ((stk_instruments[i++] = #name) && !strcmp(s->s_name, #name )) \ +{ x->instrument = new name(y);} static void stk_set_instrument(t_stk* x,t_symbol* s) { int i = 0; - if (!strcmp(s->s_name,"Simple")) x->instrument = new Simple; - DECL_INST2(Plucked) - DECL_INST2(Plucked2) - DECL_INST2(Mandolin) - DECL_INST2(Bowed) - DECL_INST2(Brass) - DECL_INST2(Clarinet) - DECL_INST2(BlowHole) - DECL_INST2(Flute) - DECL_INST(BowedBar) - DECL_INST(Modal4) - DECL_INST(ModalBar) - DECL_INST(FM4Op) - DECL_INST(FM4Alg3) - DECL_INST(FM4Alg4) - DECL_INST(FM4Alg5) - DECL_INST(FM4Alg6) - DECL_INST(FM4Alg8) - DECL_INST(HeavyMtl) - DECL_INST(PercFlut) - DECL_INST(Rhodey) - DECL_INST(Wurley) - DECL_INST(TubeBell) - DECL_INST(FMVoices) - DECL_INST(BeeThree) - DECL_INST(Sampler) - DECL_INST(SamplFlt) - DECL_INST(Moog1) - // DECL_INST(VoicForm) - DECL_INST(DrumSynt) - DECL_INST(Shakers) - DECL_INST2(Sitar1) - DECL_INST2(StrDrone) - else { + + x->instrument = NULL; + DI2(Clarinet,10.0); + DI2(BlowHole,10.0); + DI2(Saxofony,10.0); + DI2(Flute,10.0); + DI2(Brass,10.0); + DI(BlowBotl); + DI2(Bowed,10.0); + DI2(Plucked,5.0); + DI2(StifKarp,5.0); + DI2(Sitar,5.0); + DI2(Mandolin,5.0); + + DI(Rhodey); + DI(Wurley); + DI(TubeBell); + DI(HevyMetl); + DI(PercFlut); + DI(BeeThree); + DI(FMVoices); + + DI(VoicForm); + DI(Moog); + DI(Simple); + DI(Drummer); + DI(BandedWG); + DI(Shakers); + DI(ModalBar); + // DI2(Mesh2D,10, 10); + DI(Resonate); + DI(Whistle); + + if (!x->instrument) error("No such instrument %s",s->s_name); - } + stk_instruments[i] = "LastInst"; } @@ -123,7 +123,7 @@ static void stk_noteOff(t_stk *x) static void stk_control(t_stk *x,t_floatarg f1,t_floatarg f2) { - x->instrument->controlChange(f1,f2); + x->instrument->controlChange((int)f1,f2); } static void stk_control1(t_stk *x,t_floatarg f1) @@ -153,7 +153,7 @@ static void stk_aftertouch(t_stk *x,t_floatarg f1) static void stk_pitchbend(t_stk *x,t_floatarg f1) { - x->instrument->setFreq(f1); + x->instrument->setFrequency(f1); } static void stk_float(t_stk* x,t_floatarg f) diff --git a/experimental/stk.h b/experimental/stk.h index 2fa1ec0..9b7dfaf 100755 --- a/experimental/stk.h +++ b/experimental/stk.h @@ -1,91 +1,92 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifdef __linux__ +#define __OS_LINUX__ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -- cgit v1.2.1