A band aid for plugin editor related crash. Something needs to be
[ardour.git] / libs / ardour / plugin.cc
index dc85e1d721ed44cee0744f64dc4cc57321c1466c..e9665908a3c632e998f2689f3c55b1b2cb2bc40a 100644 (file)
@@ -162,7 +162,8 @@ Plugin::MIDIPortControl::send_feedback (float value)
                if (get_control_info (ch, ev, additional)) {
                        data.controller_number = additional;
                        data.value = val;
-
+                       last_written = val;
+                       
                        plugin.session().send_midi_message (get_port(), ev, ch, data);
                }
        }
@@ -265,14 +266,14 @@ Plugin::write_midi_feedback (MIDI::byte* buf, int32_t& bufsize)
        return buf;
 }
 
-list<string>
+vector<string>
 Plugin::get_presets()
 {
-       list<string> labels;
+       vector<string> labels;
        lrdf_uris* set_uris = lrdf_get_setting_uris(unique_id());
 
        if (set_uris) {
-               for (uint32_t i = 0; i < set_uris->count; ++i) {
+               for (uint32_t i = 0; i < (uint32_t) set_uris->count; ++i) {
                        if (char* label = lrdf_get_label(set_uris->items[i])) {
                                labels.push_back(label);
                                presets[label] = set_uris->items[i];
@@ -281,7 +282,8 @@ Plugin::get_presets()
                lrdf_free_uris(set_uris);
        }
 
-       labels.unique();
+       // GTK2FIX find an equivalent way to do this with a vector (needed by GUI apis)
+       // labels.unique();
 
        return labels;
 }
@@ -292,10 +294,10 @@ Plugin::load_preset(const string preset_label)
        lrdf_defaults* defs = lrdf_get_setting_values(presets[preset_label].c_str());
 
        if (defs) {
-               for (uint32_t i = 0; i < defs->count; ++i) {
+               for (uint32_t i = 0; i < (uint32_t) defs->count; ++i) {
                        // The defs->items[i].pid < defs->count check is to work around 
                        // a bug in liblrdf that saves invalid values into the presets file.
-                       if (((uint32_t) defs->items[i].pid < defs->count) && parameter_is_input (defs->items[i].pid)) {
+                       if (((uint32_t) defs->items[i].pid < (uint32_t) defs->count) && parameter_is_input (defs->items[i].pid)) {
                                set_parameter(defs->items[i].pid, defs->items[i].value);
                        }
                }
@@ -326,24 +328,24 @@ Plugin::save_preset (string name, string domain)
                return false;
        }
        
-       string source(compose("file:%1/.%2/rdf/ardour-presets.n3", envvar, domain));
+       string source(string_compose("file:%1/.%2/rdf/ardour-presets.n3", envvar, domain));
 
        free(lrdf_add_preset(source.c_str(), name.c_str(), unique_id(), &defaults));
 
-       string path = compose("%1/.%2", envvar, domain);
+       string path = string_compose("%1/.%2", envvar, domain);
        if (mkdir(path.c_str(), 0775) && errno != EEXIST) {
-               warning << compose(_("Could not create %1.  Preset not saved. (%2)"), path, strerror(errno)) << endmsg;
+               warning << string_compose(_("Could not create %1.  Preset not saved. (%2)"), path, strerror(errno)) << endmsg;
                return false;
        }
        
        path += "/rdf";
        if (mkdir(path.c_str(), 0775) && errno != EEXIST) {
-               warning << compose(_("Could not create %1.  Preset not saved. (%2)"), path, strerror(errno)) << endmsg;
+               warning << string_compose(_("Could not create %1.  Preset not saved. (%2)"), path, strerror(errno)) << endmsg;
                return false;
        }
        
        if (lrdf_export_by_source(source.c_str(), source.substr(5).c_str())) {
-               warning << compose(_("Error saving presets file %1."), source) << endmsg;
+               warning << string_compose(_("Error saving presets file %1."), source) << endmsg;
                return false;
        }