[SCM] calf/master: + GUI, Multiband Compressor, Toggle button: apply more fixes and additions by Markus Schmidt
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:36 UTC 2013
The following commit has been merged in the master branch:
commit 6717c99440d6bef04a16447145d8beb2b0b3f16e
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Oct 10 00:10:12 2009 +0100
+ GUI, Multiband Compressor, Toggle button: apply more fixes and additions by Markus Schmidt
diff --git a/gui/Makefile.am b/gui/Makefile.am
index 9e08702..66ba84e 100644
--- a/gui/Makefile.am
+++ b/gui/Makefile.am
@@ -1,2 +1,2 @@
-EXTRA_DIST = $(wildcard gui-*.xml) $(wildcard *.png)
+EXTRA_DIST = $(wildcard gui-*.xml) $(wildcard *.png) calf.rc
diff --git a/gui/calf.rc b/gui/calf.rc
new file mode 100644
index 0000000..d0d6b3a
--- /dev/null
+++ b/gui/calf.rc
@@ -0,0 +1,16 @@
+style "calf"
+{
+ fg[NORMAL] = { 0.2, 0.2, 0.2 }
+ fg[ACTIVE] = { 0.2, 0.2, 0.2 }
+ fg[PRELIGHT] = { 0.2, 0.2, 0.2 }
+ fg[SELECTED] = { 0.2, 0.2, 0.2 }
+ fg[INSENSITIVE] = { 0.2, 0.2, 0.2 }
+
+ bg[NORMAL] = { 0.86, 0.86, 0.87 }
+ bg[ACTIVE] = { 0.86, 0.86, 0.87 }
+ bg[PRELIGHT] = { 0.86, 0.86, 0.87 }
+ bg[SELECTED] = { 0.86, 0.86, 0.87 }
+ bg[INSENSITIVE] = { 0.86, 0.86, 0.87 }
+}
+
+class "GtkWidget" style "calf"
diff --git a/gui/gui-multibandcompressor.xml b/gui/gui-multibandcompressor.xml
new file mode 100644
index 0000000..091e5c6
--- /dev/null
+++ b/gui/gui-multibandcompressor.xml
@@ -0,0 +1,335 @@
+<table border="10" rows="2" cols="1">
+ <table attach-x="0" attach-y="0" expand-y="0" expand-x="1" spacing="5" rows="1" cols="11">
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="0" attach-y="0">
+ <label param="level_in" />
+ <knob param="level_in" size="4" />
+ <value param="level_in" />
+ </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" shrink-y="0" height="30" />
+ <vumeter param="meter_inR" mode="0" 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">
+ <label param="clip_inL" expand="0" fill="0" />
+ <led param="clip_inL" expand="0" fill="0" />
+ <led param="clip_inR" expand="0" fill="0" />
+ <label param="clip_inR" expand="0" fill="0" />
+ </vbox>
+ <table rows="3" cols="2" attach-x="4" attach-y="0" spacing="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <knob param="freq0" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ <value param="freq0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ </vbox>
+ <hbox attach-x="0" attach-y="1" border="0" fill-x="0">
+ <knob param="sep0" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="sep0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="sep0" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <hbox attach-x="0" attach-y="2" border="0" fill-x="0">
+ <knob param="q0" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="q0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="q0" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ </table>
+ <table rows="3" cols="2" attach-x="5" attach-y="0" spacing="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <knob param="freq1" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq1" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ <value param="freq1" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ </vbox>
+ <hbox attach-x="0" attach-y="1" border="0" fill-x="0">
+ <knob param="sep1" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="sep1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="sep1" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <hbox attach-x="0" attach-y="2" border="0" fill-x="0">
+ <knob param="q1" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="q1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="q1" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ </table>
+ <table rows="3" cols="2" attach-x="6" attach-y="0" spacing="0" border="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <knob param="freq2" attach-x="0" attach-y="0" border="0" expand="0" fill="0" expand-x="0" fill-x="0" />
+ <vbox attach-x="1" attach-y="0" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0">
+ <label param="freq2" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ <value param="freq2" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" align-x="0.0" />
+ </vbox>
+ <hbox attach-x="0" attach-y="1" border="0" fill-x="0">
+ <knob param="sep2" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="sep2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="sep2" attach-x="1" attach-y="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ <hbox attach-x="0" attach-y="2" border="0" fill-x="0">
+ <knob param="q2" type="1" size="1" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ <label param="q2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" />
+ </hbox>
+ <value param="q2" attach-x="1" attach-y="2" border="0" expand="0" fill="0" expand-y="0" fill-y="0" expand-x="0" fill-x="0" width="2" align-x="0.0" />
+ </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" shrink-y="0" height="30" />
+ <vumeter param="meter_outR" mode="0" 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">
+ <label param="clip_outL" expand="0" fill="0" />
+ <led param="clip_outL" expand="0" fill="0" />
+ <led param="clip_outR" expand="0" fill="0" />
+ <label param="clip_outR" expand="0" fill="0" />
+ </vbox>
+ <vbox shrink-x="1" expand-x="0" fill-x="0" expand="0" fill="0" attach-x="9" attach-y="0">
+ <label param="level_out" />
+ <knob param="level_out" size="4" />
+ <value param="level_out" />
+ </vbox>
+ <vbox expand="0" attach-x="10" attach-y="0" expand-x="0" fill-x="0" fill="0" pad-x="6" pad-y="21">
+ <label param="bypass"/>
+ <align><toggle param="bypass" shrink="1"/></align>
+ </vbox>
+ </table>
+ <table attach-x="0" attach-y="1" expand-y="1" shrink-y="1" expand-x="1" shrink-x="1" fill="1" spacing="10" 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"><vbox border="5">
+ <if cond="directlink">
+ <line-graph refresh="1" width="220" height="220" param="compression0" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+ </if>
+ <table shrink-y="1" expand-x="1" expand="0" cols="3" rows="1" fill-x="1">
+ <label param="detection0" attach-x="0" attach-y="0" shrink-x="1"/>
+ <label attach-x="1" attach-y="0" shrink-x="1" pad-x="5"/>
+ <combo param="detection0" attach-x="2" attach-y="0" fill-x="1" />
+ </table>
+ <table homogeneous="1" expand-y="0" expand-x="1" cols="3" rows="2" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="attack0" />
+ <knob param="attack0" />
+ <value param="attack0" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="release0" />
+ <knob param="release0" />
+ <value param="release0" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="0">
+ <label param="knee0" />
+ <knob param="knee0" />
+ <value param="knee0" />
+ </vbox>
+ <vbox expand="0" attach-x="0" attach-y="1">
+ <label param="threshold0" />
+ <knob param="threshold0"/>
+ <value param="threshold0" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="1">
+ <label param="ratio0" />
+ <knob param="ratio0" />
+ <value param="ratio0" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="1">
+ <label param="makeup0" />
+ <knob param="makeup0" />
+ <value param="makeup0" />
+ </vbox>
+ </table>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <label param="compression0" />
+ <vumeter param="compression0" mode="2" />
+ </vbox>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <vumeter param="output0" mode="0" shrink-y="0" />
+ <label param="output0" />
+ </vbox>
+ <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="bypass0"/>
+ <align><toggle size="1" param="bypass0" shrink="1"/></align>
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="mute0"/>
+ <align><toggle size="1" param="mute0" shrink="1"/></align>
+ </vbox>
+ </table>
+ </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"><vbox border="5">
+ <if cond="directlink">
+ <line-graph refresh="1" width="220" height="220" param="compression1" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+ </if>
+ <table shrink-y="1" expand-x="1" expand="0" cols="3" rows="1" fill-x="1">
+ <label param="detection1" attach-x="0" attach-y="0" shrink-x="1"/>
+ <label attach-x="1" attach-y="0" shrink-x="1" pad-x="5"/>
+ <combo param="detection1" attach-x="2" attach-y="0" fill-x="1" />
+ </table>
+ <table homogeneous="1" expand-y="0" expand-x="1" cols="3" rows="2" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="attack1" />
+ <knob param="attack1" />
+ <value param="attack1" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="release1" />
+ <knob param="release1" />
+ <value param="release1" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="0">
+ <label param="knee1" />
+ <knob param="knee1" />
+ <value param="knee1" />
+ </vbox>
+ <vbox expand="0" attach-x="0" attach-y="1">
+ <label param="threshold1" />
+ <knob param="threshold1"/>
+ <value param="threshold1" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="1">
+ <label param="ratio1" />
+ <knob param="ratio1" />
+ <value param="ratio1" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="1">
+ <label param="makeup1" />
+ <knob param="makeup1" />
+ <value param="makeup1" />
+ </vbox>
+ </table>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <label param="compression1" />
+ <vumeter param="compression1" mode="2" />
+ </vbox>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <vumeter param="output1" mode="0" shrink-y="0" />
+ <label param="output1" />
+ </vbox>
+ <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="bypass1"/>
+ <align><toggle size="1" param="bypass1" shrink="1"/></align>
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="mute1"/>
+ <align><toggle size="1" param="mute1" shrink="1"/></align>
+ </vbox>
+ </table>
+ </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"><vbox border="5">
+ <if cond="directlink">
+ <line-graph refresh="1" width="220" height="220" param="compression2" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+ </if>
+ <table shrink-y="1" expand-x="1" expand="0" cols="3" rows="1" fill-x="1">
+ <label param="detection2" attach-x="0" attach-y="0" shrink-x="1"/>
+ <label attach-x="1" attach-y="0" shrink-x="1" pad-x="5"/>
+ <combo param="detection2" attach-x="2" attach-y="0" fill-x="1" />
+ </table>
+ <table homogeneous="1" expand-y="0" expand-x="1" cols="3" rows="2" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="attack2" />
+ <knob param="attack2" />
+ <value param="attack2" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="release2" />
+ <knob param="release2" />
+ <value param="release2" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="0">
+ <label param="knee2" />
+ <knob param="knee2" />
+ <value param="knee2" />
+ </vbox>
+ <vbox expand="0" attach-x="0" attach-y="1">
+ <label param="threshold2" />
+ <knob param="threshold2"/>
+ <value param="threshold2" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="1">
+ <label param="ratio2" />
+ <knob param="ratio2" />
+ <value param="ratio2" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="1">
+ <label param="makeup2" />
+ <knob param="makeup2" />
+ <value param="makeup2" />
+ </vbox>
+ </table>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <label param="compression2" />
+ <vumeter param="compression2" mode="2" />
+ </vbox>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <vumeter param="output2" mode="0" shrink-y="0" />
+ <label param="output2" />
+ </vbox>
+ <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="bypass2"/>
+ <align><toggle size="1" param="bypass2" shrink="1"/></align>
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="mute2"/>
+ <align><toggle size="1" param="mute2" shrink="1"/></align>
+ </vbox>
+ </table>
+ </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"><vbox border="5">
+ <if cond="directlink">
+ <line-graph refresh="1" width="220" height="220" param="compression3" expand-y="1" fill-y="1" expand-x="1" fill-x="1"/>
+ </if>
+ <table shrink-y="1" expand-x="1" expand="0" cols="3" rows="1" fill-x="1">
+ <label param="detection3" attach-x="0" attach-y="0" shrink-x="1"/>
+ <label attach-x="1" attach-y="0" shrink-x="1" pad-x="5"/>
+ <combo param="detection3" attach-x="2" attach-y="0" fill-x="1"/>
+ </table>
+ <table homogeneous="1" expand-y="0" expand-x="1" cols="3" rows="2" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="attack3" />
+ <knob param="attack3" />
+ <value param="attack3" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="release3" />
+ <knob param="release3" />
+ <value param="release3" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="0">
+ <label param="knee3" />
+ <knob param="knee3" />
+ <value param="knee3" />
+ </vbox>
+ <vbox expand="0" attach-x="0" attach-y="1">
+ <label param="threshold3" />
+ <knob param="threshold3"/>
+ <value param="threshold3" />
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="1">
+ <label param="ratio3" />
+ <knob param="ratio3" />
+ <value param="ratio3" />
+ </vbox>
+ <vbox expand="0" attach-x="2" attach-y="1">
+ <label param="makeup3" />
+ <knob param="makeup3" />
+ <value param="makeup3" />
+ </vbox>
+ </table>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <label param="compression3" />
+ <vumeter param="compression3" mode="2" />
+ </vbox>
+ <vbox expand-x="1" fill-x="1" expand="1" fill="1">
+ <vumeter param="output3" mode="0" shrink-y="0" />
+ <label param="output3" />
+ </vbox>
+ <table expand-y="0" expand-x="1" cols="3" rows="1" spacing="5">
+ <vbox expand="0" attach-x="0" attach-y="0">
+ <label param="bypass3"/>
+ <align><toggle size="1" param="bypass3" shrink="1"/></align>
+ </vbox>
+ <vbox expand="0" attach-x="1" attach-y="0">
+ <label param="mute3"/>
+ <align><toggle size="1" param="mute3" shrink="1"/></align>
+ </vbox>
+ </table>
+ </vbox></frame>
+ </table>
+</table>
diff --git a/gui/toggle1.png b/gui/toggle1.png
index 8b1433b..c4abc0e 100644
Binary files a/gui/toggle1.png and b/gui/toggle1.png differ
diff --git a/gui/toggle2.png b/gui/toggle2.png
index aaf88b8..ea1627c 100644
Binary files a/gui/toggle2.png and b/gui/toggle2.png differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 9f6c4d3..8c306e6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -85,6 +85,7 @@ install-data-hook:
install -c -m 644 $(top_srcdir)/gui/*.png $(DESTDIR)$(pkgdatadir)
$(top_builddir)/src/calfmakerdf -m gui -p $(DESTDIR)$(pkgdatadir)
install -c -m 644 $(top_srcdir)/gui/gui-*.xml $(DESTDIR)$(pkgdatadir)
+ install -c -m 644 $(top_srcdir)/gui/calf.rc $(DESTDIR)$(pkgdatadir)
if USE_JACK
install -c -m 644 $(top_srcdir)/calf.glade $(DESTDIR)$(pkgdatadir)
endif
@@ -124,6 +125,7 @@ if USE_JACK
endif
rm -f $(DESTDIR)$(pkgdatadir)/gui-*.xml
rm -f $(DESTDIR)$(pkgdatadir)/presets.xml
+ rm -f $(DESTDIR)$(pkgdatadir)/calf.rc
rm -f $(DESTDIR)$(pkgdatadir)/knob1.png
rm -f $(DESTDIR)$(pkgdatadir)/knob2.png
rm -f $(DESTDIR)$(pkgdatadir)/knob3.png
diff --git a/src/calf/custom_ctl.h b/src/calf/custom_ctl.h
index 73fad88..33f99fd 100644
--- a/src/calf/custom_ctl.h
+++ b/src/calf/custom_ctl.h
@@ -117,6 +117,29 @@ extern GtkWidget *calf_knob_new_with_adjustment(GtkAdjustment *_adjustment);
extern GType calf_knob_get_type();
+#define CALF_TYPE_TOGGLE (calf_toggle_get_type())
+#define CALF_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_TOGGLE, CalfToggle))
+#define CALF_IS_TOGGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_TOGGLE))
+#define CALF_TOGGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_TOGGLE, CalfToggleClass))
+#define CALF_IS_TOGGLE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_TOGGLE))
+
+struct CalfToggle
+{
+ GtkRange parent;
+ int size;
+};
+
+struct CalfToggleClass
+{
+ GtkRangeClass parent_class;
+ GdkPixbuf *toggle_image[2];
+};
+
+extern GtkWidget *calf_toggle_new();
+extern GtkWidget *calf_toggle_new_with_adjustment(GtkAdjustment *_adjustment);
+
+extern GType calf_toggle_get_type();
+
G_END_DECLS
class cairo_impl: public calf_plugins::cairo_iface
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 63d165e..4a23300 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -190,6 +190,7 @@ struct line_graph_iface
virtual bool get_static_graph(int index, int subindex, float value, float *data, int points, cairo_iface *context) { return false; }
/// Return which graphs need to be redrawn and which can be cached for later reuse
+ /// @param index Parameter/graph number (usually tied to particular plugin control port)
/// @param generation 0 (at start) or the last value returned by the function (corresponds to a set of input values)
/// @param subindex_graph First graph that has to be redrawn (because it depends on values that might have changed)
/// @param subindex_dot First dot that has to be redrawn
diff --git a/src/calf/gui.h b/src/calf/gui.h
index e730e72..6b70538 100644
--- a/src/calf/gui.h
+++ b/src/calf/gui.h
@@ -201,20 +201,24 @@ struct spin_param_control: public param_control
static void value_changed(GtkSpinButton *widget, gpointer value);
};
-/// Check box
+/// Check box (Markus Schmidt)
+struct check_param_control: public param_control
+{
+ virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
+ virtual void get();
+ virtual void set();
+
+ static void check_value_changed(GtkCheckButton *widget, gpointer value);
+};
+
+/// Toggle Button
struct toggle_param_control: public param_control
{
virtual GtkWidget *create(plugin_gui *_gui, int _param_no);
virtual void get();
virtual void set();
- static const int sizes = 2;
- GdkPixbuf *pb;
- GdkPixmap *pm_on;
- GdkPixmap *pm_off;
- GdkPixbuf *pb_on;
- GdkPixbuf *pb_off;
- static void toggle_value_changed(GtkCheckButton *widget, gpointer value);
+ static void toggle_value_changed(GtkWidget *widget, gpointer value);
};
/// Push button
diff --git a/src/calf/modules.h b/src/calf/modules.h
index de0e46c..d1545eb 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -902,7 +902,7 @@ private:
float linSlope, detected, kneeSqrt, kneeStart, linKneeStart, kneeStop;
float compressedKneeStop, adjKneeStart, thres;
float attack, release, threshold, ratio, knee, makeup, detection, bypass, mute, meter_out, meter_comp;
- float old_threshold, old_ratio, old_knee, old_makeup, old_bypass;
+ float old_threshold, old_ratio, old_knee, old_makeup, old_bypass, old_mute, old_detection;
int last_generation;
uint32_t srate;
bool is_active;
@@ -928,8 +928,6 @@ public:
class multibandcompressor_audio_module: public audio_module<multibandcompressor_metadata>, public line_graph_iface {
private:
static const int strips = 4;
- float meter_out[strips];
- float meter_comp[strips];
bool mute[strips];
uint32_t clip_inL, clip_inR, clip_outL, clip_outR;
float meter_inL, meter_inR, meter_outL, meter_outR;
@@ -954,7 +952,6 @@ public:
virtual int get_changed_offsets(int index, int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline);
};
-
/// Filterclavier --- MIDI controlled filter by Hans Baier
class filterclavier_audio_module:
public audio_module<filterclavier_metadata>,
diff --git a/src/ctl_led.cpp b/src/ctl_led.cpp
index 71d66a4..3626d9a 100644
--- a/src/ctl_led.cpp
+++ b/src/ctl_led.cpp
@@ -43,10 +43,10 @@ calf_led_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_rectangle(c, 0, 0, widget->allocation.width, widget->allocation.height);
cairo_fill(c);
- int ox = 1;
- int oy = 1;
- int sx = widget->allocation.width - 2;
- int sy = widget->allocation.height - 2;
+ int ox = 2;
+ int oy = 2;
+ int sx = widget->allocation.width - 4;
+ int sy = widget->allocation.height - 4;
int xc = widget->allocation.width / 2;
int yc = widget->allocation.height / 2;
@@ -65,7 +65,7 @@ calf_led_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_set_line_width(c, 1);
cairo_stroke(c);
- gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 1, oy - 1, sx + 2, sy + 2);
+ gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 2, oy - 2, sx + 4, sy + 4);
cairo_destroy(c);
@@ -99,7 +99,7 @@ calf_led_size_request (GtkWidget *widget,
g_assert(CALF_IS_LED(widget));
requisition->width = 22;
- requisition->height = 14;
+ requisition->height = 16;
}
static void
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 969ab7c..16fc21c 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -69,7 +69,7 @@ calf_line_graph_copy_window_to_cache( CalfLineGraph *lg, cairo_t *c )
static void
calf_line_graph_draw_grid( cairo_t *c, std::string &legend, bool vertical, float pos, int phase, int sx, int sy )
{
- int ox=1, oy=1;
+ int ox=2, oy=2;
cairo_text_extents_t tx;
if (!legend.empty())
cairo_text_extents(c, legend.c_str(), &tx);
@@ -109,7 +109,7 @@ calf_line_graph_draw_grid( cairo_t *c, std::string &legend, bool vertical, float
static void
calf_line_graph_draw_graph( cairo_t *c, float *data, int sx, int sy )
{
- int ox=1, oy=1;
+ int ox=2, oy=2;
for (int i = 0; i < 2 * sx; i++)
{
@@ -131,11 +131,11 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
CalfLineGraph *lg = CALF_LINE_GRAPH(widget);
//int ox = widget->allocation.x + 1, oy = widget->allocation.y + 1;
- int ox = 1, oy = 1;
+ int ox = 2, oy = 2;
int sx = widget->allocation.width - 2, sy = widget->allocation.height - 2;
cairo_t *c = gdk_cairo_create(GDK_DRAWABLE(widget->window));
- GtkStyle *style;
+ GtkStyle *style;
style = gtk_widget_get_style(widget);
GdkColor sc = { 0, 0, 0, 0 };
@@ -187,14 +187,17 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_set_font_size(cache_cr, 9);
cairo_pattern_t *pt = cairo_pattern_create_linear(ox, oy, ox, sy);
- cairo_pattern_add_color_stop_rgb(pt, 0.0, 0.85, 0.95, 0.45);
- cairo_pattern_add_color_stop_rgb(pt, 0.5, 0.8, 0.9, 0.4);
- cairo_pattern_add_color_stop_rgb(pt, 1.0, 0.85, 0.95, 0.45);
+ cairo_pattern_add_color_stop_rgb(pt, 0.0, 0.69, 0.79, 0.35);
+ cairo_pattern_add_color_stop_rgb(pt, 0.025, 0.84, 0.94, 0.49);
+ cairo_pattern_add_color_stop_rgb(pt, 0.5, 0.78, 0.89, 0.45);
+ cairo_pattern_add_color_stop_rgb(pt, 0.500001,0.76, 0.87, 0.38);
+ cairo_pattern_add_color_stop_rgb(pt, 1.0, 0.89, 1.00, 0.45);
//gdk_cairo_set_source_color(cache_cr, &sc);
cairo_set_source (cache_cr, pt);
cairo_rectangle(cache_cr, ox, oy, sx, sy);
cairo_clip_preserve(cache_cr);
cairo_fill_preserve(cache_cr);
+
// cairo_set_source_rgba(cache_cr, 0, 0, 0, 0.5);
// cairo_set_line_width(cache_cr, 1);
// cairo_stroke(cache_cr);
@@ -269,7 +272,7 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_destroy(c);
- gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 1, oy - 1, sx + 2, sy + 2);
+ gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 2, oy - 2, sx + 4, sy + 4);
// printf("exposed %p %dx%d %d+%d\n", widget->window, event->area.x, event->area.y, event->area.width, event->area.height);
return TRUE;
@@ -409,68 +412,70 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
CalfVUMeter *vu = CALF_VUMETER(widget);
GtkStyle *style;
//int ox = widget->allocation.x + 1, oy = widget->allocation.y + 1;
- int ox = 1, oy = 1;
- int sx = widget->allocation.width - 1 - ((widget->allocation.width - 2) % 3), sy = widget->allocation.height - 2;
+ int ox = 2, oy = 2;
+ // if only 1 px border:
+ // int sx = widget->allocation.width - 1 - ((widget->allocation.width - 2) % 3), sy = widget->allocation.height - 2;
+ int sx = widget->allocation.width - 4 - ((widget->allocation.width - 2) % 3), sy = widget->allocation.height - 4;
style = gtk_widget_get_style(widget);
cairo_t *c = gdk_cairo_create(GDK_DRAWABLE(widget->window));
if( vu->cache_surface == NULL ) {
- // looks like its either first call or the widget has been resized.
- // create the cache_surface.
- cairo_surface_t *window_surface = cairo_get_target( c );
- vu->cache_surface = cairo_surface_create_similar( window_surface,
- CAIRO_CONTENT_COLOR,
- widget->allocation.width,
- widget->allocation.height );
+ // looks like its either first call or the widget has been resized.
+ // create the cache_surface.
+ cairo_surface_t *window_surface = cairo_get_target( c );
+ vu->cache_surface = cairo_surface_create_similar( window_surface,
+ CAIRO_CONTENT_COLOR,
+ widget->allocation.width,
+ widget->allocation.height );
- // And render the meterstuff again.
+ // And render the meterstuff again.
- cairo_t *cache_cr = cairo_create( vu->cache_surface );
- GdkColor sc = { 0, 0, 0, 0 };
- gdk_cairo_set_source_color(cache_cr,&style->bg[GTK_STATE_NORMAL]);
- cairo_paint(cache_cr);
- gdk_cairo_set_source_color(cache_cr, &sc);
- cairo_rectangle(cache_cr, ox, oy, sx, sy);
- cairo_fill(cache_cr);
- cairo_set_line_width(cache_cr, 1);
-
- for (int x = ox + 1; x <= ox + sx - 3; x += 3)
- {
- float ts = (x - ox) * 1.0 / sx;
- float r = 0.f, g = 0.f, b = 0.f;
- switch(vu->mode)
+ cairo_t *cache_cr = cairo_create( vu->cache_surface );
+ GdkColor sc = { 0, 0, 0, 0 };
+ gdk_cairo_set_source_color(cache_cr,&style->bg[GTK_STATE_NORMAL]);
+ cairo_paint(cache_cr);
+ gdk_cairo_set_source_color(cache_cr, &sc);
+ cairo_rectangle(cache_cr, ox, oy, sx, sy);
+ cairo_fill(cache_cr);
+ cairo_set_line_width(cache_cr, 1);
+
+ for (int x = ox + 1; x <= ox + sx - 3; x += 3)
{
- case VU_STANDARD:
- default:
- if (ts < 0.75)
- r = ts / 0.75, g = 0.5 + ts * 0.66, b = 1 - ts / 0.75;
- else
- r = 1, g = 1 - (ts - 0.75) / 0.25, b = 0;
- // if (vu->value < ts || vu->value <= 0)
- // r *= 0.5, g *= 0.5, b *= 0.5;
- break;
- case VU_MONOCHROME_REVERSE:
- r = 0, g = 170.0 / 255.0, b = 1;
- // if (!(vu->value < ts) || vu->value >= 1.0)
- // r *= 0.5, g *= 0.5, b *= 0.5;
- break;
- case VU_MONOCHROME:
- r = 0, g = 170.0 / 255.0, b = 1;
- // if (vu->value < ts || vu->value <= 0)
- // r *= 0.5, g *= 0.5, b *= 0.5;
- break;
+ float ts = (x - ox) * 1.0 / sx;
+ float r = 0.f, g = 0.f, b = 0.f;
+ switch(vu->mode)
+ {
+ case VU_STANDARD:
+ default:
+ if (ts < 0.75)
+ r = ts / 0.75, g = 0.5 + ts * 0.66, b = 1 - ts / 0.75;
+ else
+ r = 1, g = 1 - (ts - 0.75) / 0.25, b = 0;
+ // if (vu->value < ts || vu->value <= 0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ case VU_MONOCHROME_REVERSE:
+ r = 0, g = 170.0 / 255.0, b = 1;
+ // if (!(vu->value < ts) || vu->value >= 1.0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ case VU_MONOCHROME:
+ r = 0, g = 170.0 / 255.0, b = 1;
+ // if (vu->value < ts || vu->value <= 0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ }
+ GdkColor sc2 = { 0, (guint16)(65535 * r + 0.2), (guint16)(65535 * g), (guint16)(65535 * b) };
+ GdkColor sc3 = { 0, (guint16)(65535 * r * 0.7), (guint16)(65535 * g * 0.7), (guint16)(65535 * b * 0.7) };
+ gdk_cairo_set_source_color(cache_cr, &sc2);
+ cairo_move_to(cache_cr, x + 0.5, oy + 1);
+ cairo_line_to(cache_cr, x + 0.5, oy + sy - 1);
+ cairo_stroke(cache_cr);
+ gdk_cairo_set_source_color(cache_cr, &sc3);
+ cairo_move_to(cache_cr, x + 1.5, oy + sy - 1);
+ cairo_line_to(cache_cr, x + 1.5, oy + 1);
+ cairo_stroke(cache_cr);
}
- GdkColor sc2 = { 0, (guint16)(65535 * r + 0.2), (guint16)(65535 * g), (guint16)(65535 * b) };
- GdkColor sc3 = { 0, (guint16)(65535 * r * 0.7), (guint16)(65535 * g * 0.7), (guint16)(65535 * b * 0.7) };
- gdk_cairo_set_source_color(cache_cr, &sc2);
- cairo_move_to(cache_cr, x + 0.5, oy + 1);
- cairo_line_to(cache_cr, x + 0.5, oy + sy - 1);
- cairo_stroke(cache_cr);
- gdk_cairo_set_source_color(cache_cr, &sc3);
- cairo_move_to(cache_cr, x + 1.5, oy + sy - 1);
- cairo_line_to(cache_cr, x + 1.5, oy + 1);
- cairo_stroke(cache_cr);
- }
cairo_destroy( cache_cr );
}
@@ -478,18 +483,17 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
cairo_paint( c );
cairo_set_source_rgba( c, 0,0,0, 0.6 );
+ float value = vu->value > 1.f ? 1.f : vu->value;
if( vu->mode == VU_MONOCHROME_REVERSE )
- cairo_rectangle( c, ox,oy, vu->value * sx, sy );
+ cairo_rectangle( c, ox + 1,oy + 1, value * (sx - 2), sy - 2);
else
- cairo_rectangle( c, ox + vu->value * sx, oy, sx * (1 - vu->value), sy );
-
+ cairo_rectangle( c, ox + 1 + value * (sx - 2), oy + 1, (sx - 2) * (1 - value), sy - 2 );
+
cairo_fill( c );
-
-
-
+
cairo_destroy(c);
- gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 1, oy - 1, sx + 2, sy + 2);
+ gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 2, oy - 2, sx + 4, sy + 4);
//printf("exposed %p %d+%d\n", widget->window, widget->allocation.x, widget->allocation.y);
return TRUE;
@@ -502,7 +506,7 @@ calf_vumeter_size_request (GtkWidget *widget,
g_assert(CALF_IS_VUMETER(widget));
requisition->width = 50;
- requisition->height = 14;
+ requisition->height = 16;
}
static void
@@ -517,7 +521,7 @@ calf_vumeter_size_allocate (GtkWidget *widget,
parent_class->size_allocate( widget, allocation );
if( vu->cache_surface )
- cairo_surface_destroy( vu->cache_surface );
+ cairo_surface_destroy( vu->cache_surface );
vu->cache_surface = NULL;
}
@@ -536,7 +540,7 @@ calf_vumeter_init (CalfVUMeter *self)
GtkWidget *widget = GTK_WIDGET(self);
//GTK_WIDGET_SET_FLAGS (widget, GTK_NO_WINDOW);
widget->requisition.width = 50;
- widget->requisition.height = 15;
+ widget->requisition.height = 16;
self->value = 0.5;
self->cache_surface = NULL;
}
@@ -927,3 +931,149 @@ calf_knob_get_type (void)
}
return type;
}
+
+///////////////////////////////////////// toggle ///////////////////////////////////////////////
+
+static gboolean
+calf_toggle_expose (GtkWidget *widget, GdkEventExpose *event)
+{
+ g_assert(CALF_IS_TOGGLE(widget));
+
+ CalfToggle *self = CALF_TOGGLE(widget);
+ GdkWindow *window = widget->window;
+
+ int ox = widget->allocation.x, oy = widget->allocation.y;
+ int width = self->size * 30, height = self->size * 20;
+
+ gdk_draw_pixbuf(GDK_DRAWABLE(widget->window), widget->style->fg_gc[0], CALF_TOGGLE_CLASS(GTK_OBJECT_GET_CLASS(widget))->toggle_image[self->size - 1], 0, height * gtk_range_get_value(GTK_RANGE(widget)), ox, oy, width, height, GDK_RGB_DITHER_NORMAL, 0, 0);
+ if (gtk_widget_is_focus(widget))
+ {
+ gtk_paint_focus(widget->style, window, GTK_STATE_NORMAL, NULL, widget, NULL, ox, oy, width, height);
+ }
+
+ return TRUE;
+}
+
+static void
+calf_toggle_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ g_assert(CALF_IS_TOGGLE(widget));
+
+ CalfToggle *self = CALF_TOGGLE(widget);
+
+ requisition->width = 30 * self->size;
+ requisition->height = 20 * self->size;
+}
+
+static gboolean
+calf_toggle_button_press (GtkWidget *widget, GdkEventButton *event)
+{
+ g_assert(CALF_IS_TOGGLE(widget));
+ GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(widget));
+ if (gtk_range_get_value(GTK_RANGE(widget)) == adj->lower)
+ {
+ gtk_range_set_value(GTK_RANGE(widget), adj->upper);
+ } else {
+ gtk_range_set_value(GTK_RANGE(widget), adj->lower);
+ }
+ return TRUE;
+}
+
+static gboolean
+calf_toggle_key_press (GtkWidget *widget, GdkEventKey *event)
+{
+ switch(event->keyval)
+ {
+ case GDK_Return:
+ case GDK_KP_Enter:
+ case GDK_space:
+ return calf_toggle_button_press(widget, NULL);
+ }
+ return FALSE;
+}
+
+static void
+calf_toggle_class_init (CalfToggleClass *klass)
+{
+ // GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+ widget_class->expose_event = calf_toggle_expose;
+ widget_class->size_request = calf_toggle_size_request;
+ widget_class->button_press_event = calf_toggle_button_press;
+ widget_class->key_press_event = calf_toggle_key_press;
+ GError *error = NULL;
+ klass->toggle_image[0] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle1.png", &error);
+ klass->toggle_image[1] = gdk_pixbuf_new_from_file(PKGLIBDIR "/toggle2.png", &error);
+ g_assert(klass->toggle_image != NULL);
+}
+
+static void
+calf_toggle_init (CalfToggle *self)
+{
+ GtkWidget *widget = GTK_WIDGET(self);
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET(self), GTK_CAN_FOCUS);
+ widget->requisition.width = 30;
+ widget->requisition.height = 20;
+ self->size = 1;
+}
+
+GtkWidget *
+calf_toggle_new()
+{
+ GtkAdjustment *adj = (GtkAdjustment *)gtk_adjustment_new(0, 0, 1, 1, 0, 0);
+ return calf_toggle_new_with_adjustment(adj);
+}
+
+static gboolean calf_toggle_value_changed(gpointer obj)
+{
+ GtkWidget *widget = (GtkWidget *)obj;
+ gtk_widget_queue_draw(widget);
+ return FALSE;
+}
+
+GtkWidget *calf_toggle_new_with_adjustment(GtkAdjustment *_adjustment)
+{
+ GtkWidget *widget = GTK_WIDGET( g_object_new (CALF_TYPE_TOGGLE, NULL ));
+ if (widget) {
+ gtk_range_set_adjustment(GTK_RANGE(widget), _adjustment);
+ gtk_signal_connect(GTK_OBJECT(widget), "value-changed", G_CALLBACK(calf_toggle_value_changed), widget);
+ }
+ return widget;
+}
+
+GType
+calf_toggle_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+
+ static const GTypeInfo type_info = {
+ sizeof(CalfToggleClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc)calf_toggle_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof(CalfToggle),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc)calf_toggle_init
+ };
+
+ for (int i = 0; ; i++) {
+ char *name = g_strdup_printf("CalfToggle%u%d",
+ ((unsigned int)(intptr_t)calf_toggle_class_init) >> 16, i);
+ if (g_type_from_name(name)) {
+ free(name);
+ continue;
+ }
+ type = g_type_register_static( GTK_TYPE_RANGE,
+ name,
+ &type_info,
+ (GTypeFlags)0);
+ free(name);
+ break;
+ }
+ }
+ return type;
+}
diff --git a/src/gui.cpp b/src/gui.cpp
index 0f49159..c58c606 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -368,29 +368,29 @@ void led_param_control::set()
// check box
-GtkWidget *toggle_param_control::create(plugin_gui *_gui, int _param_no)
+GtkWidget *check_param_control::create(plugin_gui *_gui, int _param_no)
{
gui = _gui;
param_no = _param_no;
widget = gtk_check_button_new ();
- gtk_signal_connect (GTK_OBJECT (widget), "toggled", G_CALLBACK (toggle_value_changed), (gpointer)this);
+ gtk_signal_connect (GTK_OBJECT (widget), "toggled", G_CALLBACK (check_value_changed), (gpointer)this);
return widget;
}
-void toggle_param_control::toggle_value_changed(GtkCheckButton *widget, gpointer value)
+void check_param_control::check_value_changed(GtkCheckButton *widget, gpointer value)
{
param_control *jhp = (param_control *)value;
jhp->get();
}
-void toggle_param_control::get()
+void check_param_control::get()
{
const parameter_properties &props = get_props();
gui->set_param_value(param_no, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)) + props.min, this);
}
-void toggle_param_control::set()
+void check_param_control::set()
{
_GUARD_CHANGE_
const parameter_properties &props = get_props();
@@ -515,6 +515,49 @@ void knob_param_control::knob_value_changed(GtkWidget *widget, gpointer value)
jhp->get();
}
+// Toggle Button
+
+GtkWidget *toggle_param_control::create(plugin_gui *_gui, int _param_no)
+{
+ gui = _gui;
+ param_no = _param_no;
+ widget = calf_toggle_new ();
+
+ CALF_TOGGLE(widget)->size = get_int("size", 2);
+ if(CALF_TOGGLE(widget)->size > 2) {
+ CALF_TOGGLE(widget)->size = 2;
+ } else if (CALF_TOGGLE(widget)->size < 1) {
+ CALF_TOGGLE(widget)->size = 1;
+ }
+
+ gtk_signal_connect (GTK_OBJECT (widget), "value-changed", G_CALLBACK (toggle_value_changed), (gpointer)this);
+ return widget;
+}
+
+void toggle_param_control::get()
+{
+ const parameter_properties &props = get_props();
+ float value = props.from_01(gtk_range_get_value(GTK_RANGE(widget)));
+ gui->set_param_value(param_no, value, this);
+ if (label)
+ update_label();
+}
+
+void toggle_param_control::set()
+{
+ _GUARD_CHANGE_
+ const parameter_properties &props = get_props();
+ gtk_range_set_value(GTK_RANGE(widget), props.to_01 (gui->plugin->get_param_value(param_no)));
+ if (label)
+ update_label();
+}
+
+void toggle_param_control::toggle_value_changed(GtkWidget *widget, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ jhp->get();
+}
+
// keyboard
GtkWidget *keyboard_param_control::create(plugin_gui *_gui, int _param_no)
@@ -990,6 +1033,8 @@ param_control *plugin_gui::create_control_from_xml(const char *element, const ch
return new vscale_param_control;
if (!strcmp(element, "combo"))
return new combo_box_param_control;
+ if (!strcmp(element, "check"))
+ return new check_param_control;
if (!strcmp(element, "toggle"))
return new toggle_param_control;
if (!strcmp(element, "spin"))
diff --git a/src/modules.cpp b/src/modules.cpp
index 08a72de..a697dbd 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -240,20 +240,20 @@ CALF_PORT_NAMES(multibandcompressor) = {"In L", "In R", "Out L", "Out R"};
const char *multibandcompressor_detection_names[] = { "RMS", "Peak" };
CALF_PORT_PROPS(multibandcompressor) = {
- { 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", "Input" },
- { 1, 0, 64, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_out", "Output" },
- { 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_inL", "Input L" },
- { 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_inR", "Input R" },
- { 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_outL", "Output L" },
- { 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_outR", "Output R" },
+ { 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", "Input" },
+ { 1, 0, 64, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_NOBOUNDS, NULL, "level_out", "Output" },
+ { 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_inL", "Input L" },
+ { 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_inR", "Input R" },
+ { 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_outL", "Output L" },
+ { 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_outR", "Output R" },
{ 0, 0, 1, 0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_inL", "0dB" },
{ 0, 0, 1, 0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_inR", "0dB" },
{ 0, 0, 1, 0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outL", "0dB" },
{ 0, 0, 1, 0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outR", "0dB" },
- { 120, 10, 20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
- { 1200, 10, 20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq1", "Split 2/3" },
+ { 100, 10, 20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
+ { 1000, 10, 20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq1", "Split 2/3" },
{ 6000, 10, 20000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq2", "Split 3/4" },
{ -0.17, -0.5, 0.5, 0, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_KNOB | PF_UNIT_COEF | PF_PROP_GRAPH, NULL, "sep0", "S" },
@@ -317,7 +317,9 @@ CALF_PORT_PROPS(multibandcompressor) = {
{ 0, 0, 1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "mute3", "Mute" },
};
-CALF_PLUGIN_INFO(multibandcompressor) = { 0x8502, "MultibandCompressor", "Calf Multiband Compressor", "Markus Schmidt / Thor Harald Johansen", calf_plugins::calf_copyright_info, "CompressorPlugin" };
+CALF_PLUGIN_INFO(multibandcompressor) = { 0x8502, "Multibandcompressor", "Calf Multiband Compressor", "Markus Schmidt / Thor Harald Johansen", calf_plugins::calf_copyright_info, "CompressorPlugin" };
+
+////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index 8ce742d..3f6b720 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -520,9 +520,12 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
bool bypass = *params[param_bypass] > 0.5f;
if(bypass) {
- int count = numsamples * sizeof(float);
- memcpy(outs[0], ins[0], count);
- memcpy(outs[1], ins[1], count);
+ numsamples += offset;
+ while(offset < numsamples) {
+ outs[0][offset] = ins[0][offset];
+ outs[1][offset] = ins[1][offset];
+ ++offset;
+ }
if(params[param_compression] != NULL) {
*params[param_compression] = 1.f;
@@ -638,14 +641,21 @@ uint32_t compressor_audio_module::process(uint32_t offset, uint32_t numsamples,
return inputs_mask;
}
+
/// Multibandcompressor by Markus Schmidt
+///
+/// This module splits the signal in four different bands
+/// and sends them through multiple filters (implemented by
+/// Krzysztof). They are processed by a compressing routine
+/// (implemented by Thor) afterwards and summed up to the
+/// final output again.
///////////////////////////////////////////////////////////////////////////////////////////////
multibandcompressor_audio_module::multibandcompressor_audio_module()
{
is_active = false;
srate = 0;
- // zero all dsplays
+ // zero all displays
clip_inL = 0.f;
clip_inR = 0.f;
clip_outL = 0.f;
@@ -769,16 +779,13 @@ 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 * 5.f * numsamples / srate;
- meter_inR -= meter_inR * 5.f * numsamples / srate;
- meter_outL -= meter_outL * 5.f * numsamples / srate;
- meter_outR -= meter_outR * 5.f * numsamples / srate;
- for(int k = 0; k < strips; k ++) {
- meter_out[k] -= meter_out[k] * 5.f * numsamples / srate;
- }
+ 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;
while(offset < numsamples) {
- // cycle trough samples
+ // cycle through samples
float inL = ins[0][offset];
float inR = ins[1][offset];
// in level
@@ -842,7 +849,7 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
} // process single strip
// even out filters gain reduction
- // 3dB - levelled manually (based on sep and q settings)
+ // 3dB - levelled manually (based on default sep and q settings)
outL *= 1.414213562;
outR *= 1.414213562;
@@ -867,22 +874,21 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
if(outR > 1.f) {
clip_outR = srate >> 3;
}
- // in / out meters
- if(meter_inL < inL) {
+ // rise up in / out meters
+ if(inL > meter_inL) {
meter_inL = inL;
}
- if(meter_inR < inR) {
+ if(inR > meter_inR) {
meter_inR = inR;
}
- if(meter_outL < outL) {
+ if(outL > meter_outL) {
meter_outL = outL;
}
- if(meter_outR < outR) {
+ if(outR > meter_outR) {
meter_outR = outR;
}
// next sample
++offset;
-// printf("inL: %+7.4f inR: %+7.4f outL: %+7.4f outR: %+7.4f input: %+7.4f output: %+7.4f\n", inL, inR, outL, outR, *params[param_level_in], *params[param_level_out]);
} // cycle trough samples
} // process all strips (no bypass)
@@ -971,8 +977,8 @@ uint32_t multibandcompressor_audio_module::process(uint32_t offset, uint32_t num
return outputs_mask;
}
bool multibandcompressor_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context)
-{
-// printf("get_graph : %i\n", index);
+{
+ // let's handle by the corresponding strip
switch (index) {
case param_compression0:
return strip[0].get_graph(subindex, data, points, context);
@@ -992,7 +998,7 @@ bool multibandcompressor_audio_module::get_graph(int index, int subindex, float
bool multibandcompressor_audio_module::get_dot(int index, int subindex, float &x, float &y, int &size, cairo_iface *context)
{
-// printf("get_dot : %i\n", index);
+ // let's handle by the corresponding strip
switch (index) {
case param_compression0:
return strip[0].get_dot(subindex, x, y, size, context);
@@ -1012,7 +1018,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)
{
-// printf("get_gridline: %i\n", index);
+ // let's handle by the corresponding strip
switch (index) {
case param_compression0:
return strip[0].get_gridline(subindex, pos, vertical, legend, context);
@@ -1031,8 +1037,8 @@ bool multibandcompressor_audio_module::get_gridline(int index, int subindex, flo
}
int multibandcompressor_audio_module::get_changed_offsets(int index, int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline)
-{
-// printf("get_changed : %i\n", index);
+{
+ // let's handle by the corresponding strip
switch (index) {
case param_compression0:
return strip[0].get_changed_offsets(generation, subindex_graph, subindex_dot, subindex_gridline);
@@ -1049,7 +1055,11 @@ int multibandcompressor_audio_module::get_changed_offsets(int index, int generat
}
return 0;
}
-/// Gain reduction module by Markus Schmidt
+/// Gain reduction module implemented by Markus Schmidt
+/// Nearly all functions of this module are originally written
+/// by Thor, while some features have been stripped (mainly stereo linking
+/// and frequency correction as implemented in his Compressor above)
+/// To save some CPU.
////////////////////////////////////////////////////////////////////////////////
gain_reduction_audio_module::gain_reduction_audio_module()
{
@@ -1060,10 +1070,11 @@ gain_reduction_audio_module::gain_reduction_audio_module()
void gain_reduction_audio_module::activate()
{
is_active = true;
- linSlope = 0.f;
- meter_out = 0.f;
- meter_comp = 0.f;
+ linSlope = 0.f;
+ meter_out = 0.f;
+ meter_comp = 1.f;
float l, r;
+ l = r = 0.f;
float byp = bypass;
bypass = 0.0;
process(l, r);
@@ -1077,52 +1088,50 @@ void gain_reduction_audio_module::deactivate()
void gain_reduction_audio_module::process(float &left, float &right)
{
- if(bypass > 0.5f) {
- meter_comp = 1.f;
- meter_out = 0.f;
- return;
- }
- // this routine is mainly copied from thor's compressor module
- // greatest sounding compressor I've heard!
- bool rms = detection == 0;
- float linThreshold = threshold;
- 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 linKneeSqrt = sqrt(knee);
- linKneeStart = linThreshold / linKneeSqrt;
- adjKneeStart = linKneeStart*linKneeStart;
- float linKneeStop = linThreshold * linKneeSqrt;
- thres = log(linThreshold);
- kneeStart = log(linKneeStart);
- kneeStop = log(linKneeStop);
- compressedKneeStop = (kneeStop - thres) / ratio + thres;
float compression = 1.f;
- float absample = (fabs(left) + fabs(right)) * 0.5f;
- if(rms) absample *= absample;
meter_out -= meter_out * 5.f * 1 / srate;
-
- linSlope += (absample - linSlope) * (absample > linSlope ? attack_coeff : release_coeff);
-
- float gain = 1.f;
+ if(bypass < 0.5f) {
+ // this routine is mainly copied from thor's compressor module
+ // greatest sounding compressor I've heard!
+ bool rms = detection == 0;
+ float linThreshold = threshold;
+ 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 linKneeSqrt = sqrt(knee);
+ linKneeStart = linThreshold / linKneeSqrt;
+ adjKneeStart = linKneeStart*linKneeStart;
+ float linKneeStop = linThreshold * linKneeSqrt;
+ thres = log(linThreshold);
+ kneeStart = log(linKneeStart);
+ kneeStop = log(linKneeStop);
+ compressedKneeStop = (kneeStop - thres) / ratio + thres;
+
+ float absample = (fabs(left) + fabs(right)) * 0.5f;
+ if(rms) absample *= absample;
+
+ linSlope += (absample - linSlope) * (absample > linSlope ? attack_coeff : release_coeff);
+
+ float gain = 1.f;
- if(linSlope > 0.f) {
- gain = output_gain(linSlope, rms);
- }
+ if(linSlope > 0.f) {
+ gain = output_gain(linSlope, rms);
+ }
- compression = gain;
- gain *= makeup;
+ compression = gain;
+ gain *= makeup;
+
+ left *= gain;
+ right *= gain;
+
+ detected = rms ? sqrt(linSlope) : linSlope;
+ }
- left *= gain;
- right *= gain;
-
float maxLR = std::max(fabs(left), fabs(right));
if(maxLR > meter_out) {
meter_out = maxLR;
}
meter_comp = compression;
-
- detected = rms ? sqrt(linSlope) : linSlope;
}
float gain_reduction_audio_module::output_level(float slope) {
@@ -1171,8 +1180,7 @@ void gain_reduction_audio_module::set_params(float att, float rel, float thr, fl
detection = det;
bypass = byp;
mute = mu;
- // if bypass, zero meters
- if(bypass > 0.5 or mute > 0.f) {
+ if(mute > 0.f) {
meter_out = 0.f;
meter_comp = 1.f;
}
@@ -1195,17 +1203,18 @@ bool gain_reduction_audio_module::get_graph(int subindex, float *data, int point
for (int i = 0; i < points; i++)
{
float input = dB_grid_inv(-1.0 + i * 2.0 / (points - 1));
- float output = output_level(input);
if (subindex == 0)
data[i] = dB_grid(input);
- else
- data[i] = dB_grid(output);
+ else {
+ float output = output_level(input);
+ data[i] = dB_grid(output);
+ }
}
- if (subindex == (bypass > 0.5f ? 1 : 0))
+ if (subindex == (bypass > 0.5f ? 1 : 0) or mute > 0.1f)
context->set_source_rgba(0.35, 0.4, 0.2, 0.3);
else {
context->set_source_rgba(0.35, 0.4, 0.2, 1);
- context->set_line_width(2);
+ context->set_line_width(1.5);
}
return true;
}
@@ -1216,9 +1225,15 @@ bool gain_reduction_audio_module::get_dot(int subindex, float &x, float &y, int
return false;
if (!subindex)
{
- x = 0.5 + 0.5 * dB_grid(detected);
- y = dB_grid(bypass > 0.5f ? detected : output_level(detected));
- return bypass > 0.5f ? false : true;
+ if(bypass > 0.5f or mute > 0.f) {
+ return false;
+ } else {
+ bool rms = detection == 0;
+ float det = rms ? sqrt(detected) : detected;
+ x = 0.5 + 0.5 * dB_grid(det);
+ y = dB_grid(bypass > 0.5f or mute > 0.f ? det : output_level(det));
+ return true;
+ }
}
return false;
}
@@ -1248,17 +1263,19 @@ int gain_reduction_audio_module::get_changed_offsets(int generation, int &subind
subindex_dot = 0;
subindex_gridline = generation ? INT_MAX : 0;
- if (fabs(threshold-old_threshold) + fabs(ratio - old_ratio) + fabs(knee - old_knee) + fabs(makeup - old_makeup) + fabs(bypass - old_bypass) > 0.01f)
+ if (fabs(threshold-old_threshold) + fabs(ratio - old_ratio) + fabs(knee - old_knee) + fabs(makeup - old_makeup) + fabs(detection - old_detection) + fabs(bypass - old_bypass) + fabs(mute - old_mute) > 0.000001f)
{
old_threshold = threshold;
- old_ratio = ratio;
- old_knee = knee;
- old_makeup = makeup;
- old_bypass = bypass;
+ old_ratio = ratio;
+ old_knee = knee;
+ old_makeup = makeup;
+ old_detection = detection;
+ old_bypass = bypass;
+ old_mute = mute;
last_generation++;
}
if (generation == last_generation)
subindex_graph = 2;
return last_generation;
-}
+}
\ No newline at end of file
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list