#include "pbd/windows_special_dirs.h"
#endif
+#ifdef WAF_BUILD
#include "libardour-config.h"
+#endif
#include "ardour/audio_buffer.h"
#include "ardour/audioengine.h"
+#include "ardour/directory_names.h"
#include "ardour/debug.h"
#include "ardour/lv2_plugin.h"
#include "ardour/midi_patch_manager.h"
unsigned int saved_state = _state_version;;
g_mkdir_with_parents(new_dir.c_str(), 0744);
+ std::string xternal_dir = _session.externals_dir ();
+
+ if (!_plugin_state_dir.empty()) {
+ xternal_dir = Glib::build_filename (_plugin_state_dir, externals_dir_name);
+ g_mkdir_with_parents(xternal_dir.c_str(), 0744);
+ }
+
LilvState* state = lilv_state_new_from_instance(
_impl->plugin,
_impl->instance,
_uri_map.urid_map(),
scratch_dir().c_str(),
file_dir().c_str(),
- _session.externals_dir().c_str(),
+ xternal_dir.c_str(),
new_dir.c_str(),
NULL,
const_cast<LV2Plugin*>(this),
} else {
// template save (dedicated state-dir)
lilv_state_free(state);
+ g_rmdir (xternal_dir.c_str()); // try remove unused dir
--_state_version;
}
} else {
lilv_nodes_free(properties);
}
+Variant
+LV2Plugin::get_property_value (uint32_t prop_id) const
+{
+ std::map<uint32_t, Variant>::const_iterator it;
+ if ((it = _property_values.find (prop_id)) == _property_values.end()) {
+ return Variant();
+ }
+ return it->second;
+}
+
void
LV2Plugin::announce_property_values()
{
{
if (( which.type() == PluginAutomation) && ( which.id() < parameter_count()) ) {
- if (lilv_port_has_property(_impl->plugin,
- lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.ext_notOnGUI)) {
+ const LilvPort* port = lilv_plugin_get_port_by_index(_impl->plugin, which.id());
+
+ if (lilv_port_has_property(_impl->plugin, port, _world.ext_notOnGUI)) {
return X_("hidden");
}
- if (lilv_port_has_property(_impl->plugin,
- lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.lv2_freewheeling)) {
+ const LilvPort* fwport = lilv_plugin_get_port_by_designation(_impl->plugin, _world.lv2_InputPort, _world.lv2_freewheeling);
+ if (fwport && fwport == port) {
return X_("hidden");
}
- if (lilv_port_has_property(_impl->plugin,
- lilv_plugin_get_port_by_index(_impl->plugin, which.id()), _world.lv2_reportsLatency)) {
+ if (lilv_port_has_property(_impl->plugin, port, _world.lv2_freewheeling)) {
+ return X_("hidden");
+ }
+
+ if (lilv_port_has_property(_impl->plugin, port, _world.lv2_reportsLatency)) {
return X_("latency");
}
int
LV2Plugin::connect_and_run(BufferSet& bufs,
samplepos_t start, samplepos_t end, double speed,
- ChanMapping in_map, ChanMapping out_map,
+ ChanMapping const& in_map, ChanMapping const& out_map,
pframes_t nframes, samplecnt_t offset)
{
DEBUG_TRACE(DEBUG::LV2, string_compose("%1 run %2 offset %3\n", name(), nframes, offset));
// Emit PropertyChanged signal for UI
// TODO: This should emit the control's Changed signal
PropertyChanged(prop_id, Variant(Variant::PATH, path));
+ _property_values[prop_id] = Variant(Variant::PATH, path);
} else {
std::cerr << "warning: patch:Set for unknown property" << std::endl;
}
return p;
}
-bool
-LV2PluginInfo::in_category (const std::string &c) const
-{
- // TODO use untranslated lilv_plugin_get_class()
- // match gtk2_ardour/plugin_selector.cc
- return category == c;
-}
-
-bool
-LV2PluginInfo::is_instrument () const
-{
- if (category == "Instrument") {
- return true;
- }
-#if 1
- /* until we make sure that category remains untranslated in the lv2.ttl spec
- * and until most instruments also classify themselves as such, there's a 2nd check:
- */
- if (n_inputs.n_midi() > 0 && n_inputs.n_audio() == 0 && n_outputs.n_audio() > 0) {
- return true;
- }
-#endif
- return false;
-}
-
PluginInfoList*
LV2PluginInfo::discover()
{