[SCM] calf/master: New button (big mama), VU-meters with falloff and hold, bug in delay (value)

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


The following commit has been merged in the master branch:
commit 27d2c6f978d07b1daaa4393732481f3016a0a528
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Sat Oct 24 08:57:48 2009 +0200

    New button (big mama), VU-meters with falloff and hold, bug in delay (value)

diff --git a/gui/calf.rc b/gui/calf.rc
index fc2dce7..86f297e 100644
--- a/gui/calf.rc
+++ b/gui/calf.rc
@@ -83,7 +83,7 @@ style "clearlooks-default"
 	engine "clearlooks" 
 	{
 		colorize_scrollbar = FALSE
-		reliefstyle        = 1
+		reliefstyle        = 0
 		menubarstyle       = 0      # 0 = flat, 1 = sunken, 2 = flat gradient
 		toolbarstyle       = 1      # 0 = flat, 1 = enable effects
 		animation          = TRUE
@@ -756,10 +756,107 @@ style "clearlooks-spinbutton" = "clearlooks-default"
 
 style "clearlooks-scale"
 {
-	engine "clearlooks"
-	{
-		hint  = "scale"
-		style = CLASSIC
+	GtkVScale::slider_length 			= 46
+	GtkVScale::slider_width 			= 35
+	GtkHScale::slider_length 			= 46
+	GtkHScale::slider_width 			= 35
+	GtkRange::trough_border				= 0
+	
+	engine "pixmap"
+	{
+		image
+		{
+			function		= BOX
+			recolorable		= TRUE
+			detail			= "trough"
+			file			= "trough-horizontal.png"
+			border			= { 20, 20, 0, 0 }
+			stretch			= TRUE
+			orientation		= HORIZONTAL
+		}
+		image
+		{
+			function		= BOX
+			recolorable		= TRUE
+			detail			= "trough"
+			file			= "trough-vertical.png"
+			border			= { 0, 0, 20, 20 }
+			stretch			= TRUE
+			orientation		= VERTICAL
+		}
+
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= NORMAL
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-horiz.png"
+			overlay_stretch		= FALSE
+			orientation		= HORIZONTAL
+		}
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= PRELIGHT
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-horiz-prelight.png"
+			overlay_stretch		= FALSE
+			orientation		= HORIZONTAL
+		}
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= INSENSITIVE
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-horiz.png"
+			overlay_stretch		= FALSE
+			orientation		= HORIZONTAL
+		}
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= NORMAL
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-vert.png"
+			overlay_stretch		= FALSE
+			orientation		= VERTICAL
+		}
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= PRELIGHT
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-vert-prelight.png"
+			overlay_stretch		= FALSE
+			orientation		= VERTICAL
+		}
+		image
+		{
+			function		= SLIDER
+			recolorable		= TRUE
+			state			= INSENSITIVE
+			file			= "null.png"
+			border			= { 0, 0, 0, 0 }
+			stretch			= TRUE
+			overlay_file		= "slider-vert.png"
+			overlay_stretch		= FALSE
+			orientation		= VERTICAL
+		}
 	}
 }
 
diff --git a/gui/entry.png b/gui/entry.png
new file mode 100644
index 0000000..b7be6a3
Binary files /dev/null and b/gui/entry.png differ
diff --git a/gui/entry_inactive.png b/gui/entry_inactive.png
new file mode 100644
index 0000000..c09dc4a
Binary files /dev/null and b/gui/entry_inactive.png differ
diff --git a/gui/gui-compressor.xml b/gui/gui-compressor.xml
index bf33457..30bef42 100644
--- a/gui/gui-compressor.xml
+++ b/gui/gui-compressor.xml
@@ -12,13 +12,13 @@
     <table attach-x="1" attach-y="0" expand-y="0" fill-y="0" expand-x="1" spacing="1" rows="3" cols="2">
         <vbox expand-x="1" fill-x="1"  expand="0" fill="0" attach-x="0" attach-y="0">
             <label param="peak" />
-            <vumeter param="peak" mode="0" hold="2" shrink-y="0" />
+            <vumeter param="peak" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
         </vbox>
         <vbox shrink-x="1" expand-x="0" fill-x="0" expand-y="0" fill-y="0" expand="0" fill="0" attach-x="1" attach-y="0">
             <label param="clip" expand="0" fill="0" />
             <led param="clip" mode="1" expand="0" fill="0" />
         </vbox>
-        <vumeter param="compression" mode="2" hold="2" attach-x="0" attach-y="1" attach-w="2" expand="0" fill="0" expand-x="1" fill-x="1"/>
+        <vumeter param="compression" mode="2" hold="1.5" attach-x="0" attach-y="1" attach-w="2" expand="0" fill="0" expand-x="1" fill-x="1"/>
         <label param="compression" attach-y="2" attach-x="0" expand-x="1" fill-x="1" expand="0" fill="0" />
     </table>
     
diff --git a/gui/gui-filter.xml b/gui/gui-filter.xml
index 0cb8c1f..fe08f26 100644
--- a/gui/gui-filter.xml
+++ b/gui/gui-filter.xml
@@ -12,7 +12,7 @@
         </vbox>
         <vbox border="10">
             <label param="freq" />
-            <knob param="freq" size="4" />
+            <knob param="freq" size="5" />
             <value param="freq" />
         </vbox>
         <vbox border="10">
diff --git a/gui/gui-fluidsynth.xml b/gui/gui-fluidsynth.xml
index d1e42d5..34a5755 100644
--- a/gui/gui-fluidsynth.xml
+++ b/gui/gui-fluidsynth.xml
@@ -1,7 +1,7 @@
 <table rows="1" cols="3">
     <vbox attach-x="0" attach-y="0" pad-x="10" expand-y="1" fill-y="0" spacing="5">
         <label param="master"  />
-        <knob param="master" size="4" />
+        <knob param="master" size="5" />
         <value param="master" />
     </vbox>
     <vbox attach-x="1" attach-y="0" pad-x="10" expand-y="1" fill-y="1" spacing="5">
diff --git a/gui/gui-monosynth.xml b/gui/gui-monosynth.xml
index 93ee480..4a88c50 100644
--- a/gui/gui-monosynth.xml
+++ b/gui/gui-monosynth.xml
@@ -5,7 +5,7 @@
       <label />
       <vbox expand="0" fill="0">
         <label param="master"/>
-        <knob param="master" size="4"/>
+        <knob param="master" size="5"/>
         <value param="master"/>
       </vbox>
       <label />
diff --git a/gui/gui-multibandcompressor.xml b/gui/gui-multibandcompressor.xml
index 7110896..e515c50 100644
--- a/gui/gui-multibandcompressor.xml
+++ b/gui/gui-multibandcompressor.xml
@@ -7,8 +7,8 @@
         </vbox>
         <vbox shrink-x="1" expand-x="1" fill-x="1" expand="0" fill="0" attach-x="1" attach-y="0" pad-y="24">
             <label param="meter_inL" />
-            <vumeter param="meter_inL" mode="0" hold="2" shrink-y="0" height="30" />
-            <vumeter param="meter_inR" mode="0" hold="2" shrink-y="0" height="30" />
+            <vumeter param="meter_inL" mode="0" hold="1.5" falloff="2.5" shrink-y="0" height="30" />
+            <vumeter param="meter_inR" mode="0" hold="1.5" falloff="2.5" shrink-y="0" height="30" />
             <label param="meter_inR" />
         </vbox>
         <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="2" attach-y="0" pad-y="24">
@@ -70,8 +70,8 @@
         </table>
         <vbox shrink-x="1" expand-x="1" fill-x="1" expand="0" fill="0" attach-x="7" attach-y="0" pad-y="24">
             <label param="meter_outL" />
-            <vumeter param="meter_outL" mode="0" hold="2" shrink-y="0" height="30" />
-            <vumeter param="meter_outR" mode="0" hold="2" shrink-y="0" height="30" />
+            <vumeter param="meter_outL" mode="0" hold="1.5" falloff="2.5" shrink-y="0" height="30" />
+            <vumeter param="meter_outR" mode="0" hold="1.5" falloff="2.5" shrink-y="0" height="30" />
             <label param="meter_outR" />
         </vbox>
         <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="8" attach-y="0" pad-y="24">
@@ -134,10 +134,10 @@
             </table>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
                 <label param="compression0" />
-                <vumeter param="compression0" mode="2" hold="2" />
+                <vumeter param="compression0" mode="2" hold="1.5" falloff="2.5" />
             </vbox>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
-                <vumeter param="output0" mode="0" hold="2" shrink-y="0" />
+                <vumeter param="output0" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
                 <label param="output0" />
             </vbox>
             <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
@@ -194,10 +194,10 @@
             </table>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
                 <label param="compression1" />
-                <vumeter param="compression1" mode="2" hold="2" />
+                <vumeter param="compression1" mode="2" hold="1.5" falloff="2.5" />
             </vbox>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
-                <vumeter param="output1" mode="0" hold="2" shrink-y="0" />
+                <vumeter param="output1" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
                 <label param="output1" />
             </vbox>
             <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
@@ -254,10 +254,10 @@
             </table>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
                 <label param="compression2" />
-                <vumeter param="compression2" mode="2" hold="2" />
+                <vumeter param="compression2" mode="2" hold="1.5" falloff="2.5" />
             </vbox>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
-                <vumeter param="output2" mode="0" hold="2" shrink-y="0" />
+                <vumeter param="output2" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
                 <label param="output2" />
             </vbox>
             <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
@@ -314,10 +314,10 @@
             </table>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
                 <label param="compression3" />
-                <vumeter param="compression3" mode="2" hold="2" />
+                <vumeter param="compression3" mode="2" hold="1.5" falloff="2.5" />
             </vbox>
             <vbox expand-x="1" fill-x="1" expand="1" fill="1">
-                <vumeter param="output3" mode="0" hold="2" shrink-y="0" />
+                <vumeter param="output3" mode="0" hold="1.5" falloff="2.5" shrink-y="0" />
                 <label param="output3" />
             </vbox>
             <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
diff --git a/gui/gui-reverb.xml b/gui/gui-reverb.xml
index 6cd9b35..c3fd6a0 100644
--- a/gui/gui-reverb.xml
+++ b/gui/gui-reverb.xml
@@ -8,7 +8,7 @@
             </vbox>
             <vbox fill="0" expand="0" spacing="3">
                 <label param="decay_time" fill="0" expand="0"/>
-                <knob param="decay_time" size="4" fill="0" expand="0" />
+                <knob param="decay_time" size="5" fill="0" expand="0" />
                 <value param="decay_time" fill="0" expand="0" />
             </vbox>
             <vbox fill="0" expand="0" spacing="3">
@@ -52,9 +52,9 @@
         <table cols="3" rows="3" attach-w="5">
             <label attach-x="0" attach-y="0" expand-x="0" fill-x="0" />
             <label param="meter_wet" attach-x="0" attach-y="1" expand-y="1" fill-y="0" expand-x="0" fill-x="0" />
-            <vumeter param="meter_wet" hold="2" attach-x="1" attach-y="1" attach-w="2" expand-y="1" fill-y="0" expand-x="1" fill-x="1"/>
+            <vumeter param="meter_wet" hold="1.5" falloff="2.5" attach-x="1" attach-y="1" attach-w="2" expand-y="1" fill-y="0" expand-x="1" fill-x="1"/>
             <label param="meter_out" attach-x="0" attach-y="2" expand-y="1" fill-y="0" expand-x="0" fill-x="0"/>
-            <vumeter param="meter_out" hold="2" attach-x="1" attach-y="2" attach-w="2" expand-y="1" fill-y="0" expand-x="1" fill-x="1" />
+            <vumeter param="meter_out" hold="1.5" falloff="2.5" attach-x="1" attach-y="2" attach-w="2" expand-y="1" fill-y="0" expand-x="1" fill-x="1" />
             <!--<led param="clip" mode="0" attach-x="2" attach-y="2" expand-x="0" fill-x="0"/>-->
         </table>
         </frame>
diff --git a/gui/gui-rotaryspeaker.xml b/gui/gui-rotaryspeaker.xml
index 060cc71..4e2529c 100644
--- a/gui/gui-rotaryspeaker.xml
+++ b/gui/gui-rotaryspeaker.xml
@@ -17,7 +17,7 @@
     </frame>
     <vbox expand-y="0" attach-x="0" attach-y="0" pad-x="20">
         <label param="mod_depth" fill-x="0" expand-x="0" align-y="1.0" />
-        <knob param="mod_depth" size="4" />
+        <knob param="mod_depth" size="5" />
         <value param="mod_depth" align-y="0.0" />
     </vbox>
     <vbox attach-x="1" attach-y="0" pad-x="8">
diff --git a/gui/gui-vintagedelay.xml b/gui/gui-vintagedelay.xml
index a871e1a..0bbc270 100644
--- a/gui/gui-vintagedelay.xml
+++ b/gui/gui-vintagedelay.xml
@@ -4,8 +4,8 @@
 		    <table rows="4" cols="2">
 		        <vbox attach-x="0" attach-y="0" attach-h="3" spacing="5" pad-x="20">
 		            <label param="bpm" />
-		            <align attach-x="1" attach-y="0" scale-x="0"><knob param="bpm" size="4" /></align>
-		            <spin attach-x="2" attach-y="0" param="bpm" digits="2"/>
+		            <align attach-x="1" attach-y="0" scale-x="0"><knob param="bpm" size="5" /></align>
+		            <spin attach-x="2" attach-y="0" param="bpm" digits="2" fill="0" expand="0"/>
 		        </vbox>
 		        <label attach-x="1" attach-y="0" param="subdiv" />
 		        <hscale attach-x="2" attach-y="0" param="subdiv" />
@@ -21,10 +21,10 @@
 
     <frame label="Mixing">
     	<hbox>
-		    <vbox fill="0" border="10" spacing="5">
-		        <label param="feedback"  />
-		        <knob param="feedback" size="4"/>
-		        <value param="feedback"/>
+		    <vbox fill="0" expand="0" border="10" spacing="5">
+		        <label param="feedback" fill="0" expand="0"  />
+		        <knob param="feedback" fill="0" expand="0"  size="4"/>
+		        <value param="feedback" fill="0" expand="0" />
 		    </vbox>
 		        
 		    <table expand="0" rows="2" cols="2">
diff --git a/gui/gui-wavetable.xml b/gui/gui-wavetable.xml
index a5b134d..d37f490 100644
--- a/gui/gui-wavetable.xml
+++ b/gui/gui-wavetable.xml
@@ -8,7 +8,7 @@
           <hbox spacing="5" border="5" fill="0">
             <vbox spacing="10" fill="0">
               <label text="Level" fill="0"/>
-              <knob param="o1level" size="4" fill="0"/>
+              <knob param="o1level" size="5" fill="0"/>
               <value param="o1level" fill="0"/>
             </vbox>
             <vbox fill="0" spacing="30">
@@ -43,7 +43,7 @@
           <hbox spacing="5" border="5">
             <vbox spacing="10" fill="0">
               <label text="Level"/>
-              <knob param="o2level" size="4"/>
+              <knob param="o2level" size="5"/>
               <value param="o2level"/>
             </vbox>
             <vbox fill="0" spacing="30">
diff --git a/gui/knob5.png b/gui/knob5.png
new file mode 100644
index 0000000..b27418c
Binary files /dev/null and b/gui/knob5.png differ
diff --git a/gui/screw1.png b/gui/screw1.png
new file mode 100644
index 0000000..f072703
Binary files /dev/null and b/gui/screw1.png differ
diff --git a/gui/screw2.png b/gui/screw2.png
new file mode 100644
index 0000000..3a5f41b
Binary files /dev/null and b/gui/screw2.png differ
diff --git a/gui/scroll-thumb-horiz.png b/gui/scroll-thumb-horiz.png
new file mode 100644
index 0000000..cd89086
Binary files /dev/null and b/gui/scroll-thumb-horiz.png differ
diff --git a/gui/scroll-thumb-vert.png b/gui/scroll-thumb-vert.png
new file mode 100644
index 0000000..45ff471
Binary files /dev/null and b/gui/scroll-thumb-vert.png differ
diff --git a/gui/scroller-horiz-insens.png b/gui/scroller-horiz-insens.png
new file mode 100644
index 0000000..7758f98
Binary files /dev/null and b/gui/scroller-horiz-insens.png differ
diff --git a/gui/scroller-horiz-prelight.png b/gui/scroller-horiz-prelight.png
new file mode 100644
index 0000000..4c5ecec
Binary files /dev/null and b/gui/scroller-horiz-prelight.png differ
diff --git a/gui/scroller-horiz.png b/gui/scroller-horiz.png
new file mode 100644
index 0000000..a0ec27d
Binary files /dev/null and b/gui/scroller-horiz.png differ
diff --git a/gui/scroller-vert-insens.png b/gui/scroller-vert-insens.png
new file mode 100644
index 0000000..064364e
Binary files /dev/null and b/gui/scroller-vert-insens.png differ
diff --git a/gui/scroller-vert-prelight.png b/gui/scroller-vert-prelight.png
new file mode 100644
index 0000000..6cf649d
Binary files /dev/null and b/gui/scroller-vert-prelight.png differ
diff --git a/gui/scroller-vert.png b/gui/scroller-vert.png
new file mode 100644
index 0000000..df1805c
Binary files /dev/null and b/gui/scroller-vert.png differ
diff --git a/gui/spin_down_normal.png b/gui/spin_down_inactive.png
similarity index 52%
copy from gui/spin_down_normal.png
copy to gui/spin_down_inactive.png
index f80db22..15120ea 100644
Binary files a/gui/spin_down_normal.png and b/gui/spin_down_inactive.png differ
diff --git a/gui/spin_down_active.png b/gui/spin_down_prelight.png
similarity index 60%
copy from gui/spin_down_active.png
copy to gui/spin_down_prelight.png
index a907ce2..0e3b563 100644
Binary files a/gui/spin_down_active.png and b/gui/spin_down_prelight.png differ
diff --git a/gui/spin_up_inactive.png b/gui/spin_up_inactive.png
new file mode 100644
index 0000000..063fdfa
Binary files /dev/null and b/gui/spin_up_inactive.png differ
diff --git a/gui/spin_up_normal.png b/gui/spin_up_normal.png
new file mode 100644
index 0000000..836cad2
Binary files /dev/null and b/gui/spin_up_normal.png differ
diff --git a/gui/spin_up_active.png b/gui/spin_up_prelight.png
similarity index 100%
copy from gui/spin_up_active.png
copy to gui/spin_up_prelight.png
diff --git a/gui/trough-scrollbar-horiz.png b/gui/trough-scrollbar-horiz.png
new file mode 100644
index 0000000..21dfbe9
Binary files /dev/null and b/gui/trough-scrollbar-horiz.png differ
diff --git a/gui/trough-scrollbar-vert.png b/gui/trough-scrollbar-vert.png
new file mode 100644
index 0000000..dcf5619
Binary files /dev/null and b/gui/trough-scrollbar-vert.png differ
diff --git a/src/calf/custom_ctl.h b/src/calf/custom_ctl.h
index b553853..f401712 100644
--- a/src/calf/custom_ctl.h
+++ b/src/calf/custom_ctl.h
@@ -76,10 +76,14 @@ struct CalfVUMeter
     GtkDrawingArea parent;
     CalfVUMeterMode mode;
     float value;
-    int vumeter_hold;
+    float vumeter_hold;
     bool holding;
     long last_hold;
     float last_value;
+    float vumeter_falloff;
+    bool falling;
+    float last_falloff;
+    long last_falltime;
     cairo_surface_t *cache_surface;
     cairo_pattern_t *pat;
 };
@@ -95,6 +99,10 @@ extern void calf_vumeter_set_value(CalfVUMeter *meter, float value);
 extern float calf_vumeter_get_value(CalfVUMeter *meter);
 extern void calf_vumeter_set_mode(CalfVUMeter *meter, CalfVUMeterMode mode);
 extern CalfVUMeterMode calf_vumeter_get_mode(CalfVUMeter *meter);
+extern void calf_vumeter_set_hold(CalfVUMeter *meter, float value);
+extern float calf_vumeter_get_hold(CalfVUMeter *meter);
+extern void calf_vumeter_set_falloff(CalfVUMeter *meter, float value);
+extern float calf_vumeter_get_falloff(CalfVUMeter *meter);
 
 #define CALF_TYPE_KNOB          (calf_knob_get_type())
 #define CALF_KNOB(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_KNOB, CalfKnob))
@@ -114,7 +122,7 @@ struct CalfKnob
 struct CalfKnobClass
 {
     GtkRangeClass parent_class;
-    GdkPixbuf *knob_image[4];
+    GdkPixbuf *knob_image[5];
 };
 
 extern GtkWidget *calf_knob_new();
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 24e77f6..fd3f27e 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -225,8 +225,6 @@ public:
     }
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) {
         numsamples += offset;
-        meter_wet  -= meter_wet * 2.5 * numsamples / srate;
-        meter_out  -= meter_out * 2.5 * numsamples / srate;
         clip   -= std::min(clip, numsamples);
         for (uint32_t i = offset; i < numsamples; i++) {
             float dry = dryamount.get();
@@ -240,14 +238,8 @@ public:
             reverb.process(rl, rr);
             outs[0][i] = dry*s.left + wet*rl;
             outs[1][i] = dry*s.right + wet*rr;
-            float m_wet = std::max(fabs(wet*rl), fabs(wet*rr));
-            float m_out = std::max(fabs(outs[0][i]), fabs(outs[1][i]));
-            if(m_wet > meter_wet) {
-                meter_wet = m_wet;
-            }
-            if(m_out > meter_out) {
-                meter_out = m_out;
-            }
+            meter_wet = std::max(fabs(wet*rl), fabs(wet*rr));
+            meter_out = std::max(fabs(outs[0][i]), fabs(outs[1][i]));
             if(outs[0][i] > 1.f or outs[1][i] > 1.f) {
                 clip = srate >> 3;
             }
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 6337711..eeb9b7f 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -25,6 +25,7 @@
 #include <cairo/cairo.h>
 #include <math.h>
 #include <gdk/gdk.h>
+#include <sys/time.h>
 
 /*
 I don't really know how to do it, or if it can be done this way.
@@ -562,16 +563,43 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
     cairo_set_source_surface( c, vu->cache_surface, 0,0 );
     cairo_paint( c );
     cairo_set_source( c, vu->pat );
-
-    float value = vu->value > 1.f ? 1.f : vu->value;
     
-    if(vu->vumeter_hold > 0) {
+    // get microseconds
+    timeval tv;
+    gettimeofday(&tv, 0);
+    long time = (long)tv.tv_sec * 1000 * 1000 + (long)tv.tv_usec;
+    
+    // limit to 1.f
+    float value_orig = vu->value > 1.f ? 1.f : vu->value;
+    value_orig = value_orig < 0.f ? 0.f : value_orig;
+    float value = 0.f;
+    
+    // falloff?
+    if(vu->vumeter_falloff > 0.f and vu->mode != VU_MONOCHROME_REVERSE) {
+        // fall off a bit
+        float s = ((float)(time - vu->last_falltime) / 1000000.0);
+        float m = vu->last_falloff * s * vu->vumeter_falloff;
+        vu->last_falloff -= m;
+        // new max value?
+        if(value_orig > vu->last_falloff) {
+            vu->last_falloff = value_orig;
+        }
+        value = vu->last_falloff;
+        vu->last_falltime = time;
+        vu->falling = vu->last_falloff > 0.000001;
+    } else {
+        // falloff disabled
+        vu->last_falloff = 0.f;
+        vu->last_falltime = 0.f;
+        value = value_orig;
+    }
+    
+    if(vu->vumeter_hold > 0.0) {
         // peak hold timer
-        time_t t = time(NULL);
-        if((long)t - (long)vu->vumeter_hold > (long)vu->last_hold) {
+        if(time - (long)(vu->vumeter_hold * 1000 * 1000) > vu->last_hold) {
             // time's up, reset
             vu->last_value = value;
-            vu->last_hold = (long)t;
+            vu->last_hold = time;
             vu->holding = false;
         }
         
@@ -579,7 +607,7 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
             if(value < vu->last_value) {
                 // value is above peak hold
                 vu->last_value = value;
-                vu->last_hold = (long)t;
+                vu->last_hold = time;
                 vu->holding = true;
             }
             int hpx = round(vu->last_value * (sx - 2 * inner));
@@ -594,7 +622,7 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
             if(value > vu->last_value) {
                 // value is above peak hold
                 vu->last_value = value;
-                vu->last_hold = (long)t;
+                vu->last_hold = time;
                 vu->holding = true;
             }
             int hpx = round((1 - vu->last_value) * (sx - 2 * inner));
@@ -663,10 +691,13 @@ calf_vumeter_init (CalfVUMeter *self)
     widget->requisition.width = 50;
     widget->requisition.height = 18;
     self->value = 0.5;
-    self->last_hold = 0.f;
+    self->last_hold = (long)0;
     self->last_value = 0.f;
     self->holding = false;
     self->cache_surface = NULL;
+    self->vumeter_falloff = 0.f;
+    self->last_falloff = (long)0;
+    self->falling = false;
 }
 
 GtkWidget *
@@ -713,7 +744,7 @@ calf_vumeter_get_type (void)
 
 extern void calf_vumeter_set_value(CalfVUMeter *meter, float value)
 {
-    if (value != meter->value or meter->holding)
+    if (value != meter->value or meter->holding or meter->falling)
     {
         meter->value = value;
         gtk_widget_queue_draw(GTK_WIDGET(meter));
@@ -739,6 +770,34 @@ extern CalfVUMeterMode calf_vumeter_get_mode(CalfVUMeter *meter)
     return meter->mode;
 }
 
+extern void calf_vumeter_set_falloff(CalfVUMeter *meter, float value)
+{
+    if (value != meter->vumeter_falloff)
+    {
+        meter->vumeter_falloff = value;
+        gtk_widget_queue_draw(GTK_WIDGET(meter));
+    }
+}
+
+extern float calf_vumeter_get_falloff(CalfVUMeter *meter)
+{
+    return meter->vumeter_falloff;
+}
+
+extern void calf_vumeter_set_hold(CalfVUMeter *meter, float value)
+{
+    if (value != meter->vumeter_falloff)
+    {
+        meter->vumeter_hold = value;
+        gtk_widget_queue_draw(GTK_WIDGET(meter));
+    }
+}
+
+extern float calf_vumeter_get_hold(CalfVUMeter *meter)
+{
+    return meter->vumeter_hold;
+}
+
 ///////////////////////////////////////// knob ///////////////////////////////////////////////
 
 static gboolean
@@ -983,6 +1042,7 @@ calf_knob_class_init (CalfKnobClass *klass)
     klass->knob_image[1] = gdk_pixbuf_new_from_file(PKGLIBDIR "/knob2.png", &error);
     klass->knob_image[2] = gdk_pixbuf_new_from_file(PKGLIBDIR "/knob3.png", &error);
     klass->knob_image[3] = gdk_pixbuf_new_from_file(PKGLIBDIR "/knob4.png", &error);
+    klass->knob_image[4] = gdk_pixbuf_new_from_file(PKGLIBDIR "/knob5.png", &error);
     g_assert(klass->knob_image != NULL);
 }
 
diff --git a/src/gui_controls.cpp b/src/gui_controls.cpp
index 4e13a43..e102297 100644
--- a/src/gui_controls.cpp
+++ b/src/gui_controls.cpp
@@ -312,7 +312,8 @@ GtkWidget *vumeter_param_control::create(plugin_gui *_gui, int _param_no)
     widget = calf_vumeter_new ();
     gtk_widget_set_name(GTK_WIDGET(widget), "calf-vumeter");
     calf_vumeter_set_mode (CALF_VUMETER (widget), (CalfVUMeterMode)get_int("mode", 0));
-    CALF_VUMETER(widget)->vumeter_hold = get_int("hold", 0);
+    CALF_VUMETER(widget)->vumeter_hold = get_float("hold", 0);
+    CALF_VUMETER(widget)->vumeter_falloff = get_float("falloff", 0.f);
     return widget;
 }
 
@@ -517,8 +518,8 @@ GtkWidget *knob_param_control::create(plugin_gui *_gui, int _param_no)
     gtk_range_get_adjustment(GTK_RANGE(widget))->step_increment = increment;
     CALF_KNOB(widget)->knob_type = get_int("type");
     CALF_KNOB(widget)->knob_size = get_int("size", 2);
-    if(CALF_KNOB(widget)->knob_size > 4) {
-        CALF_KNOB(widget)->knob_size = 4;
+    if(CALF_KNOB(widget)->knob_size > 5) {
+        CALF_KNOB(widget)->knob_size = 5;
     } else if (CALF_KNOB(widget)->knob_size < 1) {
         CALF_KNOB(widget)->knob_size = 1;
     }
diff --git a/src/main_win.cpp b/src/main_win.cpp
index a8361bb..03e3cf5 100644
--- a/src/main_win.cpp
+++ b/src/main_win.cpp
@@ -292,10 +292,14 @@ main_window::plugin_strip *main_window::create_strip(plugin_ctl_iface *plugin)
         gtk_box_pack_start(GTK_BOX(inBox), gtk_label_new("audio in"),TRUE, TRUE, 0);
         
         label = calf_vumeter_new();
+        calf_vumeter_set_falloff(CALF_VUMETER(label), 2.5);
+        calf_vumeter_set_hold(CALF_VUMETER(label), 1.5);
         gtk_box_pack_start(GTK_BOX(inBox), label,TRUE, TRUE, 0);
         strip->audio_in[0] = label;
         
         label = calf_vumeter_new();
+        calf_vumeter_set_falloff(CALF_VUMETER(label), 2.5);
+        calf_vumeter_set_hold(CALF_VUMETER(label), 1.5);
         gtk_box_pack_start(GTK_BOX(inBox), label,TRUE, TRUE, 0);
         strip->audio_in[1] = label;
         
@@ -312,10 +316,14 @@ main_window::plugin_strip *main_window::create_strip(plugin_ctl_iface *plugin)
         gtk_box_pack_start(GTK_BOX(outBox), gtk_label_new("audio out"),TRUE, TRUE, 0);
         
         label = calf_vumeter_new();
+        calf_vumeter_set_falloff(CALF_VUMETER(label), 2.5);
+        calf_vumeter_set_hold(CALF_VUMETER(label), 1.5);
         gtk_box_pack_start(GTK_BOX(outBox), label,TRUE, TRUE, 0);
         strip->audio_out[0] = label;
         
         label = calf_vumeter_new();
+        calf_vumeter_set_falloff(CALF_VUMETER(label), 2.5);
+        calf_vumeter_set_hold(CALF_VUMETER(label), 1.5);
         gtk_box_pack_start(GTK_BOX(outBox), label,TRUE, TRUE, 0);
         strip->audio_out[1] = label;
         
diff --git a/src/modules.cpp b/src/modules.cpp
index e3c267f..8a607f5 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -155,7 +155,7 @@ const char *vintage_delay_fbmodes[] = {
 };
 
 CALF_PORT_PROPS(vintage_delay) = {
-    { 120,      30,    300,2701, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_BPM, NULL, "bpm", "Tempo" },
+    { 120,      30,    300,   1, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_BPM, NULL, "bpm", "Tempo" },
     {  4,        1,    16,    1, PF_INT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "subdiv", "Subdivide"},
     {  3,        1,    16,    1, PF_INT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "time_l", "Time L"},
     {  5,        1,    16,    1, PF_INT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "time_r", "Time R"},
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index a2f1076..4b2820c 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -575,9 +575,7 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
     numsamples += offset;
     
     float compression = 1.f;
-
-    peak -= peak * 5.f * numsamples / srate;
-    
+    peak = 0.f;
     clip -= std::min(clip, numsamples);
 
     while(offset < numsamples) {
@@ -616,12 +614,10 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
         ++offset;
         
         float maxLR = std::max(fabs(outL), fabs(outR));
-        
-        if(maxLR > 1.f) clip = srate >> 3; /* blink clip LED for 125 ms */
-        
-        if(maxLR > peak) {
+        if(maxLR > peak)
             peak = maxLR;
-        }
+        
+        if(peak > 1.f) clip = srate >> 3; /* blink clip LED for 125 ms */
     }
     
     detected = linSlope;
@@ -779,11 +775,10 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
         clip_inR    -= std::min(clip_inR,  numsamples);
         clip_outL   -= std::min(clip_outL, numsamples);
         clip_outR   -= std::min(clip_outR, numsamples);
-        meter_inL  -= meter_inL * 2.5 * numsamples / srate;
-        meter_inR  -= meter_inR * 2.5 * numsamples / srate;
-        meter_outL -= meter_outL * 2.5 * numsamples / srate;
-        meter_outR -= meter_outR * 2.5 * numsamples / srate;
-        
+        meter_inL = 0.f;
+        meter_inR = 0.f;
+        meter_outL = 0.f;
+        meter_outR = 0.f;
         while(offset < numsamples) {
             // cycle through samples
             float inL = ins[0][offset];
@@ -874,7 +869,7 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
             if(outR > 1.f) {
                 clip_outR = srate >> 3;
             }
-            // rise up in / out meters
+            // set up in / out meters
             if(inL > meter_inL) {
                 meter_inL = inL;
             }
@@ -1088,9 +1083,8 @@ void gain_reduction_audio_module::deactivate()
 
 void gain_reduction_audio_module::process(float &left, float &right)
 {
-    meter_out -= meter_out * 5.f * 1 / srate;
-    meter_comp += (1 - meter_comp) * 5.f * 1 / srate;
     float gain = 1.f;
+    float maxLR = 0.f;
     if(bypass < 0.5f) {
         // this routine is mainly copied from thor's compressor module
         // greatest sounding compressor I've heard!
@@ -1120,18 +1114,11 @@ void gain_reduction_audio_module::process(float &left, float &right)
         
         left *= gain;
         right *= gain;
-        
+        maxLR = std::max(fabs(left), fabs(right));
         detected = rms ? sqrt(linSlope) : linSlope;
     }
-    
-    float maxLR = std::max(fabs(left), fabs(right));
-    
-    if(maxLR > meter_out) {
-        meter_out = maxLR;
-    }
-    if(gain < meter_comp) {
-        meter_comp = gain;
-    }
+    meter_out = maxLR;
+    meter_comp = gain;
 }
 
 float gain_reduction_audio_module::output_level(float slope) {

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list