: _engine (e)
, _session (s)
, _cycles (0)
+ , _owner (0)
, _have_presets (false)
, _have_pending_stop_events (false)
, _parameter_changed_since_last_preset (false)
{
_pending_stop_events.ensure_buffers (DataType::MIDI, 1, 4096);
- PresetsChanged.connect_same_thread (_preset_connection, boost::bind (&Plugin::update_presets, this, _1 ,_2));
}
Plugin::Plugin (const Plugin& other)
, _session (other._session)
, _info (other._info)
, _cycles (0)
+ , _owner (other._owner)
, _have_presets (false)
, _have_pending_stop_events (false)
, _parameter_changed_since_last_preset (false)
{
_pending_stop_events.ensure_buffers (DataType::MIDI, 1, 4096);
- PresetsChanged.connect_same_thread (_preset_connection, boost::bind (&Plugin::update_presets, this, _1 ,_2));
}
Plugin::~Plugin ()
Plugin::remove_preset (string name)
{
Plugin::PresetRecord const * p = preset_by_label (name);
+ if (!p) {
+ PBD::error << _("Trying to remove nonexistent preset.") << endmsg;
+ return;
+ }
if (!p->user) {
PBD::error << _("Cannot remove plugin factory preset.") << endmsg;
return;
}
do_remove_preset (name);
- _presets.erase (preset_by_label (name)->uri);
+ _presets.erase (p->uri);
_last_preset.uri = "";
_parameter_changed_since_last_preset = false;
- PresetRemoved (); /* EMIT SIGNAL */
+ _have_presets = false;
PresetsChanged (unique_id(), this); /* EMIT SIGNAL */
+ PresetRemoved (); /* EMIT SIGNAL */
}
/** @return PresetRecord with empty URI on failure */
if (!uri.empty()) {
_presets.insert (make_pair (uri, PresetRecord (uri, name)));
- PresetAdded (); /* EMIT SIGNAL */
+ _have_presets = false;
PresetsChanged (unique_id(), this); /* EMIT SIGNAL */
+ PresetAdded (); /* EMIT SIGNAL */
}
return PresetRecord (uri, name);
break;
#endif
+#ifdef MACVST_SUPPORT
+ case ARDOUR::MacVST:
+ plugs = mgr.mac_vst_plugin_info();
+ break;
+#endif
+
#ifdef AUDIOUNIT_SUPPORT
case ARDOUR::AudioUnit:
plugs = mgr.au_plugin_info();
_have_pending_stop_events = true;
}
-void
-Plugin::update_presets (std::string src_unique_id, Plugin* src )
-{
- if (src == this || unique_id() != src_unique_id) {
- return;
- }
- _have_presets = false;
- // TODO check if a preset was added/removed and emit the proper signal
- // so far no subscriber distinguishes between PresetAdded and PresetRemoved
- PresetAdded();
-}
-
vector<Plugin::PresetRecord>
Plugin::get_presets ()
{
Plugin::set_parameter (uint32_t /* which */, float /* value */)
{
_parameter_changed_since_last_preset = true;
- _session.set_dirty ();
PresetDirty (); /* EMIT SIGNAL */
}
int
Plugin::set_state (const XMLNode& node, int /*version*/)
{
- XMLProperty const * p = node.property (X_("last-preset-uri"));
- if (p) {
- _last_preset.uri = p->value ();
- }
-
- p = node.property (X_("last-preset-label"));
- if (p) {
- _last_preset.label = p->value ();
- }
-
- p = node.property (X_("parameter-changed-since-last-preset"));
- if (p) {
- _parameter_changed_since_last_preset = string_is_affirmative (p->value ());
- }
-
+ node.get_property (X_("last-preset-uri"), _last_preset.uri);
+ node.get_property (X_("last-preset-label"), _last_preset.label);
+ node.get_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset);
return 0;
}
Plugin::get_state ()
{
XMLNode* root = new XMLNode (state_node_name ());
- LocaleGuard lg;
- root->add_property (X_("last-preset-uri"), _last_preset.uri);
- root->add_property (X_("last-preset-label"), _last_preset.label);
- root->add_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset ? X_("yes") : X_("no"));
+ root->set_property (X_("last-preset-uri"), _last_preset.uri);
+ root->set_property (X_("last-preset-label"), _last_preset.label);
+ root->set_property (X_("parameter-changed-since-last-preset"), _parameter_changed_since_last_preset);
#ifndef NO_PLUGIN_STATE
add_state (root);
_info = info;
}
-
+std::string
+Plugin::parameter_label (uint32_t which) const
+{
+ if (which >= parameter_count ()) {
+ return "";
+ }
+ ParameterDescriptor pd;
+ get_parameter_descriptor (which, pd);
+ return pd.label;
+}