[SCM] calf/master: + Reverb: added diffusion and room size, perhaps it's not enough (a highpass filter would be nice too!)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:36:55 UTC 2013
The following commit has been merged in the master branch:
commit 5f77425c4f67916ad953ee2cf800b188ca7fc0f1
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sun Jan 6 14:21:37 2008 +0000
+ Reverb: added diffusion and room size, perhaps it's not enough (a highpass filter would be nice too!)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@77 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/audio_fx.h b/src/calf/audio_fx.h
index 0b5ab3b..c5c4e76 100644
--- a/src/calf/audio_fx.h
+++ b/src/calf/audio_fx.h
@@ -253,7 +253,8 @@ class reverb: public audio_effect
sine_table<int, 128, 10000> sine;
onepole<T> lp_left, lp_right;
T old_left, old_right;
- float time, fb, cutoff;
+ int type;
+ float time, fb, cutoff, diffusion;
int tl[6], tr[6];
float ldec[6], rdec[6];
@@ -264,6 +265,8 @@ public:
phase = 0.0;
time = 1.0;
cutoff = 9000;
+ type = 2;
+ diffusion = 1.f;
setup(44100);
}
virtual void setup(int sample_rate) {
@@ -272,21 +275,51 @@ public:
set_cutoff(cutoff);
phase = 0.0;
dphase = 0.5*128/sr;
-
- tl[0] = 697 << 16, tr[0] = 783 << 16;
- tl[1] = 957 << 16, tr[1] = 929 << 16;
- tl[2] = 649 << 16, tr[2] = 531 << 16;
- tl[3] = 1249 << 16, tr[3] = 1377 << 16;
- tl[4] = 1573 << 16, tr[4] = 1671 << 16;
- tl[5] = 1877 << 16, tr[5] = 1781 << 16;
+ update_times();
+ }
+ void update_times()
+ {
+ switch(type)
+ {
+ case 0:
+ tl[0] = 397 << 16, tr[0] = 383 << 16;
+ tl[1] = 457 << 16, tr[1] = 429 << 16;
+ tl[2] = 549 << 16, tr[2] = 631 << 16;
+ tl[3] = 649 << 16, tr[3] = 756 << 16;
+ tl[4] = 773 << 16, tr[4] = 803 << 16;
+ tl[5] = 877 << 16, tr[5] = 901 << 16;
+ break;
+ case 1:
+ tl[0] = 697 << 16, tr[0] = 783 << 16;
+ tl[1] = 957 << 16, tr[1] = 929 << 16;
+ tl[2] = 649 << 16, tr[2] = 531 << 16;
+ tl[3] = 1049 << 16, tr[3] = 1177 << 16;
+ tl[4] = 473 << 16, tr[4] = 501 << 16;
+ tl[5] = 587 << 16, tr[5] = 681 << 16;
+ break;
+ case 2:
+ default:
+ tl[0] = 697 << 16, tr[0] = 783 << 16;
+ tl[1] = 957 << 16, tr[1] = 929 << 16;
+ tl[2] = 649 << 16, tr[2] = 531 << 16;
+ tl[3] = 1249 << 16, tr[3] = 1377 << 16;
+ tl[4] = 1573 << 16, tr[4] = 1671 << 16;
+ tl[5] = 1877 << 16, tr[5] = 1781 << 16;
+ break;
+ case 3:
+ tl[0] = 1097 << 16, tr[0] = 1087 << 16;
+ tl[1] = 1057 << 16, tr[1] = 1031 << 16;
+ tl[2] = 1049 << 16, tr[2] = 1039 << 16;
+ tl[3] = 1083 << 16, tr[3] = 1055 << 16;
+ tl[4] = 1075 << 16, tr[4] = 1099 << 16;
+ tl[5] = 1003 << 16, tr[5] = 1073 << 16;
+ break;
+ }
- float fDec=1700.f;
- ldec[0]=exp(-697.f/fDec), rdec[0]=exp(-783.f/fDec);
- ldec[1]=exp(-975.f/fDec), rdec[1]=exp(-929.f/fDec);
- ldec[2]=exp(-649.f/fDec), rdec[2]=exp(-531.f/fDec);
- ldec[3]=exp(-1249.f/fDec), rdec[3]=exp(-1377.f/fDec);
- ldec[4]=exp(-1573.f/fDec), rdec[4]=exp(-1671.f/fDec);
- ldec[5]=exp(-1877.f/fDec), rdec[5]=exp(-1781.f/fDec);
+ float fDec=1000 + 1400.f * diffusion;
+ for (int i = 0 ; i < 6; i++)
+ ldec[i]=exp(-float(tl[i] >> 16) / fDec),
+ rdec[i]=exp(-float(tr[i] >> 16) / fDec);
}
float get_time() {
return time;
@@ -296,6 +329,25 @@ public:
// fb = pow(1.0f/4096.0f, (float)(1700/(time*sr)));
fb = 1.0 - 0.3 / (time * sr / 44100.0);
}
+ float get_type() {
+ return type;
+ }
+ void set_type(int type) {
+ this->type = type;
+ update_times();
+ }
+ float get_diffusion() {
+ return diffusion;
+ }
+ void set_diffusion(float diffusion) {
+ this->diffusion = diffusion;
+ update_times();
+ }
+ void set_type_and_diffusion(int type, float diffusion) {
+ this->type = type;
+ this->diffusion = diffusion;
+ update_times();
+ }
float get_fb()
{
return this->fb;
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 041b93b..3292eee 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -116,7 +116,7 @@ public:
class reverb_audio_module: public null_audio_module
{
public:
- enum { par_decay, par_hfdamp, par_amount, param_count };
+ enum { par_decay, par_hfdamp, par_roomsize, par_diffusion, par_amount, param_count };
enum { in_count = 2, out_count = 2, support_midi = false, rt_capable = true };
static const char *port_names[];
dsp::reverb<float> reverb;
@@ -129,6 +129,7 @@ public:
void params_changed() {
//reverb.set_time(0.5*pow(8.0f, *params[par_decay]));
//reverb.set_cutoff(2000*pow(10.0f, *params[par_hfdamp]));
+ reverb.set_type_and_diffusion(fastf2i_drm(*params[par_roomsize]), *params[par_diffusion]);
reverb.set_time(*params[par_decay]);
reverb.set_cutoff(*params[par_hfdamp]);
}
diff --git a/src/modules.cpp b/src/modules.cpp
index dbce083..471cdaf 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -65,9 +65,13 @@ static synth::ladspa_wrapper<flanger_audio_module> flanger(flanger_info);
const char *reverb_audio_module::port_names[] = {"In L", "In R", "Out L", "Out R"};
+const char *reverb_room_sizes[] = { "Small", "Medium", "Large", "Tunnel-like" };
+
parameter_properties reverb_audio_module::param_props[] = {
{ 1.5, 0.5, 15.0, 1.01, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_SEC, NULL, "decay_time", "Decay time" },
{ 5000, 2000,20000, 1.01, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "hf_damp", "High Frq Damp" },
+ { 2, 0, 3, 1.01, PF_ENUM | PF_CTL_COMBO , reverb_room_sizes, "room_size", "Room size", },
+ { 0.5, 0, 1, 1.01, PF_FLOAT | PF_CTL_KNOB | PF_SCALE_PERC, NULL, "diffusion", "Diffusion" },
{ 0.25, 0, 2, 1.1, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "amount", "Amount" },
};
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list