History

added mix parameter to Spectacle

Joel Matthys committed 12 years ago

Commit 6c5a1241 parent c6cc5e15 files · +44 −273Browse files

Showing the changes to Spectacle/Spectacle.cpp (1 of 5 files). Show all

Unified · Split

Spectacle/Spectacle.cpp+42−0
@@ -58,6 +58,9 @@ CK_DLL_MFUN(spectacle_getMinFreq); · 57 unmodified lines
5858 CK_DLL_MFUN(spectacle_setMaxFreq);
5959 CK_DLL_MFUN(spectacle_getMaxFreq);
6060
61+CK_DLL_MFUN(spectacle_setMix);
62+CK_DLL_MFUN(spectacle_getMix);
63+
6164 CK_DLL_MFUN(spectacle_setFreqRange);
6265
6366 CK_DLL_MFUN(spectacle_setTable);
@@ -103,6 +106,7 @@ public: · 39 unmodified lines
103106 maxdeltime = CLIP(maxdeltime, kMinMaxDelTime, kMaxMaxDelTime);
104107 mindeltime = 0.0;
105108 srate = fs;
109+ mix = 1.0;
106110 spectdelay = NULL;
107111 float *del = dttable;
108112 float *eq = eqtable;
@@ -137,6 +141,8 @@ public: · 28 unmodified lines
137141 {
138142 spectdelay->run(in+i, out+i, 1);
139143 spectdelay->run(in+i, out+i+1, 1);
144+ out[i] = out[i] * mix + in[i] * (1-mix);
145+ out[i+1] = out[i+1] * mix + in[i+1] * (1-mix);
140146 }
141147 // process a block of samples
142148 //spectdelay->run(in, out, nframes);
@@ -270,6 +276,14 @@ public: · 127 unmodified lines
270276
271277 float getMaxFreq () { return maxfreq; }
272278
279+ float setMix ( t_CKFLOAT p )
280+ {
281+ mix = CLIP(p,0,1);
282+ return mix;
283+ }
284+
285+ float getMix () { return mix; }
286+
273287 void setFreqRange ( t_CKFLOAT q, t_CKFLOAT p )
274288 {
275289 const float nyquist = srate / 2;
@@ -396,6 +410,7 @@ private: · 120 unmodified lines
396410 int eqtablen, dttablen, fbtablen;
397411 float minfreq, maxfreq;
398412 bool hold, posteq;
413+ float mix;
399414
400415 void setDelayTable (int type)
401416 {
@@ -554,6 +569,14 @@ CK_DLL_QUERY( Spectacle ) · 152 unmodified lines
554569 // example of adding getter method
555570 QUERY->add_mfun(QUERY, spectacle_getMaxFreq, "float", "freqMax");
556571
572+ // example of adding setter method
573+ QUERY->add_mfun(QUERY, spectacle_setMix, "float", "mix");
574+ // example of adding argument to the above method
575+ QUERY->add_arg(QUERY, "float", "mix");
576+
577+ // example of adding getter method
578+ QUERY->add_mfun(QUERY, spectacle_getMix, "float", "mix");
579+
557580 // example of adding setter method
558581 QUERY->add_mfun(QUERY, spectacle_setFreqRange, "void", "range");
559582 // example of adding argument to the above method
@@ -800,6 +823,25 @@ CK_DLL_MFUN(spectacle_getMaxFreq) · 240 unmodified lines
800823 RETURN->v_float = bcdata->getMaxFreq();
801824 }
802825
826+// example implementation for setter
827+CK_DLL_MFUN(spectacle_setMix)
828+{
829+ // get our c++ class pointer
830+ Spectacle * bcdata = (Spectacle *) OBJ_MEMBER_INT(SELF, spectacle_data_offset);
831+ // set the return value
832+ RETURN->v_float = bcdata->setMix(GET_NEXT_FLOAT(ARGS));
833+}
834+
835+
836+// example implementation for getter
837+CK_DLL_MFUN(spectacle_getMix)
838+{
839+ // get our c++ class pointer
840+ Spectacle * bcdata = (Spectacle *) OBJ_MEMBER_INT(SELF, spectacle_data_offset);
841+ // set the return value
842+ RETURN->v_float = bcdata->getMix();
843+}
844+
803845 // example implementation for setter
804846 CK_DLL_MFUN(spectacle_setFreqRange)
805847 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t