[SCM] calf/master: More changes for Mono Input and Stereo Tools.

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


The following commit has been merged in the master branch:
commit 4ad3e246516e5385085375a0916263ede6e1ca1e
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Wed Feb 22 13:10:08 2012 +0000

    More changes for Mono Input and Stereo Tools.

diff --git a/doc/manuals/Mono Input.html b/doc/manuals/Mono Input.html
index 3f86991..dd69902 100644
--- a/doc/manuals/Mono Input.html	
+++ b/doc/manuals/Mono Input.html	
@@ -34,6 +34,8 @@
                 <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
                 <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
                 <li><strong>Delay:</strong> Delay the left or the right channel (milliseconds)</li>
+                <li><strong>Stereo Base:</strong> Set the stereo base of your material seamless between Mono and inversed Channels</li>
+                <li><strong>Stereo Phase:</strong> Set the stereo phase of your material</li>
                 <li><strong>Balance:</strong> Set the balance between both channels</li>
             </ul>
         </div>
diff --git a/doc/manuals/Stereo Tools.html b/doc/manuals/Stereo Tools.html
index dc83e2b..b5dfe2d 100644
--- a/doc/manuals/Stereo Tools.html	
+++ b/doc/manuals/Stereo Tools.html	
@@ -44,7 +44,8 @@
                 <li><strong>0dB (LED):</strong> Flashes if the level of the output signal raises above 0dB (it may clip your signal depending on your host and your systems' bitrate!)</li>
                 <li><strong>Output (knob):</strong> Raise the overall volume after the compression stage</li>
                 <li><strong>Delay:</strong> Delay the left or the right channel (milliseconds)</li>
-                <li><strong>Widener:</strong> Add a litte amount of phase-inverted signal to the other channel to spread the stereo image</li>
+                <li><strong>Stereo Base:</strong> Set the stereo base of your material seamless between Mono and inversed Channels</li>
+                <li><strong>Stereo Phase:</strong> Set the stereo phase of your material</li>
                 <li><strong>Balance:</strong> Set the balance between both channels</li>
             </ul>
         </div>
diff --git a/doc/manuals/images/Calf - Mono Input.png b/doc/manuals/images/Calf - Mono Input.png
index 23d3025..60885e8 100644
Binary files a/doc/manuals/images/Calf - Mono Input.png and b/doc/manuals/images/Calf - Mono Input.png differ
diff --git a/doc/manuals/images/Calf - Stereo Tools.png b/doc/manuals/images/Calf - Stereo Tools.png
index 43834a9..1485350 100644
Binary files a/doc/manuals/images/Calf - Stereo Tools.png and b/doc/manuals/images/Calf - Stereo Tools.png differ
diff --git a/gui/gui-mono.xml b/gui/gui-mono.xml
index 9bffe53..45f706d 100644
--- a/gui/gui-mono.xml
+++ b/gui/gui-mono.xml
@@ -8,21 +8,26 @@
             <hbox spacing="8">
                 <vbox>
                     <label param="level_in" />
-                    <knob param="level_in" size="3" />
+                    <knob param="level_in" size="5" />
                     <value param="level_in" />
                 </vbox>
-                <vbox spacing="4">
-                    <vbox spacing="5">
-                        
-                        <label param="softclip" />
-                        <toggle param="softclip"/>
-                    </vbox>
+                <vbox spacing="4" expand="0">
+                    <label />
                     <vbox expand="0" spacing="5">
-                        
-                        <toggle param="bypass" />
                         <label param="bypass" />
+                        <toggle param="bypass" />
+                    </vbox>
+                    <vbox expand="0" spacing="5">
+                        <toggle param="softclip"/>
+                        <label param="softclip" />
                     </vbox>
                 </vbox>
+                <vbox fill="0" spacing="10" expand="0">
+                    <label />
+                    <label param="sc_level" />
+                    <knob param="sc_level" size="3" />
+                    <value param="sc_level" />
+                </vbox>
             </hbox>
         </vbox>
     </frame>
@@ -70,17 +75,27 @@
             <hbox spacing="8">
                 <vbox spacing="12">
                     <label param="delay" />
-                    <knob param="delay" size="2" type="1" />
+                    <knob param="delay" size="3" type="1" />
                     <value param="delay" />
                 </vbox>
                 <vbox spacing="12">
+                    <label param="stereo_base" />
+                    <knob param="stereo_base" size="3" type="1" />
+                    <value param="stereo_base" />
+                </vbox>
+                <vbox spacing="12">
+                    <label param="stereo_phase" />
+                    <knob param="stereo_phase" size="3" type="3" />
+                    <value param="stereo_phase" />
+                </vbox>
+                <vbox spacing="12">
                     <label param="balance_out" />
-                    <knob param="balance_out" size="2" type="1" />
+                    <knob param="balance_out" size="3" type="1" />
                     <value param="balance_out" />
                 </vbox>
                 <vbox>
                     <label param="level_out" />
-                    <knob param="level_out" size="3" />
+                    <knob param="level_out" size="5" />
                     <value param="level_out" />
                 </vbox>
             </hbox>
diff --git a/gui/gui-stereo.xml b/gui/gui-stereo.xml
index e7b682b..c3938c7 100644
--- a/gui/gui-stereo.xml
+++ b/gui/gui-stereo.xml
@@ -10,15 +10,16 @@
                 <vumeter param="meter_inR" position="2" hold="1.5" falloff="2.5" attach-x="2" attach-y="1" fill-x="1" expand-x="1" fill-y="0" expand-y="0"/>
                 <led param="clip_inR" attach-x="3" attach-y="1" fill-x="0" expand-x="0" fill-y="0" expand-y="0"/>
             </table>
-            <hbox spacing="8">
+            <hbox spacing="10">
                 <vbox expand="0" fill="0">
                     <knob param="level_in" size="5" />
                     <value param="level_in" />
                 </vbox>
-                <vbox expand="0" spacing="15">
+                <vbox expand="0" spacing="5">
                     <label param="balance_in" />
-                    <knob param="balance_in" size="3" type="1" />
-                    <value param="balance_in" />
+                    <knob param="balance_in" size="2" type="1" />
+                    <knob param="sc_level" size="2" />
+                    <label param="sc_level" />
                 </vbox>
                 <vbox expand="0" spacing="5">
                     <label param="bypass" />
@@ -120,6 +121,11 @@
                     <value param="stereo_base" />
                 </vbox>
                 <vbox expand="0" spacing="12">
+                    <label param="stereo_phase" />
+                    <knob param="stereo_phase" size="3" type="3" />
+                    <value param="stereo_phase" />
+                </vbox>
+                <vbox expand="0" spacing="12">
                     <label param="balance_out" />
                     <knob param="balance_out" size="3" type="1" />
                     <value param="balance_out" />
diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index c84bd02..b1e0e5e 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -388,7 +388,7 @@ struct stereo_metadata: public plugin_metadata<stereo_metadata>
            param_mute_l, param_mute_r, param_phase_l, param_phase_r,
            param_mode, param_slev, param_sbal, param_mlev, param_mpan,
            param_stereo_base, param_delay,
-           param_meter_phase,
+           param_meter_phase, param_sc_level, param_stereo_phase,
            param_count };
     PLUGIN_NAME_ID_LABEL("stereo", "stereo", "Stereo Tools")
 };
@@ -400,7 +400,7 @@ struct mono_metadata: public plugin_metadata<mono_metadata>
            param_meter_in, param_meter_outL, param_meter_outR, param_clip_in,param_clip_outL, param_clip_outR,
            param_balance_out, param_softclip,
            param_mute_l, param_mute_r, param_phase_l, param_phase_r,
-           param_delay,
+           param_delay, param_stereo_base, param_stereo_phase, param_sc_level,
            param_count };
     PLUGIN_NAME_ID_LABEL("mono", "mono", "Mono Input")
 };
diff --git a/src/calf/modules.h b/src/calf/modules.h
index deec06f..8570214 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -257,11 +257,12 @@ class mono_audio_module:
     float * buffer;
     unsigned int pos;
     unsigned int buffer_size;
-    
-    void softclip(float &s) {
-        int ph = s / fabs(s);
-        s = s > 0.63 ? ((0.63 + 0.36) * ph * (1 - pow(MATH_E, (1.f / 3) * (0.63 + s * ph)))) : s;
+    float sign(float x) {
+        if(x < 0) return -1.f;
+        if(x > 0) return 1.f;
+        return 0.f;
     }
+    float _phase, _phase_sin_coef, _phase_cos_coef, _sc_level, _inv_atan_shape;
 public:
     mono_audio_module();
     void params_changed();
@@ -285,11 +286,12 @@ class stereo_audio_module:
     float * buffer;
     unsigned int pos;
     unsigned int buffer_size;
-    
-    void softclip(float &s) {
-        int ph = s / fabs(s);
-        s = s > 0.63 ? ((0.63 + 0.36) * ph * (1 - pow(MATH_E, (1.f / 3) * (0.63 + s * ph)))) : s;
+    float sign(float x) {
+        if(x < 0) return -1.f;
+        if(x > 0) return 1.f;
+        return 0.f;
     }
+    float _phase, _phase_sin_coef, _phase_cos_coef, _sc_level, _inv_atan_shape;
 public:
     stereo_audio_module();
     void params_changed();
diff --git a/src/metadata.cpp b/src/metadata.cpp
index f5f2329..04cd382 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -925,6 +925,9 @@ CALF_PORT_PROPS(mono) = {
     { 0,          0,            1,     0,  PF_BOOL | PF_CTL_TOGGLE, NULL, "phaser", "Phase R" },
 
     { 0.f,         -20.f,        20.f,  0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "delay", "Delay" },
+    { 0.f,           -1.f,           1.f,    0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "stereo_base", "Stereo Base" },
+    { 0,        0, 360,  91, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "stereo_phase", "Stereo Phase" },
+    { 1,           1,           100,    0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "sc_level", "S/C Level" },
     {}
 };
 
@@ -968,7 +971,9 @@ CALF_PORT_PROPS(stereo) = {
     { 0.f,         -20.f,        20.f,  0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "delay", "Delay" },
 
     { 0.f,      0.f,           1.f,   0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_COEF | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_phase", "Phase Correlation" },
-
+    
+    { 1,           1,           100,    0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "sc_level", "S/C Level" },
+    { 0,        0, 360,  91, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_DEG, NULL, "stereo_phase", "Stereo Phase" },
     {}
 };
 
diff --git a/src/modules.cpp b/src/modules.cpp
index 206dcc2..2db8a81 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -461,6 +461,7 @@ stereo_audio_module::stereo_audio_module() {
     meter_inR  = 0.f;
     meter_outL = 0.f;
     meter_outR = 0.f;
+    _phase = -1;
 }
 
 void stereo_audio_module::activate() {
@@ -512,6 +513,15 @@ void stereo_audio_module::params_changed() {
             RR = 0.f;
             break;
     }
+    if(*params[param_stereo_phase] != _phase) {
+        _phase = *params[param_stereo_phase];
+        _phase_cos_coef = cos(_phase / 180 * M_PI);
+        _phase_sin_coef = sin(_phase / 180 * M_PI);
+    }
+    if(*params[param_sc_level] != _sc_level) {
+        _sc_level = *params[param_sc_level];
+        _inv_atan_shape = 1.0 / atan(_sc_level);
+    }
 }
 
 uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
@@ -585,11 +595,13 @@ uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint
             
             // softclip
             if(*params[param_softclip]) {
-                int ph;
-                ph = L / fabs(L);
-                L = L > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + L * ph)))) : L;
-                ph = R / fabs(R);
-                R = R > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + R * ph)))) : R;
+//                int ph;
+//                ph = L / fabs(L);
+//                L = L > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + L * ph)))) : L;
+//                ph = R / fabs(R);
+//                R = R > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + R * ph)))) : R;
+                R = _inv_atan_shape * atan(R * _sc_level);
+                L = _inv_atan_shape * atan(L * _sc_level);
             }
             
             // GUI stuff
@@ -610,16 +622,6 @@ uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint
             L += LL*L + RL*R;
             R += RR*R + LR*L;
             
-            // stereo base
-            float _sb = *params[param_stereo_base];
-            if(_sb < 0) _sb *= 0.5;
-            
-            float __l = L +_sb * L - _sb * R;
-            float __r = R + _sb * R - _sb * L;
-            
-            L = __l;
-            R = __r;
-            
             // delay
             buffer[pos]     = L;
             buffer[pos + 1] = R;
@@ -632,6 +634,23 @@ uint32_t stereo_audio_module::process(uint32_t offset, uint32_t numsamples, uint
                 L = buffer[(pos - (int)nbuf + buffer_size)     % buffer_size];
             }
             
+            // stereo base
+            float _sb = *params[param_stereo_base];
+            if(_sb < 0) _sb *= 0.5;
+            
+            float __l = L +_sb * L - _sb * R;
+            float __r = R + _sb * R - _sb * L;
+            
+            L = __l;
+            R = __r;
+            
+            // stereo phase
+            __l = L * _phase_cos_coef - R * _phase_sin_coef;
+            __r = L * _phase_sin_coef + R * _phase_cos_coef;
+            
+            L = __l;
+            R = __r;
+            
             pos = (pos + 2) % buffer_size;
             
             // balance out
@@ -704,7 +723,15 @@ void mono_audio_module::deactivate() {
 }
 
 void mono_audio_module::params_changed() {
-    
+    if(*params[param_sc_level] != _sc_level) {
+        _sc_level = *params[param_sc_level];
+        _inv_atan_shape = 1.0 / atan(_sc_level);
+    }
+    if(*params[param_stereo_phase] != _phase) {
+        _phase = *params[param_stereo_phase];
+        _phase_cos_coef = cos(_phase / 180 * M_PI);
+        _phase_sin_coef = sin(_phase / 180 * M_PI);
+    }
 }
 
 uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
@@ -734,8 +761,9 @@ uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
             
             // softclip
             if(*params[param_softclip]) {
-                int ph = L / fabs(L);
-                L = L > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + L * ph)))) : L;
+                //int ph = L / fabs(L);
+                //L = L > 0.63 ? ph * (0.63 + 0.36 * (1 - pow(MATH_E, (1.f / 3) * (0.63 + L * ph)))) : L;
+                L = _inv_atan_shape * atan(L * _sc_level);
             }
             
             // GUI stuff
@@ -764,6 +792,23 @@ uint32_t mono_audio_module::process(uint32_t offset, uint32_t numsamples, uint32
                 L = buffer[(pos - (int)nbuf + buffer_size)     % buffer_size];
             }
             
+            // stereo base
+            float _sb = *params[param_stereo_base];
+            if(_sb < 0) _sb *= 0.5;
+            
+            float __l = L +_sb * L - _sb * R;
+            float __r = R + _sb * R - _sb * L;
+            
+            L = __l;
+            R = __r;
+            
+            // stereo phase
+            __l = L * _phase_cos_coef - R * _phase_sin_coef;
+            __r = L * _phase_sin_coef + R * _phase_cos_coef;
+            
+            L = __l;
+            R = __r;
+            
             pos = (pos + 2) % buffer_size;
             
             // balance out

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list