[SCM] calf/master: + GUI: label size improvements + Organ: GUI improvements + Organ: changed drawbar parameter range to better reflect the one on B3

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:36:50 UTC 2013


The following commit has been merged in the master branch:
commit 12608a36c83f2644d0930825e08a81d88c1d65bc
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Sat Dec 29 16:47:18 2007 +0000

    + GUI: label size improvements
    + Organ: GUI improvements
    + Organ: changed drawbar parameter range to better reflect the one on B3
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@54 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/src/calf/giface.h b/src/calf/giface.h
index 16f9985..e1c811e 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -98,6 +98,7 @@ struct parameter_properties
     float from_01(float value01) const;
     float to_01(float value) const;
     std::string to_string(float value) const;
+    int get_char_count() const;
 };
 
 struct line_graph_iface
diff --git a/src/calf/organ.h b/src/calf/organ.h
index 04cca28..4276eea 100644
--- a/src/calf/organ.h
+++ b/src/calf/organ.h
@@ -199,7 +199,7 @@ struct drawbar_organ: public synth::basic_synth {
         basic_synth::render_to(bufptr, nsamples);
         if (percussion.get_active())
             percussion.render_to(buf, nsamples);
-        float gain = parameters->master;
+        float gain = parameters->master * 0.05;
         for (int i=0; i<nsamples; i++) {
             output[0][i] = gain*buf[i];
             output[1][i] = gain*buf[i];
diff --git a/src/giface.cpp b/src/giface.cpp
index a58bb4d..08cb8ae 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -88,11 +88,27 @@ float parameter_properties::to_01(float value) const
     }
 }
 
+int parameter_properties::get_char_count() const
+{
+    if ((flags & PF_SCALEMASK) == PF_SCALE_PERC)
+        return 6;
+    if ((flags & PF_SCALEMASK) == PF_SCALE_GAIN) {
+        char buf[256];
+        uint32_t len = 0;
+        sprintf(buf, "%0.0f dB", 6.0 * log(min) / log(2));
+        len = strlen(buf);
+        sprintf(buf, "%0.0f dB", 6.0 * log(max) / log(2));
+        len = std::max(len, strlen(buf)) + 2;
+        return (int)len;
+    }
+    return std::max(to_string(min).length(), std::max(to_string(max).length(), to_string(max - 0.0000001).length()));
+}
+
 std::string parameter_properties::to_string(float value) const
 {
     char buf[32];
     if ((flags & PF_SCALEMASK) == PF_SCALE_PERC) {
-        sprintf(buf, "%g%%", 100.0 * value);
+        sprintf(buf, "%0.f%%", 100.0 * value);
         return string(buf);
     }
     if ((flags & PF_SCALEMASK) == PF_SCALE_GAIN) {
@@ -101,6 +117,17 @@ std::string parameter_properties::to_string(float value) const
         sprintf(buf, "%0.1f dB", 6.0 * log(value) / log(2));
         return string(buf);
     }
+    
+    switch(flags & PF_TYPEMASK)
+    {
+    case PF_INT:
+    case PF_BOOL:
+    case PF_ENUM:
+    case PF_ENUM_MULTI:
+        value = (int)value;
+        break;
+    }
+
     sprintf(buf, "%g", value);
     
     switch(flags & PF_UNITMASK) {
diff --git a/src/gui.cpp b/src/gui.cpp
index 0266678..37a8c56 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -203,8 +203,9 @@ GtkWidget *label_param_control::create(plugin_gui *_gui, int _param_no)
 GtkWidget *value_param_control::create(plugin_gui *_gui, int _param_no)
 {
     gui = _gui, param_no = _param_no;
+    parameter_properties &props = get_props();
     widget = gtk_label_new ("");
-    gtk_label_set_width_chars (GTK_LABEL (widget), 12);
+    gtk_label_set_width_chars (GTK_LABEL (widget), props.get_char_count());
     gtk_misc_set_alignment (GTK_MISC (widget), 0.5, 0.5);
     return widget;
 }
diff --git a/src/organ.cpp b/src/organ.cpp
index c593d7e..f8ee251 100644
--- a/src/organ.cpp
+++ b/src/organ.cpp
@@ -38,11 +38,13 @@ const char *organ_audio_module::get_gui_xml()
     return 
     "<vbox border=\"10\">"
         "<hbox>"
-            "<label param=\"foldover\"/>"
-            "<toggle param=\"foldover\"/>"
             "<vbox>"
-            "<label param=\"perc_mode\"/>"
-            "<combo param=\"perc_mode\"/>"
+                "<label param=\"foldover\"/>"
+                "<align><toggle param=\"foldover\"/></align>"
+            "</vbox>"
+            "<vbox>"
+                "<label param=\"perc_mode\"/>"
+                "<combo param=\"perc_mode\"/>"
             "</vbox>"
             "<vbox>"
                 "<label param=\"perc_hrm\"/>"
@@ -101,21 +103,21 @@ const char *organ_percussion_mode_names[] = { "Off", "Short", "Long" };
 const char *organ_percussion_harmonic_names[] = { "2nd", "3rd" };
 
 parameter_properties organ_audio_module::param_props[] = {
-    { 0.3,       0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h1", "16'" },
-    { 0.3,       0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h3", "5 1/3'" },
-    { 0.3,       0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h2", "8'" },
-    { 0,         0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h4", "4'" },
-    { 0,         0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h6", "2 2/3'" },
-    { 0,         0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h8", "2'" },
-    { 0,         0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h10", "1 3/5'" },
-    { 0,         0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h12", "1 1/3'" },
-    { 0.3,       0,  1, 1.01, PF_FLOAT | PF_SCALE_QUAD | PF_CTL_FADER, NULL, "h16", "1'" },
-
-    { 1,         0,  1, 1.01, PF_BOOL | PF_CTL_TOGGLE, NULL, "foldover", "Foldover" },
-    { 1,         0,  2, 1.01, PF_ENUM | PF_CTL_COMBO, organ_percussion_mode_names, "perc_mode", "Perc. mode" },
-    { 3,         2,  3, 1.01, PF_ENUM | PF_CTL_COMBO, organ_percussion_harmonic_names, "perc_hrm", "Perc. harmonic" },
-
-    { 0.1,         0,  1, 1.01, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "master", "Master" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h1", "16'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h3", "5 1/3'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h2", "8'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h4", "4'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h6", "2 2/3'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h8", "2'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h10", "1 3/5'" },
+    { 0,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h12", "1 1/3'" },
+    { 8,       0,  8, 80, PF_FLOAT | PF_SCALE_LINEAR | PF_CTL_FADER, NULL, "h16", "1'" },
+
+    { 1,         0,  1, 2, PF_BOOL | PF_CTL_TOGGLE, NULL, "foldover", "Foldover" },
+    { 1,         0,  2, 3, PF_ENUM | PF_CTL_COMBO, organ_percussion_mode_names, "perc_mode", "Perc. mode" },
+    { 3,         2,  3, 1, PF_ENUM | PF_CTL_COMBO, organ_percussion_harmonic_names, "perc_hrm", "Perc. harmonic" },
+
+    { 0.1,         0,  1, 100, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB, NULL, "master", "Master" },
 };
 
 ////////////////////////////////////////////////////////////////////////////

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list