[SCM] calf/master: + Organ: added filter chaining feature (to compensate for the fact the filters are of cheap 12dB/oct variety)
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:12 UTC 2013
The following commit has been merged in the master branch:
commit ef48e2896b3813499e81ff9f5535da30ccab80ce
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Sat May 10 22:05:31 2008 +0000
+ Organ: added filter chaining feature (to compensate for the fact the filters are of cheap 12dB/oct variety)
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@174 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 2dacf85..327072a 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -54,6 +54,7 @@ struct organ_parameters {
float percussion_level;
float percussion_timbre;
float percussion_trigger;
+ float filter_chain;
float master;
organ_filter_parameters filters[organ_parameters::FilterCount];
@@ -296,6 +297,7 @@ struct drawbar_organ: public synth::basic_synth {
par_routing1, par_routing2, par_routing3, par_routing4, par_routing5, par_routing6, par_routing7, par_routing8, par_routing9,
par_foldover,
par_percdecay, par_perclevel, par_perctimbre, par_perctrigger,
+ par_filterchain,
par_master,
par_f1cutoff, par_f1res, par_f1env1, par_f1env2, par_f1env3, par_f1keyf,
par_f2cutoff, par_f2res, par_f2env1, par_f2env2, par_f2env3, par_f2keyf,
diff --git a/src/organ.cpp b/src/organ.cpp
index 62adf82..2c394a1 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -136,6 +136,12 @@ const char *organ_audio_module::get_gui_xml()
"<align><knob param=\"f1_env3\" expand=\"0\" fill=\"0\"/></align><value param=\"f1_env3\"/>"
"</vbox>"
"</hbox>"
+ "<align>"
+ "<hbox>"
+ "<toggle expand=\"0\" fill=\"0\" param=\"filter_chain\" />"
+ "<label param=\"filter_chain\" />"
+ "</hbox>"
+ "</align>"
"</vbox>"
"</frame>"
"<frame label=\"Filter 2\">"
@@ -390,6 +396,7 @@ parameter_properties organ_audio_module::param_props[] = {
{ 2, 0, 7, 1, PF_ENUM | PF_CTL_COMBO, organ_percussion_timbre_names, "perc_timbre", "Perc. timbre" },
{ 0, 0, organ_voice_base::perctrig_count - 1, 0, PF_ENUM | PF_CTL_COMBO, organ_percussion_trigger_names, "perc_trigger", "Perc. trigger" },
+ { 0, 0, 1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "filter_chain", "Filter 1 To 2" },
{ 0.1, 0, 1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "master", "Volume" },
{ 2000, 20, 20000, 100, PF_FLOAT | PF_SCALE_LOG | PF_UNIT_HZ | PF_CTL_KNOB, NULL, "f1_cutoff", "F1 Cutoff" },
@@ -771,10 +778,21 @@ void organ_voice::render_block() {
amp_post[i] = (amp_post[i] - amp_pre[i]) * (1.0 / BlockSize);
float a0 = amp_pre[0], a1 = amp_pre[1], a2 = amp_pre[2], a3 = amp_pre[3];
float d0 = amp_post[0], d1 = amp_post[1], d2 = amp_post[2], d3 = amp_post[3];
- for (int i=0; i < (int) BlockSize; i++) {
- output_buffer[i][0] = a3 * (a0 * output_buffer[i][0] + a1 * filterL[0].process_d1(aux_buffers[1][i][0]) + a2 * filterL[1].process_d1(aux_buffers[2][i][0]));
- output_buffer[i][1] = a3 * (a0 * output_buffer[i][1] + a1 * filterR[0].process_d1(aux_buffers[1][i][1]) + a2 * filterR[1].process_d1(aux_buffers[2][i][1]));
- a0 += d0, a1 += d1, a2 += d2, a3 += d3;
+ if (parameters->filter_chain >= 0.5f)
+ {
+ for (int i=0; i < (int) BlockSize; i++) {
+ output_buffer[i][0] = a3 * (a0 * output_buffer[i][0] + a2 * filterL[1].process_d1(a1 * filterL[0].process_d1(aux_buffers[1][i][0]) + aux_buffers[2][i][0]));
+ output_buffer[i][1] = a3 * (a0 * output_buffer[i][1] + a2 * filterR[1].process_d1(a1 * filterR[0].process_d1(aux_buffers[1][i][1]) + aux_buffers[2][i][1]));
+ a0 += d0, a1 += d1, a2 += d2, a3 += d3;
+ }
+ }
+ else
+ {
+ for (int i=0; i < (int) BlockSize; i++) {
+ output_buffer[i][0] = a3 * (a0 * output_buffer[i][0] + a1 * filterL[0].process_d1(aux_buffers[1][i][0]) + a2 * filterL[1].process_d1(aux_buffers[2][i][0]));
+ output_buffer[i][1] = a3 * (a0 * output_buffer[i][1] + a1 * filterR[0].process_d1(aux_buffers[1][i][1]) + a2 * filterR[1].process_d1(aux_buffers[2][i][1]));
+ a0 += d0, a1 += d1, a2 += d2, a3 += d3;
+ }
}
filterL[0].sanitize_d1();
filterR[0].sanitize_d1();
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list