Update of /cvsroot/pure-data/externals/unauthorized/stksitar~ In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20979
Modified Files: Makefile README sitar.cc sitar.h stksitar~.cc Log Message: adapted for STK 4.2.0
Index: stksitar~.cc =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/stksitar~/stksitar~.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stksitar~.cc 16 Aug 2003 17:08:55 -0000 1.1 --- stksitar~.cc 14 Nov 2004 22:46:51 -0000 1.2 *************** *** 50,54 **** return; } ! x->x_stksitar->setFreq( (MY_FLOAT) ffreq ); x->x_freq = ffreq; } --- 50,54 ---- return; } ! x->x_stksitar->setFreq( (StkFloat) ffreq ); x->x_freq = ffreq; } *************** *** 61,65 **** return; } ! x->x_stksitar->pluck( (MY_FLOAT) fpluck ); x->x_pluck = fpluck; } --- 61,65 ---- return; } ! x->x_stksitar->pluck( (StkFloat) fpluck ); x->x_pluck = fpluck; }
Index: README =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/stksitar~/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README 16 Aug 2003 17:08:55 -0000 1.1 --- README 14 Nov 2004 22:46:51 -0000 1.2 *************** *** 1,4 **** ***************************************************************************** ! Version 0.01 embedding Perry Cook's ragamatic in Pure Data copyright 2001 by Perry Cook --- 1,4 ---- ***************************************************************************** ! Version 0.2 embedding Perry Cook's ragamatic in Pure Data copyright 2001 by Perry Cook
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/stksitar~/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 16 Aug 2003 17:08:55 -0000 1.1 --- Makefile 14 Nov 2004 22:46:51 -0000 1.2 *************** *** 22,27 **** g++ -O3 -Wall -D__OS_Linux_ -g -I$(STK_HOME)/include -c sitar.cc g++ $(LINUXCCFLAGS) $(LINUXINCLUDE) -I$(STK_HOME)/include -o $*.o -c $*.cc ! ld -export_dynamic -shared -o $*.pd_linux *.o $(STK_HOME)/src/stklib.a -lc -lm -lstdc++ -lg++ ! #strip --strip-unneeded $*.pd_linux rm -f *.o ../$*.pd_linux ln -s $*/$*.pd_linux .. --- 22,27 ---- g++ -O3 -Wall -D__OS_Linux_ -g -I$(STK_HOME)/include -c sitar.cc g++ $(LINUXCCFLAGS) $(LINUXINCLUDE) -I$(STK_HOME)/include -o $*.o -c $*.cc ! g++ -export_dynamic -shared -o $*.pd_linux *.o $(STK_HOME)/src/libstk.a -lc -lm -lpthread ! strip --strip-unneeded $*.pd_linux rm -f *.o ../$*.pd_linux ln -s $*/$*.pd_linux ..
Index: sitar.cc =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/stksitar~/sitar.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sitar.cc 16 Aug 2003 17:08:55 -0000 1.1 --- sitar.cc 14 Nov 2004 22:46:51 -0000 1.2 *************** *** 10,25 **** #include "sitar.h"
! #ifndef MY_FLOAT ! #warning "weird : MY_FLOAT undefined" ! #define MY_FLOAT double ! #endif ! ! sitar :: sitar(MY_FLOAT lowestFreq) { length = (long) (SRATE / lowestFreq + 1); ! loopGain = (MY_FLOAT) 0.999; loopFilt = new OneZero(); ! loopFilt->setCoeff(0.01); ! delayLine = new DLineA(length); delay = length/2; delayTarg = delay; --- 10,20 ---- #include "sitar.h"
! sitar :: sitar(StkFloat lowestFreq) { length = (long) (SRATE / lowestFreq + 1); ! loopGain = (StkFloat) 0.999; loopFilt = new OneZero(); ! loopFilt->setZero(0.01); ! delayLine = new DelayA(0.5 * length, length); delay = length/2; delayTarg = delay; *************** *** 44,62 **** }
! void sitar :: setFreq(MY_FLOAT frequency) { delayTarg = (SRATE / frequency); delay = delayTarg * (1.0 + (0.05 * noise->tick())); delayLine->setDelay(delay); ! loopGain = (MY_FLOAT) 0.995 + (frequency * (MY_FLOAT) 0.000001); ! if (loopGain>1.0) loopGain = (MY_FLOAT) 0.9995; }
! void sitar :: pluck(MY_FLOAT amplitude) { envelope->keyOn(); }
! void sitar :: noteOn(MY_FLOAT freq, MY_FLOAT amp) { this->setFreq(freq); --- 39,57 ---- }
! void sitar :: setFreq(StkFloat frequency) { delayTarg = (SRATE / frequency); delay = delayTarg * (1.0 + (0.05 * noise->tick())); delayLine->setDelay(delay); ! loopGain = (StkFloat) 0.995 + (frequency * (StkFloat) 0.000001); ! if (loopGain>1.0) loopGain = (StkFloat) 0.9995; }
! void sitar :: pluck(StkFloat amplitude) { envelope->keyOn(); }
! void sitar :: noteOn(StkFloat freq, StkFloat amp) { this->setFreq(freq); *************** *** 68,74 **** }
! void sitar :: noteOff(MY_FLOAT amp) { ! loopGain = (MY_FLOAT) 1.0 - amp; #if defined(_debug_) printf("sitar : NoteOff: Amp=%lf\n",amp); --- 63,69 ---- }
! void sitar :: noteOff(StkFloat amp) { ! loopGain = (StkFloat) 1.0 - amp; #if defined(_debug_) printf("sitar : NoteOff: Amp=%lf\n",amp); *************** *** 76,82 **** }
! MY_FLOAT sitar :: tick() { ! MY_FLOAT temp;
temp = delayLine->lastOut(); --- 71,77 ---- }
! StkFloat sitar :: tick() { ! StkFloat temp;
temp = delayLine->lastOut(); *************** *** 98,105 **** }
! lastOutput = delayLine->tick(loopFilt->tick(temp) + (amPluck * envelope->tick() * noise->tick()));
! return lastOutput; }
--- 93,100 ---- }
! lastOutput_ = delayLine->tick(loopFilt->tick(temp) + (amPluck * envelope->tick() * noise->tick()));
! return lastOutput_; }
Index: sitar.h =================================================================== RCS file: /cvsroot/pure-data/externals/unauthorized/stksitar~/sitar.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sitar.h 16 Aug 2003 17:08:55 -0000 1.1 --- sitar.h 14 Nov 2004 22:46:51 -0000 1.2 *************** *** 11,42 **** #define __sitar_h
! #include "Instrmnt.h" ! #include "DLineA.h" #include "OneZero.h" ! #include "ADSR.h" ! #include "Noise.h" ! #include "Object.h"
class sitar : public Instrmnt { protected: ! DLineA *delayLine; OneZero *loopFilt; ADSR *envelope; Noise *noise; long length; ! MY_FLOAT loopGain; ! MY_FLOAT amPluck; ! MY_FLOAT delay; ! MY_FLOAT delayTarg; public: ! sitar(MY_FLOAT lowestFreq); ~sitar(); void clear(); ! virtual void setFreq(MY_FLOAT frequency); ! void pluck(MY_FLOAT amplitude); ! virtual void noteOn(MY_FLOAT freq, MY_FLOAT amp); ! virtual void noteOff(MY_FLOAT amp); ! virtual MY_FLOAT tick(); };
--- 11,41 ---- #define __sitar_h
! #include "Instrmnt.h" ! #include "DelayA.h" #include "OneZero.h" ! #include "Noise.h" ! #include "ADSR.h"
class sitar : public Instrmnt { protected: ! DelayA *delayLine; OneZero *loopFilt; ADSR *envelope; Noise *noise; long length; ! StkFloat loopGain; ! StkFloat amPluck; ! StkFloat delay; ! StkFloat delayTarg; public: ! sitar(StkFloat lowestFreq); ~sitar(); void clear(); ! virtual void setFreq(StkFloat frequency); ! void pluck(StkFloat amplitude); ! virtual void noteOn(StkFloat freq, StkFloat amp); ! virtual void noteOff(StkFloat amp); ! virtual StkFloat tick(); };