+ if (++id == N_STRIPS) {
+ break;
+ }
+ }
+
+ // clear remaining
+ for (; id < N_STRIPS; ++id) {
+ _ctrls.strip(id).unset_controllables ();
+ }
+}
+
+bool
+FaderPort8::assign_plugin_presets (boost::shared_ptr<PluginInsert> pi)
+{
+ if (!pi) {
+ return false;
+ }
+ boost::shared_ptr<ARDOUR::Plugin> plugin = pi->plugin ();
+
+ std::vector<ARDOUR::Plugin::PresetRecord> presets = plugin->get_presets ();
+ if (presets.size () == 0) {
+ return false;
+ }
+
+ int n_parameters = presets.size ();
+
+ _parameter_off = std::min (_parameter_off, n_parameters - (N_STRIPS - 1));
+ _parameter_off = std::max (0, _parameter_off);
+ Plugin::PresetRecord active = plugin->last_preset ();
+
+ uint8_t id = 0;
+ for (size_t i = _parameter_off; i < (size_t)n_parameters; ++i) {
+ _ctrls.strip(id).unset_controllables (FP8Strip::CTRL_ALL & ~FP8Strip::CTRL_TEXT01 & ~FP8Strip::CTRL_TEXT3 & ~FP8Strip::CTRL_SELECT);
+ boost::function<void ()> cb (boost::bind (&FaderPort8::select_plugin_preset, this, i));
+ _ctrls.strip(id).set_select_cb (cb);
+ _ctrls.strip(id).select_button ().set_active (true);
+ if (active != presets.at(i)) {
+ _ctrls.strip(id).select_button ().set_color (0x0000ffff);
+ _ctrls.strip(id).select_button ().set_blinking (false);
+ } else {
+ _ctrls.strip(id).select_button ().set_color (0x00ffffff);
+ _ctrls.strip(id).select_button ().set_blinking (plugin->parameter_changed_since_last_preset ());
+ }
+ std::string label = presets.at(i).label;
+ _ctrls.strip(id).set_text_line (0, label.substr (0, 9));
+ _ctrls.strip(id).set_text_line (1, label.length () > 9 ? label.substr (9) : "");
+ _ctrls.strip(id).set_text_line (3, "PRESET", true);
+ if (++id == (N_STRIPS - 1)) {
+ break;
+ }