[SCM] calf/master: + Extract GUI code out of calfjackhost, so that it may be used in future for other things (like DSSI GUI) + Preliminary support for DSSI programs (one, default program only) + Expose effect modules (flanger, filter, reverb) as DSSI
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:36:44 UTC 2013
The following commit has been merged in the master branch:
commit 876a6667720a376578ac190dbe87aef73f6d116d
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date: Fri Dec 14 21:14:14 2007 +0000
+ Extract GUI code out of calfjackhost, so that it may be used in future for other things (like DSSI GUI)
+ Preliminary support for DSSI programs (one, default program only)
+ Expose effect modules (flanger, filter, reverb) as DSSI
git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@19 78b06b96-2940-0410-b7fc-879d825d01d8
diff --git a/src/Makefile.am b/src/Makefile.am
index d118c74..486a17e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,7 +9,7 @@ ladspadir = $(with_ladspa_dir)
bin_PROGRAMS =
noinst_PROGRAMS = calfbenchmark
-noinst_LTLIBRARIES = libcalf.la libcalfstatic.la
+noinst_LTLIBRARIES = libcalf.la libcalfstatic.la libcalfgui.la
AM_CXXFLAGS = -ffast-math -march=i686 -finline-limit=80
@@ -17,7 +17,7 @@ if USE_JACK
AM_CXXFLAGS += -DUSE_JACK=1
bin_PROGRAMS += calfjackhost
calfjackhost_SOURCES = jackhost.cpp
-calfjackhost_LDADD = libcalfstatic.la $(JACK_DEPS_LIBS) $(GUI_DEPS_LIBS)
+calfjackhost_LDADD = libcalfstatic.la libcalfgui.la $(JACK_DEPS_LIBS) $(GUI_DEPS_LIBS)
if OLD_JACK
AM_CXXFLAGS += -DOLD_JACK=1
endif
@@ -49,6 +49,9 @@ libcalf_la_LDFLAGS = -rpath $(ladspadir) -version-info 0:0:0
libcalfstatic_la_SOURCES = modules.cpp giface.cpp synth.cpp
libcalfstatic_la_LDFLAGS = -static
+libcalfgui_la_SOURCES = gui.cpp
+libcalfgui_la_LDFLAGS = -static
+
clean-local:
$(RM) -f calfjackhost *~
diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index ceff08e..9247387 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -1,3 +1,3 @@
calfdir = $(includedir)/calf
-calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h delay.h fft.h fixed_point.h giface.h inertia.h jackhost.h modules.h modules_dev.h onepole.h organ.h osc.h primitives.h synth.h wave.h
+calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h delay.h fft.h fixed_point.h giface.h gui.h inertia.h jackhost.h modules.h modules_dev.h onepole.h organ.h osc.h primitives.h synth.h wave.h
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 7b34593..0dd32d6 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -131,9 +131,10 @@ extern std::string generate_ladspa_rdf(const ladspa_info &info, parameter_proper
template<class Module>
struct ladspa_wrapper
{
- LADSPA_Descriptor descriptor;
+ static LADSPA_Descriptor descriptor;
#if USE_DSSI
- DSSI_Descriptor dssi_descriptor;
+ static DSSI_Descriptor dssi_descriptor;
+ static DSSI_Program_Descriptor dssi_default_program;
#endif
ladspa_info &info;
@@ -201,9 +202,14 @@ struct ladspa_wrapper
dssi_descriptor.DSSI_API_Version = 1;
dssi_descriptor.LADSPA_Plugin = &descriptor;
dssi_descriptor.configure = cb_configure;
+ dssi_descriptor.get_program = cb_get_program;
+ dssi_descriptor.select_program = cb_select_program;
// XXXKF make one default program
dssi_descriptor.run_synth = cb_run_synth;
+ dssi_default_program.Bank = 0;
+ dssi_default_program.Program = 0;
+ dssi_default_program.Name = "default";
#endif
}
@@ -220,6 +226,21 @@ struct ladspa_wrapper
return mod;
}
+#if USE_DSSI
+ static const DSSI_Program_Descriptor *cb_get_program(LADSPA_Handle Instance, unsigned long index) {
+ if (index != 0)
+ return NULL;
+ return &dssi_default_program;
+ }
+
+ static void cb_select_program(LADSPA_Handle Instance, unsigned long Bank, unsigned long Program) {
+ Module *const mod = (Module *)Instance;
+ for (int i =0 ; i < Module::param_count; i++)
+ *mod->params[i] = Module::param_props[i].def_value;
+ }
+
+#endif
+
static void cb_connect(LADSPA_Handle Instance, unsigned long port, LADSPA_Data *DataLocation) {
unsigned long ins = Module::in_count;
unsigned long outs = Module::out_count;
@@ -240,6 +261,10 @@ struct ladspa_wrapper
Module *const mod = (Module *)Instance;
mod->set_sample_rate(mod->srate);
mod->activate();
+ /*
+ for (int i =0 ; i < Module::param_count; i++)
+ *mod->params[i] = Module::param_props[i].def_value;
+ */
}
static inline void zero_by_mask(Module *module, uint32_t mask, uint32_t offset, uint32_t nsamples)
@@ -292,11 +317,6 @@ struct ladspa_wrapper
return NULL;
}
- char *configure(const char *key, const char *value)
- {
- return NULL;
- }
-
static void process_dssi_event(Module *module, snd_seq_event_t &event)
{
uint8_t data[4];
@@ -332,6 +352,19 @@ struct ladspa_wrapper
};
};
+template<class Module>
+LADSPA_Descriptor ladspa_wrapper<Module>::descriptor;
+
+#if USE_DSSI
+
+template<class Module>
+DSSI_Descriptor ladspa_wrapper<Module>::dssi_descriptor;
+
+template<class Module>
+DSSI_Program_Descriptor ladspa_wrapper<Module>::dssi_default_program;
+
+#endif
+
#endif
diff --git a/src/calf/gui.h b/src/calf/gui.h
new file mode 100644
index 0000000..8800cd2
--- /dev/null
+++ b/src/calf/gui.h
@@ -0,0 +1,76 @@
+/* Calf DSP Library
+ * Universal GUI module
+ * Copyright (C) 2007 Krzysztof Foltman
+ *
+ * Note: This module uses phat graphics library, so it's
+ * licensed under GPL license, not LGPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+#ifndef __CALF_GUI_H
+#define __CALF_GUI_H
+
+#include <gtk/gtk.h>
+#if USE_PHAT
+#include <phat/phatknob.h>
+#endif
+
+namespace synth {
+
+class plugin_gui;
+
+struct param_control
+{
+ plugin_gui *gui;
+ int param_no;
+ GtkWidget *label;
+};
+
+struct plugin_ctl_iface
+{
+ virtual parameter_properties *get_param_props(int param_no) = 0;
+ virtual float get_param_value(int param_no) = 0;
+ virtual void set_param_value(int param_no, float value) = 0;
+ virtual int get_param_count() = 0;
+ virtual const char ** get_param_names()=0;
+ virtual ~plugin_ctl_iface() {}
+};
+
+class plugin_gui
+{
+protected:
+ int param_count;
+public:
+ GtkWidget *toplevel;
+ GtkWidget *table;
+ plugin_ctl_iface *plugin;
+ param_control *params;
+
+ plugin_gui(GtkWidget *_toplevel);
+ void create(plugin_ctl_iface *_plugin, const char *title);
+ GtkWidget *create_label(int param_idx);
+ static void hscale_value_changed(GtkHScale *widget, gpointer value);
+ static gchar *hscale_format_value(GtkScale *widget, double arg1, gpointer value);
+ static void combo_value_changed(GtkComboBox *widget, gpointer value);
+ static void toggle_value_changed(GtkCheckButton *widget, gpointer value);
+
+#if USE_PHAT
+ static void knob_value_changed(PhatKnob *widget, gpointer value);
+#endif
+};
+
+};
+
+#endif
diff --git a/src/calf/jackhost.h b/src/calf/jackhost.h
index aeaaedb..d7b9f6a 100644
--- a/src/calf/jackhost.h
+++ b/src/calf/jackhost.h
@@ -27,9 +27,11 @@
#if USE_JACK
+#include "gui.h"
+
namespace synth {
-class jack_host_base {
+class jack_host_base: public plugin_ctl_iface {
public:
typedef int (*process_func)(jack_nframes_t nframes, void *p);
struct port {
@@ -45,15 +47,12 @@ public:
port midi_port;
virtual int get_input_count()=0;
virtual int get_output_count()=0;
- virtual int get_param_count()=0;
virtual port *get_inputs()=0;
virtual port *get_outputs()=0;
virtual float *get_params()=0;
virtual void init_module()=0;
virtual void cache_ports()=0;
virtual process_func get_process_func()=0;
- virtual const char ** get_param_names()=0;
- virtual parameter_properties* get_param_props()=0;
virtual bool get_midi()=0;
jack_host_base() {
@@ -128,7 +127,7 @@ public:
for (int i = 0; i < output_count; i++)
outputs[i].data = NULL;
}
-
+
virtual ~jack_host_base() {
if (client)
close();
@@ -155,6 +154,8 @@ public:
module.activate();
module.params_changed();
}
+
+ virtual synth::parameter_properties* get_param_props(int param_no) { return Module::param_props; }
static int do_jack_process(jack_nframes_t nframes, void *p) {
jack_host *host = (jack_host *)p;
@@ -225,9 +226,15 @@ public:
virtual int get_output_count() { return Module::out_count; }
virtual int get_param_count() { return Module::param_count; }
virtual process_func get_process_func() { return do_jack_process; }
- virtual const char ** get_param_names() { return Module::param_names; }
- virtual parameter_properties* get_param_props() { return Module::param_props; }
+ virtual const char ** get_param_names() { return Module::param_names + Module::in_count + Module::out_count; }
virtual bool get_midi() { return Module::support_midi; }
+ virtual float get_param_value(int param_no) {
+ return params[param_no];
+ }
+ virtual void set_param_value(int param_no, float value) {
+ params[param_no] = value;
+ changed = true;
+ }
};
#endif
diff --git a/src/gui.cpp b/src/gui.cpp
new file mode 100644
index 0000000..ea53361
--- /dev/null
+++ b/src/gui.cpp
@@ -0,0 +1,164 @@
+/* Calf DSP Library
+ * GUI functions for a plugin.
+ * Copyright (C) 2007 Krzysztof Foltman
+ *
+ * Note: This module uses phat graphics library, so it's
+ * licensed under GPL license, not LGPL.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <calf/giface.h>
+#include <calf/gui.h>
+
+using namespace synth;
+
+plugin_gui::plugin_gui(GtkWidget *_toplevel)
+: toplevel(_toplevel)
+{
+
+}
+
+void plugin_gui::hscale_value_changed(GtkHScale *widget, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ plugin_ctl_iface &pif = *jhp->gui->plugin;
+ int nparam = jhp->param_no;
+ const parameter_properties &props = *pif.get_param_props(nparam);
+ float cvalue = props.from_01 (gtk_range_get_value (GTK_RANGE (widget)));
+ pif.set_param_value(nparam, cvalue);
+ // gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
+}
+
+gchar *plugin_gui::hscale_format_value(GtkScale *widget, double arg1, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ plugin_ctl_iface &pif = *jhp->gui->plugin;
+ const parameter_properties &props = *pif.get_param_props (jhp->param_no);
+ float cvalue = props.from_01 (arg1);
+
+ // for testing
+ // return g_strdup_printf ("%s = %g", props.to_string (cvalue).c_str(), arg1);
+ return g_strdup (props.to_string (cvalue).c_str());
+}
+
+void plugin_gui::combo_value_changed(GtkComboBox *widget, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ plugin_ctl_iface &pif = *jhp->gui->plugin;
+ int nparam = jhp->param_no;
+ pif.set_param_value(nparam, gtk_combo_box_get_active (widget) + pif.get_param_props (jhp->param_no)->min);
+}
+
+void plugin_gui::toggle_value_changed(GtkCheckButton *widget, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ plugin_ctl_iface &pif = *jhp->gui->plugin;
+ int nparam = jhp->param_no;
+ pif.set_param_value(nparam, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)) + pif.get_param_props (jhp->param_no)->min);
+}
+
+#if USE_PHAT
+void plugin_gui::knob_value_changed(PhatKnob *widget, gpointer value)
+{
+ param_control *jhp = (param_control *)value;
+ plugin_ctl_iface &pif = *jhp->gui->plugin;
+ const parameter_properties &props = *pif.get_param_props (jhp->param_no);
+ int nparam = jhp->param_no;
+ float cvalue = props.from_01 (phat_knob_get_value (widget));
+ pif.set_param_value(nparam, cvalue);
+ gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
+}
+#endif
+
+GtkWidget *plugin_gui::create_label(int param_idx)
+{
+ GtkWidget *widget = gtk_label_new ("");
+ gtk_label_set_width_chars (GTK_LABEL (widget), 12);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ params[param_idx].label = widget;
+ return widget;
+}
+
+void plugin_gui::create(plugin_ctl_iface *_plugin, const char *title)
+{
+ plugin = _plugin;
+ param_count = plugin->get_param_count();
+ params = new param_control[param_count];
+
+ for (int i = 0; i < param_count; i++) {
+ params[i].gui = this;
+ params[i].param_no = i;
+ }
+
+ table = gtk_table_new (param_count + 1, 3, FALSE);
+
+ GtkWidget *title_label = gtk_label_new ("");
+ gtk_label_set_markup (GTK_LABEL (title_label), (std::string("<b>")+title+"</b>").c_str());
+ gtk_table_attach (GTK_TABLE (table), title_label, 0, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 2, 2);
+
+ for (int i = 0; i < param_count; i++) {
+ GtkWidget *label = gtk_label_new (plugin->get_param_names()[i]);
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, i + 1, i + 2, GTK_FILL, GTK_FILL, 2, 2);
+
+ parameter_properties &props = *plugin->get_param_props(i);
+
+ GtkWidget *widget;
+
+ if ((props.flags & PF_TYPEMASK) == PF_ENUM &&
+ (props.flags & PF_CTLMASK) == PF_CTL_COMBO)
+ {
+ widget = gtk_combo_box_new_text ();
+ for (int j = (int)props.min; j <= (int)props.max; j++)
+ gtk_combo_box_append_text (GTK_COMBO_BOX (widget), props.choices[j - (int)props.min]);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (widget), (int)plugin->get_param_value(i) - (int)props.min);
+ gtk_signal_connect (GTK_OBJECT (widget), "changed", G_CALLBACK (combo_value_changed), (gpointer)¶ms[i]);
+ gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_SHRINK, 0, 0);
+ }
+ else if ((props.flags & PF_TYPEMASK) == PF_BOOL &&
+ (props.flags & PF_CTLMASK) == PF_CTL_TOGGLE)
+ {
+ widget = gtk_check_button_new ();
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), (int)plugin->get_param_value(i) - (int)props.min);
+ gtk_signal_connect (GTK_OBJECT (widget), "toggled", G_CALLBACK (toggle_value_changed), (gpointer)¶ms[i]);
+ gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_SHRINK, 0, 0);
+ }
+#if USE_PHAT
+ else if ((props.flags & PF_CTLMASK) != PF_CTL_FADER)
+ {
+ GtkWidget *knob = phat_knob_new_with_range (props.to_01 (plugin->get_param_value(i)), 0, 1, 0.01);
+ gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (knob_value_changed), (gpointer)¶ms[i]);
+ gtk_table_attach (GTK_TABLE (table), knob, 1, 2, i + 1, i + 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), create_label(i), 2, 3, i + 1, i + 2, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), GTK_SHRINK, 0, 0);
+ knob_value_changed (PHAT_KNOB (knob), (gpointer)¶ms[i]);
+ }
+#endif
+ else
+ {
+ gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
+
+ GtkWidget *knob = gtk_hscale_new_with_range (0, 1, 0.01);
+ gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (hscale_value_changed), (gpointer)¶ms[i]);
+ gtk_signal_connect (GTK_OBJECT (knob), "format-value", G_CALLBACK (hscale_format_value), (gpointer)¶ms[i]);
+ gtk_widget_set_size_request (knob, 200, -1);
+ gtk_table_attach (GTK_TABLE (table), knob, 1, 3, i + 1, i + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, 0, 0);
+
+ gtk_range_set_value (GTK_RANGE (knob), props.to_01 (plugin->get_param_value(i)));
+ hscale_value_changed (GTK_HSCALE (knob), (gpointer)¶ms[i]);
+ }
+ }
+ gtk_container_add (GTK_CONTAINER (toplevel), table);
+}
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index f294a19..68f4d0a 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -28,191 +28,12 @@
#include <calf/jackhost.h>
#include <calf/modules.h>
#include <calf/modules_dev.h>
-#include <gtk/gtk.h>
-#if USE_PHAT
-#include <phat/phatknob.h>
-#endif
+#include <calf/gui.h>
using namespace synth;
-class jack_host_gui;
-
-struct jack_host_param
-{
- jack_host_gui *gui;
- int param_no;
- GtkWidget *label;
-};
-
-class jack_host_gui
-{
-protected:
- int param_count;
-public:
- GtkWidget *toplevel;
- GtkWidget *table;
- synth::jack_host_base *host;
- jack_host_param *params;
-
- jack_host_gui(GtkWidget *_toplevel);
- void create(synth::jack_host_base *_host, const char *title);
- GtkWidget *create_label(int param_idx);
- static void hscale_value_changed(GtkHScale *widget, gpointer value);
- static gchar *hscale_format_value(GtkScale *widget, double arg1, gpointer value);
- static void combo_value_changed(GtkComboBox *widget, gpointer value);
- static void toggle_value_changed(GtkCheckButton *widget, gpointer value);
-
-
-#if USE_PHAT
- static void knob_value_changed(PhatKnob *widget, gpointer value);
-#endif
-};
-
-jack_host_gui::jack_host_gui(GtkWidget *_toplevel)
-: toplevel(_toplevel)
-{
-
-}
-
-void jack_host_gui::hscale_value_changed(GtkHScale *widget, gpointer value)
-{
- jack_host_param *jhp = (jack_host_param *)value;
- jack_host_base &jh = *jhp->gui->host;
- int nparam = jhp->param_no;
- const parameter_properties &props = jh.get_param_props()[nparam];
- float cvalue = props.from_01 (gtk_range_get_value (GTK_RANGE (widget)));
- jh.get_params()[nparam] = cvalue;
- jh.set_params();
- // gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
-}
-
-gchar *jack_host_gui::hscale_format_value(GtkScale *widget, double arg1, gpointer value)
-{
- jack_host_param *jhp = (jack_host_param *)value;
- jack_host_base &jh = *jhp->gui->host;
- const parameter_properties &props = jh.get_param_props()[jhp->param_no];
- float cvalue = props.from_01 (arg1);
-
- // for testing
- // return g_strdup_printf ("%s = %g", props.to_string (cvalue).c_str(), arg1);
- return g_strdup (props.to_string (cvalue).c_str());
-}
-
-void jack_host_gui::combo_value_changed(GtkComboBox *widget, gpointer value)
-{
- jack_host_param *jhp = (jack_host_param *)value;
- jack_host_base &jh = *jhp->gui->host;
- int nparam = jhp->param_no;
- jh.get_params()[nparam] = gtk_combo_box_get_active (widget) + jh.get_param_props()[jhp->param_no].min;
- jh.set_params();
-}
-
-void jack_host_gui::toggle_value_changed(GtkCheckButton *widget, gpointer value)
-{
- jack_host_param *jhp = (jack_host_param *)value;
- jack_host_base &jh = *jhp->gui->host;
- int nparam = jhp->param_no;
- jh.get_params()[nparam] = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)) + jh.get_param_props()[jhp->param_no].min;
- jh.set_params();
-}
-
-#if USE_PHAT
-void jack_host_gui::knob_value_changed(PhatKnob *widget, gpointer value)
-{
- jack_host_param *jhp = (jack_host_param *)value;
- jack_host_base &jh = *jhp->gui->host;
- const parameter_properties &props = jh.get_param_props()[jhp->param_no];
- int nparam = jhp->param_no;
- float cvalue = props.from_01 (phat_knob_get_value (widget));
- jh.get_params()[nparam] = cvalue;
- // printf("%d -> %f\n", nparam, cvalue);
- jh.set_params();
- gtk_label_set_text (GTK_LABEL (jhp->label), props.to_string(cvalue).c_str());
-}
-#endif
-
-GtkWidget *jack_host_gui::create_label(int param_idx)
-{
- GtkWidget *widget = gtk_label_new ("");
- gtk_label_set_width_chars (GTK_LABEL (widget), 12);
- gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
- params[param_idx].label = widget;
- return widget;
-}
-
-void jack_host_gui::create(synth::jack_host_base *_host, const char *title)
-{
- host = _host;
- param_count = host->get_param_count();
- params = new jack_host_param[param_count];
-
- for (int i = 0; i < param_count; i++) {
- params[i].gui = this;
- params[i].param_no = i;
- }
-
- table = gtk_table_new (param_count + 1, 3, FALSE);
-
- GtkWidget *title_label = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL (title_label), (string("<b>")+title+"</b>").c_str());
- gtk_table_attach (GTK_TABLE (table), title_label, 0, 3, 0, 1, GTK_EXPAND, GTK_SHRINK, 2, 2);
-
- for (int i = 0; i < param_count; i++) {
- GtkWidget *label = gtk_label_new (host->get_param_names()[host->get_input_count() + host->get_output_count() + i]);
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, i + 1, i + 2, GTK_FILL, GTK_FILL, 2, 2);
-
- parameter_properties &props = host->get_param_props()[i];
-
- GtkWidget *widget;
-
- if ((props.flags & PF_TYPEMASK) == PF_ENUM &&
- (props.flags & PF_CTLMASK) == PF_CTL_COMBO)
- {
- widget = gtk_combo_box_new_text ();
- for (int j = (int)props.min; j <= (int)props.max; j++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), props.choices[j - (int)props.min]);
- gtk_combo_box_set_active (GTK_COMBO_BOX (widget), (int)host->get_params()[i] - (int)props.min);
- gtk_signal_connect (GTK_OBJECT (widget), "changed", G_CALLBACK (combo_value_changed), (gpointer)¶ms[i]);
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_SHRINK, 0, 0);
- }
- else if ((props.flags & PF_TYPEMASK) == PF_BOOL &&
- (props.flags & PF_CTLMASK) == PF_CTL_TOGGLE)
- {
- widget = gtk_check_button_new ();
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), (int)host->get_params()[i] - (int)props.min);
- gtk_signal_connect (GTK_OBJECT (widget), "toggled", G_CALLBACK (toggle_value_changed), (gpointer)¶ms[i]);
- gtk_table_attach (GTK_TABLE (table), widget, 1, 3, i + 1, i + 2, GTK_EXPAND, GTK_SHRINK, 0, 0);
- }
-#if USE_PHAT
- else if ((props.flags & PF_CTLMASK) != PF_CTL_FADER)
- {
- GtkWidget *knob = phat_knob_new_with_range (host->get_param_props()[i].to_01 (host->get_params()[i]), 0, 1, 0.01);
- gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (knob_value_changed), (gpointer)¶ms[i]);
- gtk_table_attach (GTK_TABLE (table), knob, 1, 2, i + 1, i + 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
- gtk_table_attach (GTK_TABLE (table), create_label(i), 2, 3, i + 1, i + 2, (GtkAttachOptions)(GTK_SHRINK | GTK_FILL), GTK_SHRINK, 0, 0);
- knob_value_changed (PHAT_KNOB (knob), (gpointer)¶ms[i]);
- }
-#endif
- else
- {
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 1.0);
-
- GtkWidget *knob = gtk_hscale_new_with_range (0, 1, 0.01);
- gtk_signal_connect (GTK_OBJECT (knob), "value-changed", G_CALLBACK (hscale_value_changed), (gpointer)¶ms[i]);
- gtk_signal_connect (GTK_OBJECT (knob), "format-value", G_CALLBACK (hscale_format_value), (gpointer)¶ms[i]);
- gtk_widget_set_size_request (knob, 200, -1);
- gtk_table_attach (GTK_TABLE (table), knob, 1, 3, i + 1, i + 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), GTK_SHRINK, 0, 0);
-
- gtk_range_set_value (GTK_RANGE (knob), host->get_param_props()[i].to_01 (host->get_params()[i]));
- hscale_value_changed (GTK_HSCALE (knob), (gpointer)¶ms[i]);
- }
- }
- gtk_container_add (GTK_CONTAINER (toplevel), table);
-}
-
// I don't need anyone to tell me this is stupid. I already know that :)
-jack_host_gui *gui;
+plugin_gui *gui;
void destroy(GtkWindow *window, gpointer data)
{
@@ -224,7 +45,7 @@ void make_gui(jack_host_base *jh, const char *title, const char *effect)
GtkWidget *toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (toplevel), title);
- gui = new jack_host_gui(toplevel);
+ gui = new plugin_gui(toplevel);
gui->create(jh, effect);
gtk_signal_connect (GTK_OBJECT(toplevel), "destroy", G_CALLBACK(destroy), NULL);
diff --git a/src/modules.cpp b/src/modules.cpp
index dc82e88..a173753 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -209,6 +209,9 @@ const DSSI_Descriptor *dssi_descriptor(unsigned long Index)
switch (Index) {
case 0: return &::monosynth.dssi_descriptor;
case 1: return &::organ.dssi_descriptor;
+ case 2: return &::filter.dssi_descriptor;
+ case 3: return &::flanger.dssi_descriptor;
+ case 4: return &::reverb.dssi_descriptor;
default: return NULL;
}
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list