diff options
Diffstat (limited to 'sc4pd')
57 files changed, 189 insertions, 138 deletions
diff --git a/sc4pd/config-pd-linux.txt b/sc4pd/config-pd-linux.txt index 9b46ed4..1e95392 100755 --- a/sc4pd/config-pd-linux.txt +++ b/sc4pd/config-pd-linux.txt @@ -1,7 +1,7 @@ # config file for sc4pd, adapted from Thomas Grill's xsample makefile # your c++ compiler (if not g++) -# CXX=icc + CXX=icc # where does the PD installation reside? diff --git a/sc4pd/headers/plugin_interface/SC_Constants.h b/sc4pd/headers/plugin_interface/SC_Constants.h index b827cad..b9e49bf 100755 --- a/sc4pd/headers/plugin_interface/SC_Constants.h +++ b/sc4pd/headers/plugin_interface/SC_Constants.h @@ -43,4 +43,4 @@ const double truncDouble = 3. * pow(2,51); const float kBadValue = 1e20f; // used in the secant table for values very close to 1/0 -#endif
\ No newline at end of file +#endif diff --git a/sc4pd/make-files.txt b/sc4pd/make-files.txt index 3dc0de4..475dc94 100755 --- a/sc4pd/make-files.txt +++ b/sc4pd/make-files.txt @@ -12,4 +12,4 @@ SRCS= \ LFPulse.cpp Impulse.cpp Integrator.cpp Decay.cpp Decay2.cpp Lag.cpp \ Lag2.cpp Lag3.cpp LinExp.cpp DelayUnit.cpp DelayN.cpp DelayL.cpp \ DelayC.cpp CombN.cpp CombL.cpp CombC.cpp AllpassN.cpp AllpassL.cpp \ - AllpassC.cpp PitchShift.cpp + AllpassC.cpp PitchShift.cpp Resonz.cpp OnePole.cpp diff --git a/sc4pd/source/BrownNoise.cpp b/sc4pd/source/BrownNoise.cpp index ad8a275..316ee42 100644 --- a/sc4pd/source/BrownNoise.cpp +++ b/sc4pd/source/BrownNoise.cpp @@ -40,9 +40,9 @@ /* ------------------------ BrownNoise~ -------------------------------*/ class BrownNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(BrownNoise_ar,flext_dsp); + FLEXT_HEADER(BrownNoise_ar,sc4pd_dsp); public: BrownNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/ClipNoise.cpp b/sc4pd/source/ClipNoise.cpp index 32d8c94..39c0d61 100644 --- a/sc4pd/source/ClipNoise.cpp +++ b/sc4pd/source/ClipNoise.cpp @@ -41,9 +41,9 @@ /* ------------------------ ClipNoise~ -------------------------------*/ class ClipNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(ClipNoise_ar,flext_dsp); + FLEXT_HEADER(ClipNoise_ar,sc4pd_dsp); public: ClipNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Crackle.cpp b/sc4pd/source/Crackle.cpp index a013a1a..8f6c28f 100644 --- a/sc4pd/source/Crackle.cpp +++ b/sc4pd/source/Crackle.cpp @@ -40,9 +40,9 @@ /* ------------------------ Crackle~ -------------------------------*/ class Crackle_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Crackle_ar,flext_dsp); + FLEXT_HEADER(Crackle_ar,sc4pd_dsp); public: Crackle_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Decay.cpp b/sc4pd/source/Decay.cpp index 467611c..c11a7a8 100644 --- a/sc4pd/source/Decay.cpp +++ b/sc4pd/source/Decay.cpp @@ -41,9 +41,9 @@ /* ------------------------ Decay~ -----------------------------*/ class Decay_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Decay_ar,flext_dsp); + FLEXT_HEADER(Decay_ar,sc4pd_dsp); public: Decay_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/Decay2.cpp b/sc4pd/source/Decay2.cpp index 001eb31..a78a180 100644 --- a/sc4pd/source/Decay2.cpp +++ b/sc4pd/source/Decay2.cpp @@ -41,9 +41,9 @@ /* ------------------------ Decay2~ -----------------------------*/ class Decay2_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Decay2_ar,flext_dsp); + FLEXT_HEADER(Decay2_ar,sc4pd_dsp); public: Decay2_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/DelayUnit.cpp b/sc4pd/source/DelayUnit.cpp index 45b05d5..bbd5a2d 100644 --- a/sc4pd/source/DelayUnit.cpp +++ b/sc4pd/source/DelayUnit.cpp @@ -30,12 +30,12 @@ http://www.parasitaere-kapazitaeten.net/ext SuperCollider by James McCartney http://www.audiosynth.com - Coded while listening to: + Coded while listening to: */ -#include "sc4pd.hpp" +// #include "sc4pd.hpp" #include "DelayUnit.hpp" void DelayUnit_ar::DelayUnit_AllocDelayLine() diff --git a/sc4pd/source/DelayUnit.hpp b/sc4pd/source/DelayUnit.hpp index a15a8c3..e9db066 100644 --- a/sc4pd/source/DelayUnit.hpp +++ b/sc4pd/source/DelayUnit.hpp @@ -37,9 +37,11 @@ #include "sc4pd.hpp" -class DelayUnit_ar : public flext_dsp +class DelayUnit_ar + : public sc4pd_dsp { - FLEXT_HEADER(DelayUnit_ar, flext_dsp); + FLEXT_HEADER(DelayUnit_ar,sc4pd_dsp); + public: /* functions */ void DelayUnit_AllocDelayLine(); diff --git a/sc4pd/source/Dust.cpp b/sc4pd/source/Dust.cpp index c44572e..f7b27a1 100644 --- a/sc4pd/source/Dust.cpp +++ b/sc4pd/source/Dust.cpp @@ -39,9 +39,9 @@ /* ------------------------ Dust~ -------------------------------------*/ class Dust_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Dust_ar,flext_dsp); + FLEXT_HEADER(Dust_ar,sc4pd_dsp); public: Dust_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Dust2.cpp b/sc4pd/source/Dust2.cpp index 19013ee..2db7981 100644 --- a/sc4pd/source/Dust2.cpp +++ b/sc4pd/source/Dust2.cpp @@ -40,9 +40,9 @@ /* ------------------------ Dust2~ -------------------------------------*/ class Dust2_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Dust2_ar,flext_dsp); + FLEXT_HEADER(Dust2_ar,sc4pd_dsp); public: Dust2_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/ExpRand.cpp b/sc4pd/source/ExpRand.cpp index 9f1f4a7..a08f6fa 100644 --- a/sc4pd/source/ExpRand.cpp +++ b/sc4pd/source/ExpRand.cpp @@ -40,9 +40,9 @@ /* ------------------------ ExpRand~ -------------------------------*/ class ExpRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(ExpRand_ar,flext_dsp); + FLEXT_HEADER(ExpRand_ar,sc4pd_dsp); public: ExpRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/GrayNoise.cpp b/sc4pd/source/GrayNoise.cpp index 4fa7b23..b9c3e40 100644 --- a/sc4pd/source/GrayNoise.cpp +++ b/sc4pd/source/GrayNoise.cpp @@ -40,9 +40,9 @@ /* ------------------------ GrayNoise~ -------------------------------*/ class GrayNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(GrayNoise_ar,flext_dsp); + FLEXT_HEADER(GrayNoise_ar,sc4pd_dsp); public: GrayNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Hasher.cpp b/sc4pd/source/Hasher.cpp index 8c43c8c..1fc8085 100644 --- a/sc4pd/source/Hasher.cpp +++ b/sc4pd/source/Hasher.cpp @@ -35,14 +35,14 @@ */ -#include "support.hpp" +#include "sc4pd.hpp" /* ------------------------ Hasher~ -----------------------------------*/ class Hasher_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Hasher_ar,flext_dsp); + FLEXT_HEADER(Hasher_ar,sc4pd_dsp); public: Hasher_ar(); diff --git a/sc4pd/source/IRand.cpp b/sc4pd/source/IRand.cpp index 18cf125..8b5c723 100644 --- a/sc4pd/source/IRand.cpp +++ b/sc4pd/source/IRand.cpp @@ -40,9 +40,9 @@ /* ------------------------ IRand~ -------------------------------*/ class IRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(IRand_ar,flext_dsp); + FLEXT_HEADER(IRand_ar,sc4pd_dsp); public: IRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Impulse.cpp b/sc4pd/source/Impulse.cpp index dbb07e2..86ca165 100644 --- a/sc4pd/source/Impulse.cpp +++ b/sc4pd/source/Impulse.cpp @@ -41,9 +41,9 @@ /* ------------------------ Impulse~ -------------------------------*/ class Impulse_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Impulse_ar,flext_dsp); + FLEXT_HEADER(Impulse_ar,sc4pd_dsp); public: Impulse_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Integrator.cpp b/sc4pd/source/Integrator.cpp index 97d2766..85253ee 100644 --- a/sc4pd/source/Integrator.cpp +++ b/sc4pd/source/Integrator.cpp @@ -40,9 +40,9 @@ /* ------------------------ Integrator~ -----------------------------*/ class Integrator_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Integrator_ar,flext_dsp); + FLEXT_HEADER(Integrator_ar,sc4pd_dsp); public: Integrator_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/LFClipNoise.cpp b/sc4pd/source/LFClipNoise.cpp index 60f5049..1583431 100644 --- a/sc4pd/source/LFClipNoise.cpp +++ b/sc4pd/source/LFClipNoise.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFClipNoise~ -------------------------------*/ class LFClipNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFClipNoise_ar,flext_dsp); + FLEXT_HEADER(LFClipNoise_ar,sc4pd_dsp); public: LFClipNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LFNoise0.cpp b/sc4pd/source/LFNoise0.cpp index a548e9e..9ee9ff6 100644 --- a/sc4pd/source/LFNoise0.cpp +++ b/sc4pd/source/LFNoise0.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFNoise0~ -------------------------------*/ class LFNoise0_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFNoise0_ar,flext_dsp); + FLEXT_HEADER(LFNoise0_ar,sc4pd_dsp); public: LFNoise0_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LFNoise1.cpp b/sc4pd/source/LFNoise1.cpp index d80b55b..c164942 100644 --- a/sc4pd/source/LFNoise1.cpp +++ b/sc4pd/source/LFNoise1.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFNoise1~ -------------------------------*/ class LFNoise1_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFNoise1_ar,flext_dsp); + FLEXT_HEADER(LFNoise1_ar,sc4pd_dsp); public: LFNoise1_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LFNoise2.cpp b/sc4pd/source/LFNoise2.cpp index 891a0f3..3b1fd37 100644 --- a/sc4pd/source/LFNoise2.cpp +++ b/sc4pd/source/LFNoise2.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFNoise2~ -------------------------------*/ class LFNoise2_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFNoise2_ar,flext_dsp); + FLEXT_HEADER(LFNoise2_ar,sc4pd_dsp); public: LFNoise2_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LFPulse.cpp b/sc4pd/source/LFPulse.cpp index 020fb57..ad16e65 100644 --- a/sc4pd/source/LFPulse.cpp +++ b/sc4pd/source/LFPulse.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFPulse~ -------------------------------*/ class LFPulse_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFPulse_ar,flext_dsp); + FLEXT_HEADER(LFPulse_ar,sc4pd_dsp); public: LFPulse_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LFSaw.cpp b/sc4pd/source/LFSaw.cpp index c442a89..0e406d0 100644 --- a/sc4pd/source/LFSaw.cpp +++ b/sc4pd/source/LFSaw.cpp @@ -41,9 +41,9 @@ /* ------------------------ LFSaw~ -------------------------------*/ class LFSaw_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LFSaw_ar,flext_dsp); + FLEXT_HEADER(LFSaw_ar,sc4pd_dsp); public: LFSaw_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Lag.cpp b/sc4pd/source/Lag.cpp index 81482a8..5daf6d1 100644 --- a/sc4pd/source/Lag.cpp +++ b/sc4pd/source/Lag.cpp @@ -40,9 +40,9 @@ /* ------------------------ Lag~ -----------------------------*/ class Lag_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Lag_ar,flext_dsp); + FLEXT_HEADER(Lag_ar,sc4pd_dsp); public: Lag_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/Lag2.cpp b/sc4pd/source/Lag2.cpp index 2e3096b..dc85fcb 100644 --- a/sc4pd/source/Lag2.cpp +++ b/sc4pd/source/Lag2.cpp @@ -40,9 +40,9 @@ /* ------------------------ Lag2~ -----------------------------*/ class Lag2_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Lag2_ar,flext_dsp); + FLEXT_HEADER(Lag2_ar,sc4pd_dsp); public: Lag2_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/Lag3.cpp b/sc4pd/source/Lag3.cpp index bedd625..8865555 100644 --- a/sc4pd/source/Lag3.cpp +++ b/sc4pd/source/Lag3.cpp @@ -40,9 +40,9 @@ /* ------------------------ Lag3~ -----------------------------*/ class Lag3_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Lag3_ar,flext_dsp); + FLEXT_HEADER(Lag3_ar,sc4pd_dsp); public: Lag3_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/Latoocarfian.cpp b/sc4pd/source/Latoocarfian.cpp index 3fdb0b2..1e20632 100644 --- a/sc4pd/source/Latoocarfian.cpp +++ b/sc4pd/source/Latoocarfian.cpp @@ -41,9 +41,9 @@ /* ------------------------ Latoocarfian~ -------------------------------*/ class Latoocarfian_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Latoocarfian_ar,flext_dsp); + FLEXT_HEADER(Latoocarfian_ar,sc4pd_dsp); public: Latoocarfian_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LinCong.cpp b/sc4pd/source/LinCong.cpp index 4f0b327..fdead9c 100644 --- a/sc4pd/source/LinCong.cpp +++ b/sc4pd/source/LinCong.cpp @@ -41,9 +41,9 @@ /* ------------------------ LinCong~ -------------------------------*/ class LinCong_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LinCong_ar,flext_dsp); + FLEXT_HEADER(LinCong_ar,sc4pd_dsp); public: LinCong_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/LinExp.cpp b/sc4pd/source/LinExp.cpp index 6be19f3..69e9e0a 100644 --- a/sc4pd/source/LinExp.cpp +++ b/sc4pd/source/LinExp.cpp @@ -42,9 +42,9 @@ /* ------------------------ LinExp~ -----------------------------*/ class LinExp_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(LinExp_ar,flext_dsp); + FLEXT_HEADER(LinExp_ar,sc4pd_dsp); public: LinExp_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/LinRand.cpp b/sc4pd/source/LinRand.cpp index f5acb00..80266f1 100644 --- a/sc4pd/source/LinRand.cpp +++ b/sc4pd/source/LinRand.cpp @@ -41,9 +41,9 @@ /* ------------------------ LinRand~ -------------------------------*/ class LinRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(LinRand_ar,flext_dsp); + FLEXT_HEADER(LinRand_ar,sc4pd_dsp); public: LinRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/Logistic.cpp b/sc4pd/source/Logistic.cpp index 89c6c2e..a956fda 100644 --- a/sc4pd/source/Logistic.cpp +++ b/sc4pd/source/Logistic.cpp @@ -41,9 +41,9 @@ /* ------------------------ Logistic~ -------------------------------*/ class Logistic_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Logistic_ar,flext_dsp); + FLEXT_HEADER(Logistic_ar,sc4pd_dsp); public: Logistic_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/MantissaMask.cpp b/sc4pd/source/MantissaMask.cpp index dfbf605..c7c70c2 100644 --- a/sc4pd/source/MantissaMask.cpp +++ b/sc4pd/source/MantissaMask.cpp @@ -35,14 +35,14 @@ */ -#include "support.hpp" +#include "sc4pd.hpp" /* ------------------------ MantissaMask~ -----------------------------*/ class MantissaMask_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(MantissaMask_ar,flext_dsp); + FLEXT_HEADER(MantissaMask_ar,sc4pd_dsp); public: MantissaMask_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/Median.cpp b/sc4pd/source/Median.cpp index f15ce63..f89f934 100644 --- a/sc4pd/source/Median.cpp +++ b/sc4pd/source/Median.cpp @@ -107,9 +107,9 @@ inline float median_shared::Insert(float value) /* ------------------------ Median~ -----------------------------------*/ class Median_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Median_ar,flext_dsp); + FLEXT_HEADER(Median_ar,sc4pd_dsp); public: Median_ar(int argc, t_atom * argv); @@ -166,9 +166,9 @@ void Median_ar::m_signal(int n, t_sample *const *in, t_sample *const *out) /* ------------------------ Median ------------------------------------*/ class Median_kr - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(Median_kr,flext_dsp); + FLEXT_HEADER(Median_kr,sc4pd_dsp); public: Median_kr(int argc, t_atom * argv); diff --git a/sc4pd/source/NRand.cpp b/sc4pd/source/NRand.cpp index 84a4374..e91ad71 100644 --- a/sc4pd/source/NRand.cpp +++ b/sc4pd/source/NRand.cpp @@ -41,9 +41,9 @@ /* ------------------------ NRand~ -------------------------------*/ class NRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(NRand_ar,flext_dsp); + FLEXT_HEADER(NRand_ar,sc4pd_dsp); public: NRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/PinkNoise.cpp b/sc4pd/source/PinkNoise.cpp index 513d02a..296f383 100644 --- a/sc4pd/source/PinkNoise.cpp +++ b/sc4pd/source/PinkNoise.cpp @@ -40,9 +40,9 @@ /* ------------------------ PinkNoise~ -------------------------------*/ class PinkNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(PinkNoise_ar,flext_dsp); + FLEXT_HEADER(PinkNoise_ar,sc4pd_dsp); public: PinkNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/PitchShift.cpp b/sc4pd/source/PitchShift.cpp index d182681..8a3f265 100644 --- a/sc4pd/source/PitchShift.cpp +++ b/sc4pd/source/PitchShift.cpp @@ -31,7 +31,7 @@ SuperCollider by James McCartney http://www.audiosynth.com - Coded while listening to: + Coded while listening to: Bernhard Lang: Differenz / Wiederholung 2 */ @@ -40,9 +40,9 @@ /* ------------------------ PitchShift~ -----------------------------*/ class PitchShift_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(PitchShift_ar,flext_dsp); + FLEXT_HEADER(PitchShift_ar,sc4pd_dsp); public: PitchShift_ar(int argc,t_atom * argv); @@ -55,11 +55,6 @@ protected: virtual void m_dsp(int n, t_sample *const *in, t_sample *const *out); - void m_set_windowsize(float f) - { - m_windowsize = f; - } - void m_set_pitchratio (float f) { m_pitchratio = f; @@ -76,7 +71,7 @@ protected: } private: - float m_windowsize, m_pitchratio,m_pitchdispersion,m_timedispersion; + float m_windowsize,m_pitchratio,m_pitchdispersion,m_timedispersion; RGen rgen; @@ -93,7 +88,6 @@ private: DEFSIGFUN(m_signal_); DEFSIGFUN(m_signal_z); - FLEXT_CALLBACK_F(m_set_windowsize); FLEXT_CALLBACK_F(m_set_pitchratio); FLEXT_CALLBACK_F(m_set_pitchdispersion); FLEXT_CALLBACK_F(m_set_timedispersion); @@ -103,7 +97,6 @@ FLEXT_LIB_DSP_V("PitchShift~",PitchShift_ar); PitchShift_ar::PitchShift_ar(int argc,t_atom * argv) { - FLEXT_ADDMETHOD_(0,"windowSize",m_set_windowsize); FLEXT_ADDMETHOD_(0,"pitchRatio",m_set_pitchratio); FLEXT_ADDMETHOD_(0,"pitchDispersion",m_set_pitchdispersion); FLEXT_ADDMETHOD_(0,"timeDispersion",m_set_timedispersion); @@ -115,6 +108,7 @@ PitchShift_ar::PitchShift_ar(int argc,t_atom * argv) post("4 arguments needed"); return; } + m_windowsize = sc_getfloatarg(Args,0); m_pitchratio = sc_getfloatarg(Args,1); m_pitchdispersion = sc_getfloatarg(Args,2); @@ -132,17 +126,16 @@ void PitchShift_ar::m_dsp(int n, t_sample *const *in, t_sample *const *out) /* initialization from PitchShift_Ctor(PitchShift *unit) */ long delaybufsize; - float /* *out, *in,*/ *dlybuf; - float winsize, pchratio; + float *dlybuf; + float pchratio; float fdelaylen, slope; long framesize, last; //out = ZOUT(0); //in = ZIN(0); pchratio = m_pitchratio; - winsize = m_windowsize; - delaybufsize = (long)ceil(winsize * SAMPLERATE * 3.f + 3.f); + delaybufsize = (long)ceil(m_windowsize * SAMPLERATE * 3.f + 3.f); fdelaylen = delaybufsize - 3; delaybufsize = delaybufsize + BUFLENGTH; @@ -159,7 +152,7 @@ void PitchShift_ar::m_dsp(int n, t_sample *const *in, t_sample *const *out) m_numoutput = 0; m_mask = last = (delaybufsize - 1); - m_framesize = framesize = ((long)(winsize * SAMPLERATE) + 2) & ~3; + m_framesize = framesize = ((long)(m_windowsize * SAMPLERATE) + 2) & ~3; m_slope = slope = 2.f / framesize; m_stage = 3; m_counter = framesize >> 2; @@ -197,7 +190,7 @@ void PitchShift_ar::m_signal_z(int n, t_sample *const *in, float dsamp3, dsamp3_slope, ramp3, ramp3_slope; float dsamp4, dsamp4_slope, ramp4, ramp4_slope; float fdelaylen, d1, d2, frac, slope, samp_slope, startpos, - winsize, pchdisp, timedisp; + pchdisp, timedisp; long remain, nsmps, idelaylen, irdphase, irdphaseb, iwrphase; long mask, idsamp; long counter, stage, framesize, numoutput; @@ -208,10 +201,9 @@ void PitchShift_ar::m_signal_z(int n, t_sample *const *in, nin = *in; pchratio = m_pitchratio; - winsize = m_windowsize; pchdisp = m_pitchdispersion; timedisp = m_timedispersion; - timedisp = sc_clip(timedisp, 0.f, winsize) * SAMPLERATE; + timedisp = sc_clip(timedisp, 0.f, m_windowsize) * SAMPLERATE; dlybuf = m_dlybuf; fdelaylen = m_fdelaylen; @@ -466,7 +458,7 @@ void PitchShift_ar::m_signal_(int n, t_sample *const *in, float dsamp3, dsamp3_slope, ramp3, ramp3_slope; float dsamp4, dsamp4_slope, ramp4, ramp4_slope; float fdelaylen, d1, d2, frac, slope, samp_slope, startpos, - winsize, pchdisp, timedisp; + pchdisp, timedisp; long remain, nsmps, idelaylen, irdphase, irdphaseb, iwrphase, mask, idsamp; long counter, stage, framesize; @@ -476,11 +468,10 @@ void PitchShift_ar::m_signal_(int n, t_sample *const *in, nin = *in; pchratio = m_pitchratio; - winsize = m_windowsize; pchdisp = m_pitchdispersion; timedisp = m_timedispersion; - timedisp = sc_clip(timedisp, 0.f, winsize) * SAMPLERATE; + timedisp = sc_clip(timedisp, 0.f, m_windowsize) * SAMPLERATE; dlybuf = m_dlybuf; fdelaylen = m_fdelaylen; @@ -635,4 +626,4 @@ void PitchShift_ar::m_signal_(int n, t_sample *const *in, } -/* todo: does a control rate PitchShift make sense? */ +/* a control rate PitchShift doesn't make sense */ diff --git a/sc4pd/source/Rand.cpp b/sc4pd/source/Rand.cpp index 791db68..c310aa9 100644 --- a/sc4pd/source/Rand.cpp +++ b/sc4pd/source/Rand.cpp @@ -41,9 +41,9 @@ /* ------------------------ Rand~ -------------------------------*/ class Rand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(Rand_ar,flext_dsp); + FLEXT_HEADER(Rand_ar,sc4pd_dsp); public: Rand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/TExpRand.cpp b/sc4pd/source/TExpRand.cpp index 6e2b1c6..a0087e7 100644 --- a/sc4pd/source/TExpRand.cpp +++ b/sc4pd/source/TExpRand.cpp @@ -41,9 +41,9 @@ /* ------------------------ TExpRand~ -------------------------------*/ class TExpRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(TExpRand_ar,flext_dsp); + FLEXT_HEADER(TExpRand_ar,sc4pd_dsp); public: TExpRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/TIRand.cpp b/sc4pd/source/TIRand.cpp index 1995e46..1c59a6e 100644 --- a/sc4pd/source/TIRand.cpp +++ b/sc4pd/source/TIRand.cpp @@ -41,9 +41,9 @@ /* ------------------------ TIRand~ -------------------------------*/ class TIRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(TIRand_ar,flext_dsp); + FLEXT_HEADER(TIRand_ar,sc4pd_dsp); public: TIRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/TRand.cpp b/sc4pd/source/TRand.cpp index d761dc4..d54c196 100644 --- a/sc4pd/source/TRand.cpp +++ b/sc4pd/source/TRand.cpp @@ -41,9 +41,9 @@ /* ------------------------ TRand~ -------------------------------*/ class TRand_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(TRand_ar,flext_dsp); + FLEXT_HEADER(TRand_ar,sc4pd_dsp); public: TRand_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/WhiteNoise.cpp b/sc4pd/source/WhiteNoise.cpp index 779cb2f..5def735 100644 --- a/sc4pd/source/WhiteNoise.cpp +++ b/sc4pd/source/WhiteNoise.cpp @@ -41,9 +41,9 @@ /* ------------------------ WhiteNoise~ -------------------------------*/ class WhiteNoise_ar: - public flext_dsp + public sc4pd_dsp { - FLEXT_HEADER(WhiteNoise_ar,flext_dsp); + FLEXT_HEADER(WhiteNoise_ar,sc4pd_dsp); public: WhiteNoise_ar(int argc, t_atom *argv); diff --git a/sc4pd/source/absdif.cpp b/sc4pd/source/absdif.cpp index 1af9473..e31a3dd 100644 --- a/sc4pd/source/absdif.cpp +++ b/sc4pd/source/absdif.cpp @@ -48,9 +48,9 @@ inline float sc_absdif (float a, float b) /* ------------------------ absdif~ -----------------------------*/ class absdif_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(absdif_ar,flext_dsp); + FLEXT_HEADER(absdif_ar,sc4pd_dsp); public: absdif_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/amclip.cpp b/sc4pd/source/amclip.cpp index 4a3b194..8bd2edf 100644 --- a/sc4pd/source/amclip.cpp +++ b/sc4pd/source/amclip.cpp @@ -41,9 +41,9 @@ /* ------------------------ amclip~ -----------------------------*/ class amclip_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(amclip_ar,flext_dsp); + FLEXT_HEADER(amclip_ar,sc4pd_dsp); public: amclip_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/difsqr.cpp b/sc4pd/source/difsqr.cpp index 807eefc..26051f4 100644 --- a/sc4pd/source/difsqr.cpp +++ b/sc4pd/source/difsqr.cpp @@ -47,9 +47,9 @@ inline float sc_difsqr (float a, float b) /* ------------------------ difsqr~ -----------------------------*/ class difsqr_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(difsqr_ar,flext_dsp); + FLEXT_HEADER(difsqr_ar,sc4pd_dsp); public: difsqr_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/excess.cpp b/sc4pd/source/excess.cpp index 2aca853..eeefb3d 100644 --- a/sc4pd/source/excess.cpp +++ b/sc4pd/source/excess.cpp @@ -40,9 +40,9 @@ /* ------------------------ excess~ -----------------------------*/ class excess_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(excess_ar,flext_dsp); + FLEXT_HEADER(excess_ar,sc4pd_dsp); public: excess_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/hypot.cpp b/sc4pd/source/hypot.cpp index 1e2dd1a..83f9a89 100644 --- a/sc4pd/source/hypot.cpp +++ b/sc4pd/source/hypot.cpp @@ -41,9 +41,9 @@ /* ------------------------ hypot~ -----------------------------*/ class hypot_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(hypot_ar,flext_dsp); + FLEXT_HEADER(hypot_ar,sc4pd_dsp); public: hypot_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/main.cpp b/sc4pd/source/main.cpp index 332afa8..8f0eafa 100644 --- a/sc4pd/source/main.cpp +++ b/sc4pd/source/main.cpp @@ -62,7 +62,7 @@ void sc4pd_library_setup() "DelayN~,\n" " DelayL~, DelayC~, CombN~, CombL~, CombC~, AllpassN~, " "AllpassL~,\n" - " AllpassC~, PitchShift~" + " AllpassC~, PitchShift~, Resonz~, OnePole(~)" "\n" ); @@ -228,6 +228,13 @@ void sc4pd_library_setup() FLEXT_DSP_SETUP(AllpassL_ar); FLEXT_DSP_SETUP(AllpassC_ar); + + FLEXT_DSP_SETUP(PitchShift_ar); + + FLEXT_DSP_SETUP(Resonz_ar); + + FLEXT_DSP_SETUP(OnePole_ar); + FLEXT_SETUP(OnePole_kr); } FLEXT_LIB_SETUP(sc4pd,sc4pd_library_setup); diff --git a/sc4pd/source/ring1.cpp b/sc4pd/source/ring1.cpp index f3bce43..9c09e40 100644 --- a/sc4pd/source/ring1.cpp +++ b/sc4pd/source/ring1.cpp @@ -46,9 +46,9 @@ inline float sc_ring1 (float a, float b) /* ------------------------ ring1~ -----------------------------*/ class ring1_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(ring1_ar,flext_dsp); + FLEXT_HEADER(ring1_ar,sc4pd_dsp); public: ring1_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/ring2.cpp b/sc4pd/source/ring2.cpp index e5c48cf..c2432e9 100644 --- a/sc4pd/source/ring2.cpp +++ b/sc4pd/source/ring2.cpp @@ -46,9 +46,9 @@ inline float sc_ring2 (float a, float b) /* ------------------------ ring2~ -----------------------------*/ class ring2_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(ring2_ar,flext_dsp); + FLEXT_HEADER(ring2_ar,sc4pd_dsp); public: ring2_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/ring3.cpp b/sc4pd/source/ring3.cpp index adb13c2..d8de166 100644 --- a/sc4pd/source/ring3.cpp +++ b/sc4pd/source/ring3.cpp @@ -46,9 +46,9 @@ inline float sc_ring3 (float a, float b) /* ------------------------ ring3~ -----------------------------*/ class ring3_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(ring3_ar,flext_dsp); + FLEXT_HEADER(ring3_ar,sc4pd_dsp); public: ring3_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/ring4.cpp b/sc4pd/source/ring4.cpp index 5bd2af4..f9c6035 100644 --- a/sc4pd/source/ring4.cpp +++ b/sc4pd/source/ring4.cpp @@ -47,9 +47,9 @@ inline float sc_ring4 (float a, float b) /* ------------------------ ring4~ -----------------------------*/ class ring4_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(ring4_ar,flext_dsp); + FLEXT_HEADER(ring4_ar,sc4pd_dsp); public: ring4_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/sc4pd.hpp b/sc4pd/source/sc4pd.hpp index f1f90e2..eacbfff 100644 --- a/sc4pd/source/sc4pd.hpp +++ b/sc4pd/source/sc4pd.hpp @@ -35,7 +35,6 @@ */ #ifndef _SC4PD_HPP -#define _SC$PD_HPP #include <flext.h> @@ -63,8 +62,6 @@ #undef BUFLENGTH #define BUFLENGTH Blocksize() - - /* to make sure the behaviour is consistent: */ #undef ZXP @@ -72,6 +69,60 @@ - - +class sc4pd_dsp + : public flext_dsp +{ + FLEXT_HEADER(sc4pd_dsp,flext_dsp); + + +/* some initialisation functions, adapted from SC_Rate.cpp*/ + + inline float sc_sampledur() + { + return 1 / Samplerate(); + } + + inline float sc_radianspersample() + { + return twopi / Samplerate(); + } + + inline float sc_bufduration() + { + return Blocksize() / Samplerate(); + } + + inline float sc_bufrate() + { + return 1 / sc_bufduration(); + } + + inline float sc_slopefactor() + { + return 1 / Blocksize(); + } + + inline float sc_filterloops() + { + return Blocksize() / 3; + } + + inline float sc_filterremain() + { + return Blocksize() % 3; + } + + inline float sc_filterslope() + { + float f = sc_filterloops(); + if (f == 0) + return 0; + else + return 1. / f; + } + +}; + + +#define _SC$PD_HPP #endif diff --git a/sc4pd/source/scaleneg.cpp b/sc4pd/source/scaleneg.cpp index abd316f..d91b324 100644 --- a/sc4pd/source/scaleneg.cpp +++ b/sc4pd/source/scaleneg.cpp @@ -41,9 +41,9 @@ /* ------------------------ scaleneg~ -----------------------------*/ class scaleneg_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(scaleneg_ar,flext_dsp); + FLEXT_HEADER(scaleneg_ar,sc4pd_dsp); public: scaleneg_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/sqrdif.cpp b/sc4pd/source/sqrdif.cpp index 2762fe5..165ee2b 100644 --- a/sc4pd/source/sqrdif.cpp +++ b/sc4pd/source/sqrdif.cpp @@ -48,9 +48,9 @@ inline float sc_sqrdif (float a, float b) /* ------------------------ sqrdif~ -----------------------------*/ class sqrdif_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(sqrdif_ar,flext_dsp); + FLEXT_HEADER(sqrdif_ar,sc4pd_dsp); public: sqrdif_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/sqrsum.cpp b/sc4pd/source/sqrsum.cpp index 265c909..756c07e 100644 --- a/sc4pd/source/sqrsum.cpp +++ b/sc4pd/source/sqrsum.cpp @@ -48,9 +48,9 @@ inline float sc_sqrsum (float a, float b) /* ------------------------ sqrsum~ -----------------------------*/ class sqrsum_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(sqrsum_ar,flext_dsp); + FLEXT_HEADER(sqrsum_ar,sc4pd_dsp); public: sqrsum_ar(int argc,t_atom * argv); diff --git a/sc4pd/source/sumsqr.cpp b/sc4pd/source/sumsqr.cpp index 4b2564d..518eb01 100644 --- a/sc4pd/source/sumsqr.cpp +++ b/sc4pd/source/sumsqr.cpp @@ -47,9 +47,9 @@ inline float sc_sumsqr (float a, float b) /* ------------------------ sumsqr~ -----------------------------*/ class sumsqr_ar - :public flext_dsp + :public sc4pd_dsp { - FLEXT_HEADER(sumsqr_ar,flext_dsp); + FLEXT_HEADER(sumsqr_ar,sc4pd_dsp); public: sumsqr_ar(int argc,t_atom * argv); |