[SCM] calf/master: Another set of changes from Markus.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:51 UTC 2013


The following commit has been merged in the master branch:
commit b259e95a5aa9fb50f6ceabee29b968e20328a260
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Thu Feb 2 09:08:33 2012 +0000

    Another set of changes from Markus.

diff --git a/doc/manuals/images/Calf - Multiband Compressor.png b/doc/manuals/images/Calf - Multiband Compressor.png
index 1f2c36f..6823d3b 100644
Binary files a/doc/manuals/images/Calf - Multiband Compressor.png and b/doc/manuals/images/Calf - Multiband Compressor.png differ
diff --git a/doc/manuals/images/Calf - Multiband Limiter.png b/doc/manuals/images/Calf - Multiband Limiter.png
index c974d80..fd618d7 100644
Binary files a/doc/manuals/images/Calf - Multiband Limiter.png and b/doc/manuals/images/Calf - Multiband Limiter.png differ
diff --git a/doc/manuals/images/Calf - Sidechain Compressor.png b/doc/manuals/images/Calf - Sidechain Compressor.png
index 486d814..95d118e 100644
Binary files a/doc/manuals/images/Calf - Sidechain Compressor.png and b/doc/manuals/images/Calf - Sidechain Compressor.png differ
diff --git a/gui/gui-multibandcompressor.xml b/gui/gui-multibandcompressor.xml
index e576ffa..4535b5a 100644
--- a/gui/gui-multibandcompressor.xml
+++ b/gui/gui-multibandcompressor.xml
@@ -101,7 +101,7 @@
     <table attach-x="0" attach-y="1" expand-y="1" shrink-y="1" expand-x="1" shrink-x="1" fill="1" rows="1" cols="4">
         <frame label="Sub band" expand-x="1" expand-y="1" shrink-x="1" shrink-y="1" attach-x="0" attach-y="0" fill="1" pad-x="4"><vbox spacing="4">
             <if cond="directlink">
-                <line-graph refresh="1" width="200" height="200" param="compression0" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+                <line-graph refresh="1" width="210" height="210" param="compression0" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
             </if>
             <vumeter param="compression0" position="2" mode="2" hold="1.5" falloff="2.5" />
             <vumeter param="output0" position="2" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
@@ -153,7 +153,7 @@
         </vbox></frame>
         <frame label="Low band" expand-x="1" expand-y="1" shrink-x="1" shrink-y="1" attach-x="1" attach-y="0" fill="1" pad-x="4"><vbox spacing="4">
             <if cond="directlink">
-                <line-graph refresh="1" width="200" height="200" param="compression1" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+                <line-graph refresh="1" width="210" height="210" param="compression1" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
             </if>
             <vumeter param="compression1" position="2" mode="2" hold="1.5" falloff="2.5" />
             <vumeter param="output1" position="2" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
@@ -205,7 +205,7 @@
         </vbox></frame>
         <frame label="Mid band" expand-x="1" expand-y="1" shrink-x="1" shrink-y="1" attach-x="2" attach-y="0" fill="1" pad-x="4"><vbox spacing="4">
             <if cond="directlink">
-                <line-graph refresh="1" width="200" height="200" param="compression2" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+                <line-graph refresh="1" width="210" height="210" param="compression2" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
             </if>
             <vumeter param="compression2" position="2" mode="2" hold="1.5" falloff="2.5" />
             <vumeter param="output2" position="2" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
@@ -257,7 +257,7 @@
         </vbox></frame>
         <frame label="High band" expand-x="1" expand-y="1" shrink-x="1" shrink-y="1" attach-x="3" attach-y="0" fill="1" pad-x="4"><vbox spacing="4">
             <if cond="directlink">
-                <line-graph refresh="1" width="200" height="200" param="compression3" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+                <line-graph refresh="1" width="210" height="210" param="compression3" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
             </if>
             <vumeter param="compression3" position="2" mode="2" hold="1.5" falloff="2.5" />
             <vumeter param="output3" position="2" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
diff --git a/gui/gui-sidechaincompressor.xml b/gui/gui-sidechaincompressor.xml
index cbaaaab..ecd8ff2 100644
--- a/gui/gui-sidechaincompressor.xml
+++ b/gui/gui-sidechaincompressor.xml
@@ -1,4 +1,4 @@
-<hbox spacing="10">
+<hbox spacing="6">
 
     <vbox spacing="20" expand="0" fill="0">
         <vbox attach-x="0" attach-y="0" expand="0" fill="0" pad-x="7" pad-y="7" spacing="7" >
@@ -87,10 +87,9 @@
       <frame label="Compression">
         <vbox spacing="6">
             <if cond="directlink">
-                <line-graph refresh="1" width="255" height="255" param="compression" square="1" expand="1" fill="1"/>
+                <line-graph refresh="1" width="290" height="290" param="compression" square="1" expand="1" fill="1"/>
             </if>
             <vbox spacing="3">
-                <label param="compression"/>
                 <vumeter param="compression" position="2" mode="2" hold="1.5" attach-w="2" expand="0" fill="1"/>
             </vbox>
         </vbox>
@@ -100,15 +99,18 @@
         
         <if cond="directlink">
             <frame label="Sidechain">
-                <vbox spacing="6">
-                    <line-graph refresh="1" width="235" height="112" param="f1_freq" expand="1" fill="1" />
-                    <table rows="2" cols="2" expand="0" fill="0">
-                        <label attach-x="0" attach-y="0" param="sc_mode" expand-y="0" fill-y="0" />
-                        <combo attach-x="0" attach-y="1" param="sc_mode" fill-y="1" expand-y="0"/>
-                        <label attach-x="1" attach-y="0" param="sc_listen" expand-y="0" fill-y="0" />
-                        <toggle attach-x="1" attach-y="1" param="sc_listen" size="2" expand-y="0" fill-y="0"/>
-                    </table>
-                </vbox>
+                <table rows="4" cols="5" spacing="3">
+                    <line-graph refresh="1" width="235" height="112" param="f1_freq" expand="1" fill="1" attach-x="0" attach-y="0" attach-w="5" />
+                    <label param="sc_mode" expand="0" fill="0" attach-x="0" attach-y="1" />
+                    <combo param="sc_mode" fill="0" expand="0" attach-x="1" attach-y="1" attach-w="4" />
+                    <label param="sc_route" expand="0" fill="0" attach-x="0" attach-y="2" />
+                    <combo param="sc_route" fill="0" expand="0" attach-x="1" attach-y="2" attach-w="4"/>
+                    <label param="sc_listen" expand="0" fill="0" attach-x="3" attach-y="3" />
+                    <toggle param="sc_listen" size="2" expand="0" fill="0" attach-x="4" attach-y="3"/>
+                    <label param="sc_level" expand="0" fill="0" attach-x="0" attach-y="3" />
+                    <knob param="sc_level" size="2" expand="0" fill="0" type="1" attach-x="1" attach-y="3"/>
+                    <value param="sc_level" expand="0" fill="0" attach-x="2" attach-y="3" />
+                </table>
             </frame>
         </if>
         <hbox spacing="5">
diff --git a/gui/gui-sidechaingate.xml b/gui/gui-sidechaingate.xml
index 6635af0..6462558 100644
--- a/gui/gui-sidechaingate.xml
+++ b/gui/gui-sidechaingate.xml
@@ -1,4 +1,4 @@
-<hbox spacing="10">
+<hbox spacing="6">
 
     <vbox spacing="20" expand="0" fill="0">
         <vbox attach-x="0" attach-y="0" expand="0" fill="0" pad-x="7" pad-y="7" spacing="7" >
@@ -87,10 +87,9 @@
       <frame label="Gating">
         <vbox spacing="6">
             <if cond="directlink">
-                <line-graph refresh="1" width="255" height="255" param="gating" square="1" expand="1" fill="1"/>
+                <line-graph refresh="1" width="290" height="290" param="gating" square="1" expand="1" fill="1"/>
             </if>
             <vbox spacing="3">
-                <label param="gating"/>
                 <vumeter param="gating" position="2" mode="2" hold="1.5" attach-w="2" expand="0" fill="1"/>
             </vbox>
         </vbox>
@@ -100,15 +99,18 @@
         
         <if cond="directlink">
             <frame label="Sidechain">
-                <vbox spacing="6">
-                    <line-graph refresh="1" width="235" height="112" param="f1_freq" expand="1" fill="1" />
-                    <table rows="2" cols="2" expand="0" fill="0">
-                        <label attach-x="0" attach-y="0" param="sc_mode" expand-y="0" fill-y="0" />
-                        <combo attach-x="0" attach-y="1" param="sc_mode" fill-y="1" expand-y="0"/>
-                        <label attach-x="1" attach-y="0" param="sc_listen" expand-y="0" fill-y="0" />
-                        <toggle attach-x="1" attach-y="1" param="sc_listen" size="2" expand-y="0" fill-y="0"/>
-                    </table>
-                </vbox>
+                <table rows="4" cols="5" spacing="3">
+                    <line-graph refresh="1" width="235" height="112" param="f1_freq" expand="1" fill="1" attach-x="0" attach-y="0" attach-w="5" />
+                    <label param="sc_mode" expand="0" fill="0" attach-x="0" attach-y="1" />
+                    <combo param="sc_mode" fill="0" expand="0" attach-x="1" attach-y="1" attach-w="4" />
+                    <label param="sc_route" expand="0" fill="0" attach-x="0" attach-y="2" />
+                    <combo param="sc_route" fill="0" expand="0" attach-x="1" attach-y="2" attach-w="4"/>
+                    <label param="sc_listen" expand="0" fill="0" attach-x="3" attach-y="3" />
+                    <toggle param="sc_listen" size="2" expand="0" fill="0" attach-x="4" attach-y="3"/>
+                    <label param="sc_level" expand="0" fill="0" attach-x="0" attach-y="3" />
+                    <knob param="sc_level" size="2" expand="0" fill="0" type="1" attach-x="1" attach-y="3"/>
+                    <value param="sc_level" expand="0" fill="0" attach-x="2" attach-y="3" />
+                </table>
             </frame>
         </if>
         <hbox spacing="5">
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index ecfd0f2..d0035c0 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -171,7 +171,7 @@ struct sidechaincompressor_metadata: public plugin_metadata<sidechaincompressor_
     enum { param_bypass, param_level_in, MONO_VU_METER_PARAMS,
            param_threshold, param_ratio, param_attack, param_release, param_makeup, param_knee, param_detection, param_stereo_link, param_compression,
            param_sc_mode, param_f1_freq, param_f2_freq, param_f1_level, param_f2_level,
-           param_sc_listen, param_f1_active, param_f2_active, param_count };
+           param_sc_listen, param_f1_active, param_f2_active, param_sc_route, param_sc_level, param_count };
     PLUGIN_NAME_ID_LABEL("sidechaincompressor", "sidechaincompressor", "Sidechain Compressor")
 };
 
@@ -227,7 +227,7 @@ struct sidechaingate_metadata: public plugin_metadata<sidechaingate_metadata>
     enum { param_bypass, param_level_in, MONO_VU_METER_PARAMS,
            param_range, param_threshold, param_ratio, param_attack, param_release, param_makeup, param_knee, param_detection, param_stereo_link, param_gating,
            param_sc_mode, param_f1_freq, param_f2_freq, param_f1_level, param_f2_level,
-           param_sc_listen, param_f1_active, param_f2_active, param_count };
+           param_sc_listen, param_f1_active, param_f2_active, param_sc_route, param_sc_level, param_count };
     PLUGIN_NAME_ID_LABEL("sidechaingate", "sidechaingate", "Sidechain Gate")
 };
 
diff --git a/src/calf/modules_comp.h b/src/calf/modules_comp.h
index 0dbe882..decdf20 100644
--- a/src/calf/modules_comp.h
+++ b/src/calf/modules_comp.h
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General
  * Public License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02111-1307, USA.
  */
 #ifndef CALF_MODULES_COMP_H
@@ -134,6 +134,11 @@ private:
         BANDPASS_1,
         BANDPASS_2
     };
+    enum CalfScRoute {
+        STEREO,
+        RIGHT_LEFT,
+        LEFT_RIGHT
+    };
     mutable float f1_freq_old, f2_freq_old, f1_level_old, f2_level_old;
     mutable float f1_freq_old1, f2_freq_old1, f1_level_old1, f2_level_old1;
     CalfScModes sc_mode;
@@ -262,6 +267,11 @@ private:
         BANDPASS_1,
         BANDPASS_2
     };
+    enum CalfScRoute {
+        STEREO,
+        RIGHT_LEFT,
+        LEFT_RIGHT
+    };
     mutable float f1_freq_old, f2_freq_old, f1_level_old, f2_level_old;
     mutable float f1_freq_old1, f2_freq_old1, f1_level_old1, f2_level_old1;
     CalfScModes sc_mode;
diff --git a/src/metadata.cpp b/src/metadata.cpp
index 9c82aff..45891e9 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -260,6 +260,9 @@ const char *sidechaincompressor_mode_names[] = {"Wideband (F1:off / F2:off)",
                                                 "Weighted #3 (F1:Bell / F2:Shelf)",
                                                 "Bandpass #1 (F1:BP / F2:off)",
                                                 "Bandpass #2 (F1:HP / F2:LP)"};
+const char *sidechaincompressor_route_names[] = {"Stereo Input (Default)",
+                                           "R ▸ L (L: Signal / R: S/C)",
+                                           "L ▸ R (L: S/C / R: Signal)"};
 const char *sidechaincompressor_filter_choices[] = { "12dB", "24dB", "36dB"};
 
 
@@ -279,7 +282,7 @@ CALF_PORT_PROPS(sidechaincompressor) = {
     { 0,      0,  1,    0, PF_ENUM | PF_CTL_COMBO, sidechaincompressor_detection_names, "detection", "Detection" },
     { 0,      0,  1,    0, PF_ENUM | PF_CTL_COMBO, sidechaincompressor_stereo_link_names, "stereo_link", "Stereo Link" },
     { 0, 0.03125, 1,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_CTLO_REVERSE | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL| PF_PROP_GRAPH, NULL, "compression", "Gain Reduction" },
-    { 0,      0,  9,    0, PF_ENUM | PF_CTL_COMBO, sidechaincompressor_mode_names, "sc_mode", "Sidechain Mode" },
+    { 0,      0,  9,    0, PF_ENUM | PF_CTL_COMBO, sidechaincompressor_mode_names, "sc_mode", "S/C Mode" },
     { 250,    10,18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "f1_freq", "F1 Freq" },
     { 4500,   10,18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "f2_freq", "F2 Freq" },
     { 1,      0.0625,  16, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "f1_level", "F1 Level" },
@@ -287,6 +290,8 @@ CALF_PORT_PROPS(sidechaincompressor) = {
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_TOGGLE, NULL, "sc_listen", "S/C-Listen" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "f1_active", "F1 Active" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "f2_active", "F2 Active" },
+    { 0,      0,  2,    0, PF_ENUM | PF_CTL_COMBO, sidechaincompressor_route_names, "sc_route", "S/C Route" },
+    { 1,           0.015625,           64,    0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "sc_level", "S/C Level" },
     {}
 };
 
@@ -458,6 +463,9 @@ const char *sidechaingate_mode_names[] = {"Wideband (F1:off / F2:off)",
                                                 "Weighted #3 (F1:Bell / F2:Shelf)",
                                                 "Bandpass #1 (F1:BP / F2:off)",
                                                 "Bandpass #2 (F1:HP / F2:LP)"};
+const char *sidechaingate_route_names[] = {"Stereo Input (Default)",
+                                           "R ▸ L (L: Signal / R: S/C)",
+                                           "L ▸ R (L: S/C / R: Signal)"};
 const char *sidechaingate_filter_choices[] = { "12dB", "24dB", "36dB"};
 
 
@@ -478,7 +486,7 @@ CALF_PORT_PROPS(sidechaingate) = {
     { 0,      0,  1,    0, PF_ENUM | PF_CTL_COMBO, sidechaingate_detection_names, "detection", "Detection" },
     { 0,      0,  1,    0, PF_ENUM | PF_CTL_COMBO, sidechaingate_stereo_link_names, "stereo_link", "Stereo Link" },
     { 0, 0.03125, 1,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_CTLO_REVERSE | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL| PF_PROP_GRAPH, NULL, "gating", "Gating" },
-    { 0,      0,  9,    0, PF_ENUM | PF_CTL_COMBO, sidechaingate_mode_names, "sc_mode", "Sidechain Mode" },
+    { 0,      0,  9,    0, PF_ENUM | PF_CTL_COMBO, sidechaingate_mode_names, "sc_mode", "S/C Mode" },
     { 250,    10,18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "f1_freq", "F1 Freq" },
     { 4500,   10,18000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ, NULL, "f2_freq", "F2 Freq" },
     { 1,      0.0625,  16, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "f1_level", "F1 Level" },
@@ -486,6 +494,8 @@ CALF_PORT_PROPS(sidechaingate) = {
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_TOGGLE, NULL, "sc_listen", "S/C-Listen" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "f1_active", "F1 Active" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "f2_active", "F2 Active" },
+    { 0,      0,  2,    0, PF_ENUM | PF_CTL_COMBO, sidechaingate_route_names, "sc_route", "S/C Route" },
+    { 1,           0.015625,           64,    0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "sc_level", "S/C Level" },
     {}
 };
 
diff --git a/src/modules_comp.cpp b/src/modules_comp.cpp
index 1f16a02..8579770 100644
--- a/src/modules_comp.cpp
+++ b/src/modules_comp.cpp
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General
  * Public License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA  02110-1301  USA
  */
 #include <limits.h>
@@ -167,7 +167,7 @@ void multibandcompressor_audio_module::set_sample_rate(uint32_t sr)
     if(params[param_compression##index] != NULL) \
         *params[param_compression##index] = 1.0; \
     if(params[param_output##index] != NULL) \
-        *params[param_output##index] = 0.0; 
+        *params[param_output##index] = 0.0;
 
 #define ACTIVE_COMPRESSION(index) \
     if(params[param_compression##index] != NULL) \
@@ -199,7 +199,7 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
         meter_outR = 0.f;
     } else {
         // process all strips
-        
+
         // let meters fall a bit
         clip_inL    -= std::min(clip_inL,  numsamples);
         clip_inR    -= std::min(clip_inR,  numsamples);
@@ -257,12 +257,12 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
                     outR += right;
                 } else {
                     // strip muted
-                    
+
                 }
-                
-                
+
+
             } // process single strip
-            
+
             // even out filters gain reduction
             // 3dB - levelled manually (based on default sep and q settings)
             switch(mode) {
@@ -275,15 +275,15 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
                     outR *= 0.88;
                     break;
             }
-            
+
             // out level
             outL *= *params[param_level_out];
             outR *= *params[param_level_out];
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             // clip LED's
             if(inL > 1.f) {
                 clip_inL  = srate >> 3;
@@ -313,9 +313,9 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
             // next sample
             ++offset;
         } // cycle trough samples
-        
+
     } // process all strips (no bypass)
-    
+
     // draw meters
     SET_IF_CONNECTED(clip_inL);
     SET_IF_CONNECTED(clip_inR);
@@ -374,7 +374,7 @@ bool multibandcompressor_audio_module::get_dot(int index, int subindex, float &x
 }
 
 bool multibandcompressor_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
-{ 
+{
     const gain_reduction_audio_module *m = get_strip_by_param_index(index);
     if (m)
         return m->get_gridline(subindex, pos, vertical, legend, context);
@@ -445,9 +445,9 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
         meters.bypassed(params, orig_numsamples);
     } else {
         // process
-        
-        compressor.update_curve();        
-        
+
+        compressor.update_curve();
+
         while(offset < numsamples) {
             // cycle through samples
             float outL = 0.f;
@@ -457,19 +457,19 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
             // in level
             inR *= *params[param_level_in];
             inL *= *params[param_level_in];
-            
+
             float leftAC = inL;
             float rightAC = inR;
-            
+
             compressor.process(leftAC, rightAC);
-            
+
             outL = leftAC;
             outR = rightAC;
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             // next sample
             ++offset;
         } // cycle trough samples
@@ -556,7 +556,7 @@ void sidechaincompressor_audio_module::deactivate()
 
 sidechaincompressor_audio_module::cfloat sidechaincompressor_audio_module::h_z(const cfloat &z) const
 {
-    switch (sc_mode) {
+    switch ((CalfScModes)sc_mode) {
         default:
         case WIDEBAND:
             return false;
@@ -576,7 +576,7 @@ sidechaincompressor_audio_module::cfloat sidechaincompressor_audio_module::h_z(c
         case BANDPASS_1:
             return f1L.h_z(z);
             break;
-    }            
+    }
 }
 
 float sidechaincompressor_audio_module::freq_gain(int index, double freq, uint32_t sr) const
@@ -584,7 +584,7 @@ float sidechaincompressor_audio_module::freq_gain(int index, double freq, uint32
     typedef std::complex<double> cfloat;
     freq *= 2.0 * M_PI / sr;
     cfloat z = 1.0 / exp(cfloat(0.0, freq));
-    
+
     return std::abs(h_z(z));
 }
 
@@ -595,7 +595,7 @@ void sidechaincompressor_audio_module::params_changed()
         or *params[param_f2_freq] != f2_freq_old or *params[param_f2_level] != f2_level_old
         or *params[param_sc_mode] != sc_mode) {
         float q = 0.707;
-        switch ((int)*params[param_sc_mode]) {
+        switch ((CalfScModes)*params[param_sc_mode]) {
             default:
             case WIDEBAND:
                 f1L.set_hp_rbj((float)*params[param_f1_freq], q, (float)srate, *params[param_f1_level]);
@@ -711,17 +711,29 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
     if(bypass) {
         // everything bypassed
         while(offset < numsamples) {
-            outs[0][offset] = ins[0][offset];
-            outs[1][offset] = ins[1][offset];
+            switch ((CalfScRoute)*params[param_sc_route]) {
+                case STEREO:
+                    outs[0][offset] = ins[0][offset];
+                    outs[1][offset] = ins[1][offset];
+                    break;
+                case RIGHT_LEFT:
+                    outs[0][offset] = ins[0][offset];
+                    outs[1][offset] = ins[0][offset];
+                    break;
+                case LEFT_RIGHT:
+                    outs[0][offset] = ins[1][offset];
+                    outs[1][offset] = ins[1][offset];
+                    break;
+            }
             ++offset;
         }
         // displays, too
         meters.bypassed(params, orig_numsamples);
     } else {
         // process
-        
-        compressor.update_curve();        
-        
+
+        compressor.update_curve();
+
         while(offset < numsamples) {
             // cycle through samples
             float outL = 0.f;
@@ -731,8 +743,7 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
             // in level
             inR *= *params[param_level_in];
             inL *= *params[param_level_in];
-            
-            
+
             float leftAC = inL;
             float rightAC = inR;
             float leftSC = inL;
@@ -740,10 +751,42 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
             float leftMC = inL;
             float rightMC = inR;
             
-            switch ((int)*params[param_sc_mode]) {
+            switch ((CalfScRoute)*params[param_sc_route]) {
+                case STEREO:
+                    leftAC = inL;
+                    rightAC = inR;
+                    leftSC = inL;
+                    rightSC = inR;
+                    leftMC = inL;
+                    rightMC = inR;
+                    break;
+                case RIGHT_LEFT:
+                    leftAC = inL;
+                    rightAC = inL;
+                    leftSC = inR;
+                    rightSC = inR;
+                    leftMC = inL;
+                    rightMC = inL;
+                    break;
+                case LEFT_RIGHT:
+                    leftAC = inR;
+                    rightAC = inR;
+                    leftSC = inL;
+                    rightSC = inL;
+                    leftMC = inR;
+                    rightMC = inR;
+                    break;
+            }
+            
+            leftSC  *= *params[param_sc_level];
+            rightSC *= *params[param_sc_level];
+            
+            switch ((CalfScModes)*params[param_sc_mode]) {
                 default:
                 case WIDEBAND:
-                    compressor.process(leftAC, rightAC);
+                    compressor.process(leftAC, rightAC, &leftSC, &rightSC);
+                    leftMC = leftSC;
+                    rightMC = rightSC;
                     break;
                 case DEESSER_WIDE:
                 case DERUMBLER_WIDE:
@@ -773,7 +816,7 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
                     rightSC = f1R.process(rightSC);
                     leftMC = leftSC;
                     rightMC = rightSC;
-                    compressor.process(leftSC, rightSC);
+                    compressor.process(leftSC, rightSC, &leftSC, &rightSC);
                     leftAC = f2L.process(leftAC);
                     rightAC = f2R.process(rightAC);
                     leftAC += leftSC;
@@ -787,7 +830,7 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
                     compressor.process(leftAC, rightAC, &leftSC, &rightSC);
                     break;
             }
-            
+
             if(*params[param_sc_listen] > 0.f) {
                 outL = leftMC;
                 outR = rightMC;
@@ -795,11 +838,11 @@ uint32_t sidechaincompressor_audio_module::process(uint32_t offset, uint32_t num
                 outL = leftAC;
                 outR = rightAC;
             }
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-                        
+
             // next sample
             ++offset;
         } // cycle trough samples
@@ -941,7 +984,7 @@ void deesser_audio_module::params_changed()
         or *params[param_f2_freq] != f2_freq_old or *params[param_f2_level] != f2_level_old
         or *params[param_f2_q] != f2_q_old) {
         float q = 0.707;
-        
+
         hpL.set_hp_rbj((float)*params[param_f1_freq] * (1 - 0.17), q, (float)srate, *params[param_f1_level]);
         hpR.copy_coeffs(hpL);
         lpL.set_lp_rbj((float)*params[param_f1_freq] * (1 + 0.17), q, (float)srate);
@@ -981,19 +1024,19 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin
         detected_led = 0.f;
     } else {
         // process
-        
+
         detected_led -= std::min(detected_led,  numsamples);
         clip_led   -= std::min(clip_led,  numsamples);
-        compressor.update_curve();        
-        
+        compressor.update_curve();
+
         while(offset < numsamples) {
             // cycle through samples
             float outL = 0.f;
             float outR = 0.f;
             float inL = ins[0][offset];
             float inR = ins[1][offset];
-            
-            
+
+
             float leftAC = inL;
             float rightAC = inR;
             float leftSC = inL;
@@ -1002,12 +1045,12 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin
             float rightRC = inR;
             float leftMC = inL;
             float rightMC = inR;
-            
+
             leftSC = pL.process(hpL.process(leftSC));
             rightSC = pR.process(hpR.process(rightSC));
             leftMC = leftSC;
             rightMC = rightSC;
-                    
+
             switch ((int)*params[param_mode]) {
                 default:
                 case WIDE:
@@ -1025,7 +1068,7 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin
                     rightAC += rightRC;
                     break;
             }
-            
+
             if(*params[param_sc_listen] > 0.f) {
                 outL = leftMC;
                 outR = rightMC;
@@ -1033,11 +1076,11 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin
                 outL = leftAC;
                 outR = rightAC;
             }
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             if(std::max(fabs(leftSC), fabs(rightSC)) > *params[param_threshold]) {
                 detected_led   = srate >> 3;
             }
@@ -1050,7 +1093,7 @@ uint32_t deesser_audio_module::process(uint32_t offset, uint32_t numsamples, uin
                 clip_out = std::max(fabs(outL), fabs(outR));
             }
             detected = std::max(fabs(leftMC), fabs(rightMC));
-            
+
             // next sample
             ++offset;
         } // cycle trough samples
@@ -1098,7 +1141,7 @@ bool deesser_audio_module::get_graph(int index, int subindex, float *data, int p
 bool deesser_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
 {
     return get_freq_gridline(subindex, pos, vertical, legend, context);
-    
+
 //    return false;
 }
 
@@ -1193,7 +1236,7 @@ uint32_t gate_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
     } else {
         // process
         gate.update_curve();
-        
+
         while(offset < numsamples) {
             // cycle through samples
             float outL = 0.f;
@@ -1203,19 +1246,19 @@ uint32_t gate_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
             // in level
             inR *= *params[param_level_in];
             inL *= *params[param_level_in];
-            
+
             float leftAC = inL;
             float rightAC = inR;
-            
+
             gate.process(leftAC, rightAC);
-            
+
             outL = leftAC;
             outR = rightAC;
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             // next sample
             ++offset;
         } // cycle trough samples
@@ -1274,7 +1317,7 @@ sidechaingate_audio_module::sidechaingate_audio_module()
     is_active = false;
     srate = 0;
     last_generation = 0;
-    
+
     f1_freq_old = f2_freq_old = f1_level_old = f2_level_old = 0;
     f1_freq_old1 = f2_freq_old1 = f1_level_old1 = f2_level_old1 = 0;
     sc_mode_old = sc_mode_old1 = WIDEBAND; // doesn't matter as long as it's sane
@@ -1297,7 +1340,7 @@ void sidechaingate_audio_module::deactivate()
 
 sidechaingate_audio_module::cfloat sidechaingate_audio_module::h_z(const cfloat &z) const
 {
-    switch (sc_mode) {
+    switch ((CalfScModes)sc_mode) {
         default:
         case WIDEBAND:
             return false;
@@ -1317,7 +1360,7 @@ sidechaingate_audio_module::cfloat sidechaingate_audio_module::h_z(const cfloat
         case BANDPASS_1:
             return f1L.h_z(z);
             break;
-    }            
+    }
 }
 
 float sidechaingate_audio_module::freq_gain(int index, double freq, uint32_t sr) const
@@ -1325,7 +1368,7 @@ float sidechaingate_audio_module::freq_gain(int index, double freq, uint32_t sr)
     typedef std::complex<double> cfloat;
     freq *= 2.0 * M_PI / sr;
     cfloat z = 1.0 / exp(cfloat(0.0, freq));
-    
+
     return std::abs(h_z(z));
 }
 
@@ -1336,7 +1379,7 @@ void sidechaingate_audio_module::params_changed()
         or *params[param_f2_freq] != f2_freq_old or *params[param_f2_level] != f2_level_old
         or *params[param_sc_mode] != sc_mode) {
         float q = 0.707;
-        switch ((int)*params[param_sc_mode]) {
+        switch ((CalfScModes)*params[param_sc_mode]) {
             default:
             case WIDEBAND:
                 f1L.set_hp_rbj((float)*params[param_f1_freq], q, (float)srate, *params[param_f1_level]);
@@ -1452,6 +1495,20 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
     if(bypass) {
         // everything bypassed
         while(offset < numsamples) {
+            switch ((CalfScRoute)*params[param_sc_route]) {
+                case STEREO:
+                    outs[0][offset] = ins[0][offset];
+                    outs[1][offset] = ins[1][offset];
+                    break;
+                case RIGHT_LEFT:
+                    outs[0][offset] = ins[0][offset];
+                    outs[1][offset] = ins[0][offset];
+                    break;
+                case LEFT_RIGHT:
+                    outs[0][offset] = ins[1][offset];
+                    outs[1][offset] = ins[1][offset];
+                    break;
+            }
             outs[0][offset] = ins[0][offset];
             outs[1][offset] = ins[1][offset];
             ++offset;
@@ -1460,9 +1517,9 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
         meters.bypassed(params, orig_offset);
     } else {
         // process
-        
+
         gate.update_curve();
-        
+
         while(offset < numsamples) {
             // cycle through samples
             float outL = 0.f;
@@ -1473,7 +1530,6 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
             inR *= *params[param_level_in];
             inL *= *params[param_level_in];
             
-            
             float leftAC = inL;
             float rightAC = inR;
             float leftSC = inL;
@@ -1481,10 +1537,42 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
             float leftMC = inL;
             float rightMC = inR;
             
-            switch ((int)*params[param_sc_mode]) {
+            switch ((CalfScRoute)*params[param_sc_route]) {
+                case STEREO:
+                    leftAC = inL;
+                    rightAC = inR;
+                    leftSC = inL;
+                    rightSC = inR;
+                    leftMC = inL;
+                    rightMC = inR;
+                    break;
+                case RIGHT_LEFT:
+                    leftAC = inL;
+                    rightAC = inL;
+                    leftSC = inR;
+                    rightSC = inR;
+                    leftMC = inL;
+                    rightMC = inL;
+                    break;
+                case LEFT_RIGHT:
+                    leftAC = inR;
+                    rightAC = inR;
+                    leftSC = inL;
+                    rightSC = inL;
+                    leftMC = inR;
+                    rightMC = inR;
+                    break;
+            }
+            
+            leftSC  *= *params[param_sc_level];
+            rightSC *= *params[param_sc_level];
+            
+            switch ((CalfScModes)*params[param_sc_mode]) {
                 default:
                 case WIDEBAND:
-                    gate.process(leftAC, rightAC);
+                    gate.process(leftAC, rightAC, &leftSC, &rightSC);
+                    leftMC = leftSC;
+                    rightMC = rightSC;
                     break;
                 case HIGHGATE_WIDE:
                 case LOWGATE_WIDE:
@@ -1514,7 +1602,7 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
                     rightSC = f1R.process(rightSC);
                     leftMC = leftSC;
                     rightMC = rightSC;
-                    gate.process(leftSC, rightSC);
+                    gate.process(leftSC, rightSC, &leftSC, &rightSC);
                     leftAC = f2L.process(leftAC);
                     rightAC = f2R.process(rightAC);
                     leftAC += leftSC;
@@ -1528,7 +1616,7 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
                     gate.process(leftAC, rightAC, &leftSC, &rightSC);
                     break;
             }
-            
+
             if(*params[param_sc_listen] > 0.f) {
                 outL = leftMC;
                 outR = rightMC;
@@ -1536,11 +1624,11 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
                 outL = leftAC;
                 outR = rightAC;
             }
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             // next sample
             ++offset;
         } // cycle trough samples
@@ -1549,7 +1637,7 @@ uint32_t sidechaingate_audio_module::process(uint32_t offset, uint32_t numsample
         f1R.sanitize();
         f2L.sanitize();
         f2R.sanitize();
-            
+
     }
     // draw strip meter
     if(bypass > 0.5f) {
@@ -1774,7 +1862,7 @@ void multibandgate_audio_module::set_sample_rate(uint32_t sr)
     if(params[param_gating##index] != NULL) \
         *params[param_gating##index] = 1.0; \
     if(params[param_output##index] != NULL) \
-        *params[param_output##index] = 0.0; 
+        *params[param_output##index] = 0.0;
 
 #define ACTIVE_GATING(index) \
     if(params[param_gating##index] != NULL) \
@@ -1806,7 +1894,7 @@ uint32_t multibandgate_audio_module::process(uint32_t offset, uint32_t numsample
         meter_outR = 0.f;
     } else {
         // process all strips
-        
+
         // let meters fall a bit
         clip_inL    -= std::min(clip_inL,  numsamples);
         clip_inR    -= std::min(clip_inR,  numsamples);
@@ -1864,12 +1952,12 @@ uint32_t multibandgate_audio_module::process(uint32_t offset, uint32_t numsample
                     outR += right;
                 } else {
                     // strip muted
-                    
+
                 }
-                
-                
+
+
             } // process single strip
-            
+
             // even out filters gain reduction
             // 3dB - levelled manually (based on default sep and q settings)
             switch(mode) {
@@ -1882,15 +1970,15 @@ uint32_t multibandgate_audio_module::process(uint32_t offset, uint32_t numsample
                     outR *= 0.88;
                     break;
             }
-            
+
             // out level
             outL *= *params[param_level_out];
             outR *= *params[param_level_out];
-            
+
             // send to output
             outs[0][offset] = outL;
             outs[1][offset] = outR;
-            
+
             // clip LED's
             if(inL > 1.f) {
                 clip_inL  = srate >> 3;
@@ -1920,9 +2008,9 @@ uint32_t multibandgate_audio_module::process(uint32_t offset, uint32_t numsample
             // next sample
             ++offset;
         } // cycle trough samples
-        
+
     } // process all strips (no bypass)
-    
+
     // draw meters
     SET_IF_CONNECTED(clip_inL);
     SET_IF_CONNECTED(clip_inR);
@@ -1981,7 +2069,7 @@ bool multibandgate_audio_module::get_dot(int index, int subindex, float &x, floa
 }
 
 bool multibandgate_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
-{ 
+{
     const expander_audio_module *m = get_strip_by_param_index(index);
     if (m)
         return m->get_gridline(subindex, pos, vertical, legend, context);
@@ -2075,12 +2163,12 @@ void gain_reduction_audio_module::process(float &left, float &right, const float
         bool average = (stereo_link == 0);
         float attack_coeff = std::min(1.f, 1.f / (attack * srate / 4000.f));
         float release_coeff = std::min(1.f, 1.f / (release * srate / 4000.f));
-        
+
         float absample = average ? (fabs(*det_left) + fabs(*det_right)) * 0.5f : std::max(fabs(*det_left), fabs(*det_right));
         if(rms) absample *= absample;
 
         dsp::sanitize(linSlope);
-	
+
         linSlope += (absample - linSlope) * (absample > linSlope ? attack_coeff : release_coeff);
         float gain = 1.f;
         if(linSlope > 0.f) {
@@ -2114,11 +2202,11 @@ float gain_reduction_audio_module::output_gain(float linSlope, bool rms) const {
             gain = (slope - thres) / ratio + thres;
             delta = 1.f / ratio;
         }
-        
+
         if(knee > 1.f && slope < kneeStop) {
             gain = hermite_interpolation(slope, kneeStart, kneeStop, kneeStart, compressedKneeStop, 1.f, delta);
         }
-        
+
         return exp(gain - slope);
     }
 
@@ -2330,7 +2418,7 @@ void expander_audio_module::process(float &left, float &right, const float *det_
         if(rms) absample *= absample;
 
         dsp::sanitize(linSlope);
-	
+
         linSlope += (absample - linSlope) * (absample > linSlope ? attack_coeff : release_coeff);
         float gain = 1.f;
         if(linSlope > 0.f) {
@@ -2487,4 +2575,3 @@ int expander_audio_module::get_changed_offsets(int generation, int &subindex_gra
         subindex_graph = 2;
     return last_generation;
 }
-

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list