[SCM] calf/master: User interface, comments

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:39:57 UTC 2013


The following commit has been merged in the master branch:
commit b884d4da9d3bebdeeee91fc0afbafb8f5ca055e0
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Sun Mar 14 00:45:52 2010 +0100

    User interface, comments

diff --git a/gui/gui-saturator.xml b/gui/gui-saturator.xml
index a995233..96b0f8c 100644
--- a/gui/gui-saturator.xml
+++ b/gui/gui-saturator.xml
@@ -1,104 +1,125 @@
-<vbox>
-    <hbox spacing="20">
-        <table rows="7" cols="5">
-            <label param="bypass" attach-x="0" attach-y="0" expand-x="0" fill-x="0" />
-            <toggle param="bypass" attach-x="0" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
+<table cols="3" rows="2">
+    
+    <!-- top left -->
+    <vbox attach-x="0" attach-y="0" pad-y="5">
+    
+        <!-- Meters -->
+        <table rows="4" cols="2">
+            <label param="meter_in" attach-x="0" attach-y="0" expand-x="1" fill-x="1" />
+            <vumeter param="meter_in" hold="1.5" falloff="2.5" attach-x="0" attach-y="1" expand-x="1" fill-x="1" />
+            <vumeter param="meter_out" hold="1.5" falloff="2.5" attach-x="0" attach-y="2" expand-x="1" fill-x="1" />
+            <label param="meter_out" attach-x="0" attach-y="3" expand-x="1" fill-x="1" />
             
-            <label param="level_in" attach-x="1" attach-y="0" expand-x="0" fill-x="0" />
-            <knob param="level_in" attach-x="1" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
-            <value param="level_in" attach-x="1" attach-y="3" expand-x="0" fill-x="0" />
-            
-            <label param="meter_in" attach-x="2" attach-y="0" expand-x="1" fill-x="1" />
-            <vumeter param="meter_in" hold="1.5" falloff="2.5" attach-x="2" attach-y="1" expand-x="1" fill-x="1" />
-            <vumeter param="meter_out" hold="1.5" falloff="2.5" attach-x="2" attach-y="2" expand-x="1" fill-x="1" />
-            <label param="meter_out" attach-x="2" attach-y="3" expand-x="1" fill-x="1" />
-            
-            <label param="clip_in" attach-x="3" attach-y="0" expand-x="0" fill-x="0" />
-            <led param="clip_in" attach-x="3" attach-y="1" expand-x="0" fill-x="0" />
-            <led param="clip_out" mode="1" attach-x="3" attach-y="2" expand-x="0" fill-x="0" />
-            <label param="clip_out" attach-x="3" attach-y="3" expand-x="0" fill-x="0" />
-            
-            <label param="level_out" attach-x="4" attach-y="0" expand-x="0" fill-x="0" />
-            <knob param="level_out" attach-x="4" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
-            <value param="level_out" attach-x="4" attach-y="3" expand-x="0" fill-x="0" />
-            
-            <hbox attach-x="0" attach-y="4" attach-h="3" attach-w="4">
-                <label text="Tape" />
-                <hscale param="blend" />
-                <label text="Tube" />
-            </hbox>
+            <label param="clip_in" attach-x="1" attach-y="0" expand-x="0" fill-x="0" />
+            <led param="clip_in" attach-x="1" attach-y="1" expand-x="0" fill-x="0" />
+            <led param="clip_out" mode="1" attach-x="1" attach-y="2" expand-x="0" fill-x="0" />
+            <label param="clip_out" attach-x="1" attach-y="3" expand-x="0" fill-x="0" />
+        </table>
+        
+        <label />
+        
+        <!-- activation -->
+        <label param="level_in" />
+        <knob param="level_in" size="5" />
+        <value param="level_in" />
+    
+    </vbox>
+    
+    <!-- top center -->
+    <vbox attach-x="1" attach-y="0" pad-y="5" pad-x="10" spacing="5">
+        
+        <hbox>
+            <label text="Tape" />
+            <hscale param="blend" />
+            <label text="Tube" />
+        </hbox>
+        
+        <label expand="1" fill="1" />
+        
+        <hbox expand="1" fill="0">
+            <tube param="meter_drive" size="2" direction="2" expand="0" fill="0" />
+        </hbox>
+        
+        <label expand="1" fill="1" />
+        
+    </vbox>
+    
+    <!-- top right -->
+    <vbox attach-x="2" attach-y="0" pad-y="5">
+    
+        <!-- Mixer -->
+        <table rows="4" cols="3">
+            <label param="mix" attach-x="0" attach-y="0" expand-x="0" fill-x="0" />
+            <knob param="mix" attach-x="0" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
+            <value param="mix" attach-x="0" attach-y="3" expand-x="0" fill-x="0" />
             
-            <label param="mix" attach-x="4" attach-y="4" expand-x="0" fill-x="0" />
-            <knob param="mix" attach-x="4" attach-y="5" expand-x="0" fill-x="0" />
-            <value param="mix" attach-x="4" attach-y="6" expand-x="0" fill-x="0" />
+            <label param="level_out" attach-x="1" attach-y="0" expand-x="0" fill-x="0" />
+            <knob param="level_out" attach-x="1" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
+            <value param="level_out" attach-x="1" attach-y="3" expand-x="0" fill-x="0" />
             
-        </table>
-        <hbox spacing="30" expand="0" fill="0">
+            <label param="bypass" attach-x="2" attach-y="0" expand-x="0" fill-x="0" />
+            <toggle param="bypass" attach-x="2" attach-y="1" attach-h="2" expand-x="0" fill-x="0" />
+        </table>    
+        
+        <label />
+        
+        <!-- saturation -->
+        <label param="drive" />
+        <knob param="drive" size="5" />
+        <value param="drive" />
+        
+    </vbox>    
+        
+    <!-- pre filter -->
+    <frame label="Pre" attach-x="0" attach-y="1">
+        <hbox homogeneous="1" spacing="15">
             <vbox>
-                <label />
-                <vbox spacing="5" expand="0">
-                    <label param="drive" />
-                    <knob param="drive" size="5" />
-                    <value param="drive" />
-                </vbox>
-                <label />
+                <label param="hp_pre_freq" />
+                <knob param="hp_pre_freq" />
+                <value param="hp_pre_freq" />
             </vbox>
-            <vbox expand="0" fill="0">
-                <label />
-                <tube param="meter_drive" size="2" direction="2" expand="0" fill="0" />
-                <label />
+            <vbox>
+                <label param="lp_pre_freq" />
+                <knob param="lp_pre_freq" />
+                <value param="lp_pre_freq" />
             </vbox>
         </hbox>
-    </hbox>
-
-    <hbox spacing="8">
-        <frame label="Pre">
-            <hbox homogeneous="1">
-                <vbox>
-                    <label param="hp_pre_freq" />
-                    <knob param="hp_pre_freq" />
-                    <value param="hp_pre_freq" />
-                </vbox>
-                <vbox>
-                    <label param="lp_pre_freq" />
-                    <knob param="lp_pre_freq" />
-                    <value param="lp_pre_freq" />
-                </vbox>
-            </hbox>
-        </frame>
-        <frame label="Tone">
-            <hbox homogeneous="1">
-                <vbox>
-                    <label param="p_freq" attach-x="0" attach-y="0" />
-                    <knob param="p_freq" attach-x="1" attach-y="0" />
-                    <value param="p_freq" attach-x="2" attach-y="0" />
-                </vbox>
-                <vbox>
-                    <label param="p_level" attach-x="0" attach-y="1" />
-                    <knob param="p_level" attach-x="1" attach-y="0" type="1" />
-                    <value param="p_level" attach-x="2" attach-y="1" />
-                </vbox>
-                <vbox>
-                    <label param="p_q" attach-x="0" attach-y="2" />
-                    <knob param="p_q" attach-x="1" attach-y="2" />
-                    <value param="p_q" attach-x="2" attach-y="2" />
-                </vbox>
-            </hbox>
-        </frame>
-        <frame label="Post">
-            <hbox homogeneous="1">
-                <vbox>
-                    <label param="hp_post_freq" />
-                    <knob param="hp_post_freq" />
-                    <value param="hp_post_freq" />
-                </vbox>
-                <vbox>
-                    <label param="lp_post_freq" />
-                    <knob param="lp_post_freq" />
-                    <value param="lp_post_freq" />
-                </vbox>
-            </hbox>
-        </frame>
-    </hbox>
-</vbox>
-        
+    </frame>
+    
+    <!-- tone control -->
+    <frame label="Tone" attach-x="1" attach-y="1">
+        <hbox homogeneous="1">
+            <vbox>
+                <label param="p_freq" attach-x="0" attach-y="0" />
+                <knob param="p_freq" attach-x="1" attach-y="0" />
+                <value param="p_freq" attach-x="2" attach-y="0" />
+            </vbox>
+            <vbox>
+                <label param="p_level" attach-x="0" attach-y="1" />
+                <knob param="p_level" attach-x="1" attach-y="0" type="1" />
+                <value param="p_level" attach-x="2" attach-y="1" />
+            </vbox>
+            <vbox>
+                <label param="p_q" attach-x="0" attach-y="2" />
+                <knob param="p_q" attach-x="1" attach-y="2" />
+                <value param="p_q" attach-x="2" attach-y="2" />
+            </vbox>
+        </hbox>
+    </frame>
+    
+    <!-- post filter -->
+    <frame label="Post" attach-x="2" attach-y="1" spacing="15">
+        <hbox homogeneous="1">
+            <vbox>
+                <label param="hp_post_freq" />
+                <knob param="hp_post_freq" />
+                <value param="hp_post_freq" />
+            </vbox>
+            <vbox>
+                <label param="lp_post_freq" />
+                <knob param="lp_post_freq" />
+                <value param="lp_post_freq" />
+            </vbox>
+        </hbox>
+    </frame>
+</table>
diff --git a/src/calf/modules.h b/src/calf/modules.h
index d0c9ea0..eec4125 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -1184,7 +1184,7 @@ public:
     }
 };
 
-/// Saturator by Markus Schmidt (based on Krzysztof's filters and distortion algorythm)
+/// Saturator by Markus Schmidt (based on Krzysztof's filters and Tom's distortion algorythm)
 class saturator_audio_module: public audio_module<saturator_metadata> {
 private:
     float hp_pre_freq_old, lp_pre_freq_old;
@@ -1209,7 +1209,7 @@ public:
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
 };
 
-/// Exciter by Markus Schmidt (based on Krzysztof's filters and distortion algorythm)
+/// Exciter by Markus Schmidt (based on Krzysztof's filters and Tom's distortion algorythm)
 class exciter_audio_module: public audio_module<exciter_metadata> {
 private:
     float freq_old;
@@ -1231,7 +1231,7 @@ public:
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
 };
 
-/// Bass Enhancer by Markus Schmidt (based on Krzysztof's filters and distortion algorythm)
+/// Bass Enhancer by Markus Schmidt (based on Krzysztof's filters and Tom's distortion algorythm)
 class bassenhancer_audio_module: public audio_module<bassenhancer_metadata> {
 private:
     float freq_old;
diff --git a/src/modules.cpp b/src/modules.cpp
index 1f7752a..f29355c 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -521,15 +521,15 @@ CALF_PORT_NAMES(saturator) = {"In L", "In R", "Out L", "Out R"};
 
 CALF_PORT_PROPS(saturator) = {
     { 0,           0,           1,     0,  PF_BOOL | PF_CTL_TOGGLE, NULL, "bypass", "Bypass" },
-    { 1,           0,           64,    0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_in", "Gain" },
+    { 1,           1,           64,    0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_in", "Activation" },
     { 1,           0,           64,    0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_out", "Master" },
-    { 0.5,         0,           1,     0,  PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB , NULL, "mix", "Mix" },
+    { 1,         0,           1,     0,  PF_FLOAT | PF_SCALE_PERC | PF_CTL_KNOB , NULL, "mix", "Mix" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_in", "Input" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_out", "Output" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_in", "0dB" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_out", "0dB" },
     
-    { 2,           0.1,         10,    0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "drive", "Drive" },
+    { 5,           0.1,         10,    0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "drive", "Saturation" },
     { 10,         -10,          10,    0,  PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER | PF_UNIT_COEF, NULL, "blend", "Blend" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "meter_drive", "Drive" },
     
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index 3347c8d..ca420ba 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -2424,7 +2424,7 @@ bool pulsator_audio_module::get_gridline(int index, int subindex, float &pos, bo
 
 /// Saturator Band by Markus Schmidt
 ///
-/// This module is based on Krzysztof's filters and distortion routine.
+/// This module is based on Krzysztof's filters and Tom's distortion routine.
 /// It provides a blendable saturation stage followed by a highpass, a lowpass and a peak filter
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2537,6 +2537,7 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
         meter_in  = 0.f;
         meter_out = 0.f;
         meter_drive = 0.f;
+
     } else {
         
         clip_in    -= std::min(clip_in,  numsamples);
@@ -2544,49 +2545,57 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
         meter_in = 0.f;
         meter_out = 0.f;
         meter_drive = 0.f;
-        
+        float in_avg[2] = {0.f, 0.f};
+        float out_avg[2] = {0.f, 0.f};
+        float tube_avg = 0.f;
         // process
         while(offset < numsamples) {
             // cycle through samples
             float out[2], in[2] = {0.f, 0.f};
-            float maxIn, maxOut, maxDrive = 0.f;
+            float maxIn, maxOut = 0.f;
             int c = 0;
             
             if(in_count > 1 && out_count > 1) {
                 // stereo in/stereo out
                 // handle full stereo
                 in[0] = ins[0][offset];
-                in[0] *= *params[param_level_in];
                 in[1] = ins[1][offset];
-                in[1] *= *params[param_level_in];
                 c = 2;
             } else {
                 // in and/or out mono
                 // handle mono
                 in[0] = ins[0][offset];
-                in[0] *= *params[param_level_in];
                 in[1] = in[0];
                 c = 1;
             }
             
             float proc[2];
-            proc[0] = in[0];
-            proc[1] = in[1];
+            proc[0] = in[0] * *params[param_level_in];
+            proc[1] = in[1] * *params[param_level_in];
             
             for (int i = 0; i < c; ++i) {
                 // all pre filters in chain
                 proc[i] = lp[i][1].process(lp[i][0].process(proc[i]));
                 proc[i] = hp[i][1].process(hp[i][0].process(proc[i]));
                 
-                // saturate
+                // get average for display purposes before...
+                in_avg[i] += fabs(pow(proc[i], 2.f));
+
+                // ...saturate...
                 proc[i] = dist[i].process(proc[i]);
                 
+                // ...and get average after...
+                out_avg[i] += fabs(pow(proc[i], 2.f));
+                
                 // tone control
                 proc[i] = p[i].process(proc[i]);
 
                 // all post filters in chain
                 proc[i] = lp[i][2].process(lp[i][3].process(proc[i]));
                 proc[i] = hp[i][2].process(hp[i][3].process(proc[i]));
+                
+                //subtract gain
+                 proc[i] /= *params[param_level_in];
             }
             
             if(in_count > 1 && out_count > 1) {
@@ -2597,7 +2606,6 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
                 outs[1][offset] = out[1];
                 maxIn = std::max(fabs(in[0]), fabs(in[1]));
                 maxOut = std::max(fabs(out[0]), fabs(out[1]));
-                maxDrive = std::max(dist[0].get_distortion_level(), dist[1].get_distortion_level());
             } else if(out_count > 1) {
                 // mono -> pseudo stereo
                 out[0] = ((proc[0] * *params[param_mix]) + in[0] * (1 - *params[param_mix])) * *params[param_level_out];
@@ -2606,7 +2614,6 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
                 outs[1][offset] = out[1];
                 maxOut = fabs(out[0]);
                 maxIn = fabs(in[0]);
-                maxDrive = dist[0].get_distortion_level();
             } else {
                 // stereo -> mono
                 // or full mono
@@ -2614,7 +2621,6 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
                 outs[0][offset] = out[0];
                 maxIn = fabs(in[0]);
                 maxOut = fabs(out[0]);
-                maxDrive = dist[0].get_distortion_level();
             }
             
             if(maxIn > 1.f) {
@@ -2630,13 +2636,14 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
             if(maxOut > meter_out) {
                 meter_out = maxOut;
             }
-            if(maxDrive > meter_drive) {
-                meter_drive = maxDrive;
-            }
             
             // next sample
             ++offset;
         } // cycle trough samples
+        
+        tube_avg = (sqrt(std::max(out_avg[0], out_avg[1])) / numsamples) - (sqrt(std::max(in_avg[0], in_avg[1])) / numsamples);
+        meter_drive = (5.0f * fabs(tube_avg) * (float(*params[param_blend]) + 30.0f));
+        // printf("out:%.6f in: %.6f avg: %.6f drv: %.3f\n", sqrt(std::max(out_avg[0], out_avg[1])) / numsamples, sqrt(std::max(in_avg[0], in_avg[1])) / numsamples, tube_avg, meter_drive);
         // clean up
         lp[0][0].sanitize();
         lp[1][0].sanitize();
@@ -2680,7 +2687,7 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u
 
 /// Exciter by Markus Schmidt
 ///
-/// This module is based on Krzysztof's filters and distortion routine.
+/// This module is based on Krzysztof's filters and Tom's distortion routine.
 /// It sends the signal through a highpass, saturates it and sends it through a highpass again
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -2903,7 +2910,7 @@ uint32_t exciter_audio_module::process(uint32_t offset, uint32_t numsamples, uin
 
 /// Bass Enhancer by Markus Schmidt
 ///
-/// This module is based on Krzysztof's filters and distortion routine.
+/// This module is based on Krzysztof's filters and Tom's distortion routine.
 /// It sends the signal through a lowpass, saturates it and sends it through a lowpass again
 ///////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -3125,7 +3132,7 @@ uint32_t bassenhancer_audio_module::process(uint32_t offset, uint32_t numsamples
 }
 
 
-/// Distortion Module by Krzysztof Foltman
+/// Distortion Module by Tom Szilagyi
 ///
 /// This module provides a blendable saturation stage
 ///////////////////////////////////////////////////////////////////////////////////////////////

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list