[SCM] calf/master: + autotools stuff: upped version, added missing header file to Makefile.am + Framework: refactoring of preset code and plugin interface + GUI: added conditional statement to XML files + Monosynth: made line graphs conditional (to avoid using them in DSSI version) + DSSI: added actual GUI support (hacky and full of printf calls, will sort it out some day)

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


The following commit has been merged in the master branch:
commit 631f6e12500b2fdded2da93097323ce43509d3f1
Author: kfoltman <kfoltman at 78b06b96-2940-0410-b7fc-879d825d01d8>
Date:   Fri Jan 4 22:31:17 2008 +0000

    + autotools stuff: upped version, added missing header file to Makefile.am
    + Framework: refactoring of preset code and plugin interface
    + GUI: added conditional statement to XML files
    + Monosynth: made line graphs conditional (to avoid using them in DSSI version)
    + DSSI: added actual GUI support (hacky and full of printf calls, will sort it out some day)
    
    
    
    git-svn-id: https://calf.svn.sourceforge.net/svnroot/calf/trunk@74 78b06b96-2940-0410-b7fc-879d825d01d8

diff --git a/configure.in b/configure.in
index eca617d..16c67bc 100644
--- a/configure.in
+++ b/configure.in
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT([calf],[0.0.9],[wdev at foltman.com])
+AC_INIT([calf],[0.0.10],[wdev at foltman.com])
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_HEADER([config.h])
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 5604426..85980f6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,7 +45,7 @@ calfbenchmark_SOURCES = benchmark.cpp
 calfbenchmark_LDADD =  -lglib-2.0 libcalfgui.la
 
 calfdssigui_SOURCES = dssigui.cpp
-calfdssigui_LDADD =  -lglib-2.0 libcalfgui.la
+calfdssigui_LDADD =  -lglib-2.0 libcalfstatic.la libcalfgui.la $(GUI_DEPS_LIBS)
 
 calf_la_SOURCES = modules.cpp giface.cpp monosynth.cpp organ.cpp preset.cpp synth.cpp 
 calf_la_LDFLAGS = -rpath $(ladspadir) -avoid-version -module -lexpat
diff --git a/src/calf/Makefile.am b/src/calf/Makefile.am
index 9f76018..3634c11 100644
--- a/src/calf/Makefile.am
+++ b/src/calf/Makefile.am
@@ -3,5 +3,5 @@ calfdir = $(includedir)/calf
 calf_HEADERS = audio_fx.h benchmark.h biquad.h buffer.h custom_ctl.h \
     delay.h fft.h fixed_point.h giface.h gui.h inertia.h \
     jackhost.h modules.h modules_dev.h modules_synths.h \
-    onepole.h organ.h osc.h preset.h preset_gui.h primitives.h \
+    onepole.h organ.h osc.h osctl.h preset.h preset_gui.h primitives.h \
     synth.h wave.h
diff --git a/src/calf/giface.h b/src/calf/giface.h
index e1c811e..ec16edf 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -115,6 +115,8 @@ struct plugin_ctl_iface
     virtual int get_param_count() = 0;
     virtual const char *get_gui_xml() = 0;
     virtual line_graph_iface *get_line_graph_iface() = 0;
+    virtual int get_param_port_offset() = 0;
+    virtual bool activate_preset(int bank, int program) = 0;
     virtual ~plugin_ctl_iface() {}
 };
 
@@ -186,6 +188,10 @@ struct ladspa_instance: public Module, public plugin_ctl_iface
     {
         return Module::param_count;
     }
+    virtual int get_param_port_offset() 
+    {
+        return Module::in_count + Module::out_count;
+    }
     virtual const char *get_gui_xml() {
         return Module::get_gui_xml();
     }
@@ -193,6 +199,9 @@ struct ladspa_instance: public Module, public plugin_ctl_iface
     {
         return this;
     }
+    virtual bool activate_preset(int bank, int program) { 
+        return false;
+    }
 };
 
 template<class Module>
diff --git a/src/calf/gui.h b/src/calf/gui.h
index b690b57..ae53cdb 100644
--- a/src/calf/gui.h
+++ b/src/calf/gui.h
@@ -212,6 +212,7 @@ protected:
     std::vector<control_container *> container_stack;
     control_container *top_container;
     std::map<std::string, int> param_name_map;
+    int ignore_stack;
 public:
     plugin_gui_window *window;
     GtkWidget *container;
@@ -227,6 +228,7 @@ public:
 
     void add_param_ctl(int param, param_control *ctl) { par2ctl.insert(std::pair<int, param_control *>(param, ctl)); }
     void refresh();
+    void refresh(int param_no, param_control *originator = NULL);
     void xml_element_start(const char *element, const char *attributes[]);
     void set_param_value(int param_no, float value, param_control *originator = NULL);
     static void xml_element_start(void *data, const char *element, const char *attributes[]);
@@ -244,6 +246,7 @@ public:
     GtkWindow *toplevel;
     GtkUIManager *ui_mgr;
     GtkActionGroup *std_actions, *preset_actions;
+    std::set<std::string> conditions;
     static std::set<plugin_gui_window *> all_windows;
 
     plugin_gui_window();
diff --git a/src/calf/jackhost.h b/src/calf/jackhost.h
index 2715e7d..ba0b360 100644
--- a/src/calf/jackhost.h
+++ b/src/calf/jackhost.h
@@ -308,6 +308,11 @@ public:
     virtual int get_output_count() { return Module::out_count; }
     virtual int get_param_count() { return Module::param_count; }
     virtual bool get_midi() { return Module::support_midi; }
+    virtual bool activate_preset(int bank, int program) { return false; }
+    virtual int get_param_port_offset() 
+    {
+        return Module::in_count + Module::out_count;
+    }
     virtual float get_param_value(int param_no) {
         return params[param_no];
     }
diff --git a/src/calf/osctl.h b/src/calf/osctl.h
index 73b6430..643635e 100644
--- a/src/calf/osctl.h
+++ b/src/calf/osctl.h
@@ -204,6 +204,7 @@ struct osc_client: public osc_socket
     void set_addr(const char *hostaddr, int port);
     void set_url(const char *url);
     bool send(const std::string &address, const std::vector<osc_data> &args);
+    bool send(const std::string &address);
 };
 
 };
diff --git a/src/calf/preset.h b/src/calf/preset.h
index 94c7899..00d4dcc 100644
--- a/src/calf/preset.h
+++ b/src/calf/preset.h
@@ -23,6 +23,7 @@
 
 #include <vector>
 #include <string>
+#include <map>
 #include <sstream>
 #include <ostream>
 
@@ -77,12 +78,14 @@ struct preset_list
 
     preset_vector presets;
     plugin_preset parser_preset;
+    std::map<std::string, int> last_preset_ids;
 
     static std::string get_preset_filename();
     bool load_defaults();
     void load(const char *filename);
     void save(const char *filename);
     void add(const plugin_preset &sp);
+    void get_for_plugin(preset_vector &vec, const char *plugin);
     
 protected:
     static void xml_start_element_handler(void *user_data, const char *name, const char *attrs[]);
diff --git a/src/dssigui.cpp b/src/dssigui.cpp
index 8e2185a..52b1a27 100644
--- a/src/dssigui.cpp
+++ b/src/dssigui.cpp
@@ -22,12 +22,14 @@
 #include <stdlib.h>
 #include <config.h>
 #include <calf/giface.h>
+#include <calf/gui.h>
 #include <calf/modules.h>
 #include <calf/modules_dev.h>
 #include <calf/benchmark.h>
 
 using namespace std;
 using namespace dsp;
+using namespace synth;
 
 #include <calf/osctl.h>
 using namespace osctl;
@@ -65,6 +67,90 @@ void osctl_test()
 }
 #endif
 
+struct plugin_proxy_base: public plugin_ctl_iface
+{
+    osc_client *client;
+    bool send_osc;
+    plugin_gui *gui;
+    
+    plugin_proxy_base()
+    {
+        client = NULL;
+        send_osc = false;
+        gui = NULL;
+    }
+};
+
+template<class Module>
+struct plugin_proxy: public plugin_proxy_base
+{
+    float params[Module::param_count];
+    virtual parameter_properties *get_param_props(int param_no) {
+        return Module::param_props + param_no;
+    }
+    virtual float get_param_value(int param_no) {
+        if (param_no < 0 || param_no >= Module::param_count)
+            return 0;
+        return params[param_no];
+    }
+    virtual void set_param_value(int param_no, float value) {
+        if (param_no < 0 || param_no >= Module::param_count)
+            return;
+        params[param_no] = value;
+        if (send_osc)
+        {
+            vector<osc_data> data;
+            data.push_back(osc_data(param_no + get_param_port_offset()));
+            data.push_back(osc_data(value));
+            client->send("/control", data);
+        }
+    }
+    virtual int get_param_count() {
+        return Module::param_count;
+    }
+    virtual int get_param_port_offset() {
+        return Module::in_count + Module::out_count;
+    }
+    virtual const char *get_gui_xml() {
+        return Module::get_gui_xml();
+    }
+    virtual line_graph_iface *get_line_graph_iface() {
+        return NULL;
+    }
+    virtual bool activate_preset(int bank, int program) { 
+        if (send_osc) {
+            vector<osc_data> data;
+            data.push_back(osc_data(bank));
+            data.push_back(osc_data(program));
+            client->send("/program", data);
+            return false;
+        }
+        return false;
+    }
+};
+
+plugin_proxy_base *create_plugin_proxy(const char *effect_name)
+{
+    if (!strcmp(effect_name, "reverb"))
+        return new plugin_proxy<reverb_audio_module>();
+    else if (!strcmp(effect_name, "flanger"))
+        return new plugin_proxy<flanger_audio_module>();
+    else if (!strcmp(effect_name, "filter"))
+        return new plugin_proxy<filter_audio_module>();
+    else if (!strcmp(effect_name, "monosynth"))
+        return new plugin_proxy<monosynth_audio_module>();
+    else if (!strcmp(effect_name, "vintagedelay"))
+        return new plugin_proxy<vintage_delay_audio_module>();
+#ifdef ENABLE_EXPERIMENTAL
+    else if (!strcmp(effect_name, "organ"))
+        return new plugin_proxy<organ_audio_module>();
+    else if (!strcmp(effect_name, "rotaryspeaker"))
+        return new plugin_proxy<rotary_speaker_audio_module>();
+#endif
+    else
+        return NULL;
+}
+
 void help(char *argv[])
 {
     printf("GTK+ user interface for Calf DSSI plugins\nSyntax: %s [--help] [--version] <osc-url> <so-file> <plugin-label> <instance-name>\n", argv[0]);
@@ -80,11 +166,39 @@ GMainLoop *mainloop;
 
 struct dssi_osc_server: public osc_server, public osc_message_sink
 {
+    plugin_proxy_base *plugin;
+    plugin_gui_window window;
+    string effect_name, title;
+    osc_client cli;
+    bool in_program;
+    vector<plugin_preset> presets;
+    
     dssi_osc_server()
+    : plugin(NULL)
     {
         sink = this;
     }
     
+    static void on_destroy(GtkWindow *window, dssi_osc_server *self)
+    {
+        printf("on_destroy, have to send \"exiting\"\n");
+        bool result = self->cli.send("/exiting");
+        printf("result = %d\n", result ? 1 : 0);
+        g_main_loop_quit(mainloop);
+    }
+    
+    void create_window()
+    {
+        plugin = create_plugin_proxy(effect_name.c_str());
+        plugin->client = &cli;
+        plugin->send_osc = true;
+        window.conditions.insert("dssi");
+        window.create(plugin, title.c_str(), effect_name.c_str());
+        plugin->gui = window.gui;
+        gtk_signal_connect(GTK_OBJECT(window.toplevel), "destroy", G_CALLBACK(on_destroy), this);
+        global_presets.get_for_plugin(presets, effect_name.c_str());
+    }
+    
     void receive_osc_message(std::string address, std::string type_tag, const std::vector<osc_data> &args)
     {
         dump.receive_osc_message(address, type_tag, args);
@@ -99,11 +213,61 @@ struct dssi_osc_server: public osc_server, public osc_message_sink
             g_main_loop_quit(mainloop);
             return;
         }
+        if (address == prefix + "/program"&& args.size() >= 2 && args[0].type == osc_i32 && args[1].type == osc_i32)
+        {
+            unsigned int nr = args[0].i32val * 128 + args[1].i32val;
+            printf("PROGRAM %d\n", nr);
+            if (nr == 0)
+            {
+                bool sosc = plugin->send_osc;
+                plugin->send_osc = false;
+                int count = plugin->get_param_count();
+                for (int i =0 ; i < count; i++)
+                    plugin->set_param_value(i, plugin->get_param_props(i)->def_value);
+                plugin->send_osc = sosc;
+                window.gui->refresh();
+                // special handling for default preset
+                return;
+            }
+            nr--;
+            if (nr >= presets.size())
+                return;
+            bool sosc = plugin->send_osc;
+            plugin->send_osc = false;
+            presets[nr].activate(plugin);
+            plugin->send_osc = sosc;
+            window.gui->refresh();
+            
+            // cli.send("/update", data);
+            return;
+        }
+        if (address == prefix + "/control" && args.size() >= 2 && args[0].type == osc_i32 && args[1].type == osc_f32)
+        {
+            int idx = args[0].i32val - plugin->get_param_port_offset();
+            float val = args[1].f32val;
+            printf("CONTROL %d %f\n", idx, val);
+            bool sosc = plugin->send_osc;
+            plugin->send_osc = false;
+            window.gui->set_param_value(idx, val);
+            plugin->send_osc = sosc;
+            return;
+        }
+        if (address == prefix + "/show")
+        {
+            gtk_widget_show_all(GTK_WIDGET(window.toplevel));
+            return;
+        }
+        if (address == prefix + "/hide")
+        {
+            gtk_widget_hide(GTK_WIDGET(window.toplevel));
+            return;
+        }
     }
 };
 
 int main(int argc, char *argv[])
 {
+    gtk_init(&argc, &argv);
     while(1) {
         int option_index;
         int c = getopt_long(argc, argv, "hv", long_options, &option_index);
@@ -123,27 +287,43 @@ int main(int argc, char *argv[])
         help(argv);
         exit(0);
     }
+
+    try {
+        global_presets.load_defaults();
+    }
+    catch(synth::preset_exception &e)
+    {
+        fprintf(stderr, "Error while loading presets: %s\n", e.what());
+        exit(1);
+    }
+
     dssi_osc_server srv;
     srv.prefix = "/dssi/"+string(argv[optind + 1]) + "/" + string(argv[optind + 2]);
+    for (char *p = argv[optind + 2]; *p; p++)
+        *p = tolower(*p);
+    srv.effect_name = argv[optind + 2];
+    srv.title = argv[optind + 3];
+    
     srv.bind();
+    srv.create_window();
     
     mainloop = g_main_loop_new(NULL, FALSE);
 
-    osc_client cli;
-    cli.bind();
-    cli.set_url(argv[optind]);
+    srv.cli.bind();
+    srv.cli.set_url(argv[optind]);
     
     printf("URI = %s\n", srv.get_uri().c_str());
     
     vector<osc_data> data;
     data.push_back(osc_data(srv.get_uri(), osc_string));
-    if (!cli.send("/update", data))
+    if (!srv.cli.send("/update", data))
     {
         g_error("Could not send the initial update message via OSC to %s", argv[optind]);
         return 1;
     }
     
     g_main_loop_run(mainloop);
+    printf("exited\n");
     
     return 0;
 }
diff --git a/src/gui.cpp b/src/gui.cpp
index 45da3dc..3dafbed 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -343,7 +343,7 @@ GtkWidget *line_graph_param_control::create(plugin_gui *_gui, int _param_no)
 void line_graph_param_control::set()
 {
     GtkWidget *tw = gtk_widget_get_toplevel(widget);
-    if (tw && GTK_WIDGET_TOPLEVEL(tw))
+    if (tw && GTK_WIDGET_TOPLEVEL(tw) && widget->window)
     {
         int ws = gdk_window_get_state(widget->window);
         if (ws & (GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_ICONIFIED))
@@ -578,6 +578,10 @@ void plugin_gui::xml_element_start(void *data, const char *element, const char *
 
 void plugin_gui::xml_element_start(const char *element, const char *attributes[])
 {
+    if (ignore_stack) {
+        ignore_stack++;
+        return;
+    }
     control_base::xml_attribute_map xam;
     while(*attributes)
     {
@@ -585,6 +589,21 @@ void plugin_gui::xml_element_start(const char *element, const char *attributes[]
         attributes += 2;
     }
     
+    if (!strcmp(element, "if"))
+    {
+        if (!xam.count("cond") || xam["cond"].empty())
+            g_error("Incorrect <if cond=\"[!]symbol\"> element");
+        string cond = xam["cond"];
+        int exp_count = 1;
+        if (cond.substr(0, 1) == "!") {
+            exp_count = 0;
+            cond.erase(0, 1);
+        }
+        if (window->conditions.count(cond) == exp_count)
+            return;
+        ignore_stack = 1;
+        return;
+    }
     control_container *cc = create_container_from_xml(element, attributes);
     if (cc != NULL)
     {
@@ -625,6 +644,12 @@ void plugin_gui::xml_element_start(const char *element, const char *attributes[]
 void plugin_gui::xml_element_end(void *data, const char *element)
 {
     plugin_gui *gui = (plugin_gui *)data;
+    if (gui->ignore_stack) {
+        gui->ignore_stack--;
+        return;
+    }
+    if (!strcmp(element, "if"))
+        return;
     if (gui->current_control)
     {
         (*gui->container_stack.rbegin())->add(gui->current_control->widget, gui->current_control);
@@ -648,6 +673,7 @@ GtkWidget *plugin_gui::create_from_xml(plugin_ctl_iface *_plugin, const char *xm
     parser = XML_ParserCreate("UTF-8");
     plugin = _plugin;
     container_stack.clear();
+    ignore_stack = 0;
     
     param_name_map.clear();
     int size = plugin->get_param_count();
@@ -673,9 +699,8 @@ void plugin_gui::refresh()
     }
 }
 
-void plugin_gui::set_param_value(int param_no, float value, param_control *originator)
+void plugin_gui::refresh(int param_no, param_control *originator)
 {
-    plugin->set_param_value(param_no, value);
     std::multimap<int, param_control *>::iterator it = par2ctl.find(param_no);
     while(it != par2ctl.end() && it->first == param_no)
     {
@@ -685,6 +710,12 @@ void plugin_gui::set_param_value(int param_no, float value, param_control *origi
     }
 }
 
+void plugin_gui::set_param_value(int param_no, float value, param_control *originator)
+{
+    plugin->set_param_value(param_no, value);
+    refresh(param_no);
+}
+
 
 /******************************* Actions **************************************************/
  
@@ -828,7 +859,6 @@ void plugin_gui_window::create(plugin_ctl_iface *_jh, const char *title, const c
     //gtk_widget_set_size_request(GTK_WIDGET(toplevel), max(req.width + 10, req2.width), req.height + req2.height + 10);
     // printf("size set %dx%d\n", wx, wy);
     // gtk_scrolled_window_set_vadjustment(GTK_SCROLLED_WINDOW(sw), GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, req.height, 20, 100, 100)));
-    gtk_widget_show_all(GTK_WIDGET(toplevel));
     all_windows.insert(this);
 }
 
diff --git a/src/jackhost.cpp b/src/jackhost.cpp
index 39321b3..a170bdf 100644
--- a/src/jackhost.cpp
+++ b/src/jackhost.cpp
@@ -199,8 +199,11 @@ int main(int argc, char *argv[])
             }
             jh->open(&client);
             gui_win = new plugin_gui_window;
+            gui_win->conditions.insert("jackhost");
+            gui_win->conditions.insert("directlink");
             gui_win->create(jh, (string(client_name)+" - "+names[i]).c_str(), names[i].c_str());
             gtk_signal_connect(GTK_OBJECT(gui_win->toplevel), "destroy", G_CALLBACK(destroy), NULL);
+            gtk_widget_show_all(GTK_WIDGET(gui_win->toplevel));
             guis.push_back(gui_win);
             plugins.push_back(jh);
             client.add(jh);
diff --git a/src/monosynth.cpp b/src/monosynth.cpp
index 3fef5b6..809a379 100644
--- a/src/monosynth.cpp
+++ b/src/monosynth.cpp
@@ -64,12 +64,16 @@ static const char *monosynth_gui_xml =
                     "</table>"
 //                    "<line-graph param=\"o1_wave\"/>"
                     "<hbox>"
-                        "<line-graph param=\"o1_wave\"/>"
+                        "<if cond=\"directlink\">"
+                            "<line-graph param=\"o1_wave\"/>"
+                        "</if>"
                         "<vbox>"
                             "<label param=\"o12_mix\"/>"
                             "<hscale param=\"o12_mix\" position=\"bottom\"/>"
                         "</vbox>"
-                        "<line-graph param=\"o2_wave\"/>"
+                        "<if cond=\"directlink\">"
+                            "<line-graph param=\"o2_wave\"/>"
+                        "</if>"
                     "</hbox>"
                     "<hbox>"
                         "<vbox>"
@@ -94,7 +98,9 @@ static const char *monosynth_gui_xml =
                     "<align>"
                         "<hbox>"
                             "<label param=\"filter\" /><combo param=\"filter\" />"
-                            "<line-graph param=\"filter\" refresh=\"1\" width=\"80\" height=\"60\"/>"
+                            "<if cond=\"directlink\">"
+                                "<line-graph param=\"filter\" refresh=\"1\" width=\"80\" height=\"60\"/>"
+                            "</if>"
                         "</hbox>"
                     "</align>"
                     "<hbox>"
diff --git a/src/osctl.cpp b/src/osctl.cpp
index e7a4cd7..efd5934 100644
--- a/src/osctl.cpp
+++ b/src/osctl.cpp
@@ -300,6 +300,18 @@ bool osc_client::send(const std::string &address, const std::vector<osc_data> &a
     
     for (unsigned int i = 0; i < args.size(); i++)
         str.write(args[i]);    
+    
+    // printf("sending %s\n", str.buffer.c_str());
 
     return ::sendto(socket, str.buffer.data(), str.buffer.length(), 0, (sockaddr *)&addr, sizeof(addr)) == (int)str.buffer.length();
 }
+
+bool osc_client::send(const std::string &address)
+{
+    vector<osc_data> data;
+    std::string type_tag = ",";
+    osc_stream str;
+    str.write(prefix + address);
+    str.write(type_tag);
+    return ::sendto(socket, str.buffer.data(), str.buffer.length(), 0, (sockaddr *)&addr, sizeof(addr)) == (int)str.buffer.length();
+}
diff --git a/src/preset.cpp b/src/preset.cpp
index 440d7b8..aaf26e1 100644
--- a/src/preset.cpp
+++ b/src/preset.cpp
@@ -91,6 +91,7 @@ void preset_list::xml_start_element_handler(void *user_data, const char *name, c
         break;
     case LIST:
         if (!strcmp(name, "preset")) {
+            
             parser_preset.bank = parser_preset.program = 0;
             parser_preset.name = "";
             parser_preset.plugin = "";
@@ -98,14 +99,16 @@ void preset_list::xml_start_element_handler(void *user_data, const char *name, c
             parser_preset.param_names.clear();
             parser_preset.values.clear();
             for(; *attrs; attrs += 2) {
-                if (!strcmp(attrs[0], "bank")) self.parser_preset.bank = atoi(attrs[1]);
-                else
-                if (!strcmp(attrs[0], "program")) self.parser_preset.program = atoi(attrs[1]);
-                else
                 if (!strcmp(attrs[0], "name")) self.parser_preset.name = attrs[1];
                 else
                 if (!strcmp(attrs[0], "plugin")) self.parser_preset.plugin = attrs[1];
             }
+            // autonumbering of programs for DSSI
+            if (!self.last_preset_ids.count(self.parser_preset.plugin))
+                self.last_preset_ids[self.parser_preset.plugin] = 0;
+            self.parser_preset.program = ++self.last_preset_ids[self.parser_preset.plugin];
+            self.parser_preset.bank = (self.parser_preset.program >> 7);
+            self.parser_preset.program &= 127;
             state = PRESET;
             return;
         }
@@ -229,6 +232,15 @@ void preset_list::save(const char *filename)
     close(fd);
 }
 
+void preset_list::get_for_plugin(preset_vector &vec, const char *plugin)
+{
+    for (unsigned int i = 0; i < presets.size(); i++)
+    {
+        if (presets[i].plugin == plugin)
+            vec.push_back(presets[i]);
+    }
+}
+
 void preset_list::add(const plugin_preset &sp)
 {
     presets.push_back(sp);
diff --git a/src/preset_gui.cpp b/src/preset_gui.cpp
index ac9d447..b24eda3 100644
--- a/src/preset_gui.cpp
+++ b/src/preset_gui.cpp
@@ -90,7 +90,8 @@ void synth::activate_preset(GtkAction *action, activate_preset_params *params)
     plugin_preset &p = global_presets.presets[params->preset];
     if (p.plugin != gui->effect_name)
         return;
-    p.activate(gui->plugin);
+    if (!gui->plugin->activate_preset(p.bank, p.program))
+        p.activate(gui->plugin);
     gui->refresh();
 }
 

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list