From 24f070610c0f619f7f778eeba4fbb2e08b3f9cf8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 24 Feb 2017 14:11:56 +0100 Subject: Save Lua script origin (for later updates) -- DSP plugin --- libs/ardour/ardour/luaproc.h | 6 ++++++ libs/ardour/luaproc.cc | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h index 423a960feb..2c4f798945 100644 --- a/libs/ardour/ardour/luaproc.h +++ b/libs/ardour/ardour/luaproc.h @@ -132,8 +132,13 @@ private: void find_presets (); /* END Plugin interface */ + +public: + void set_origin (std::string& path) { _origin = path; } + protected: const std::string& script() const { return _script; } + const std::string& origin() const { return _origin; } private: #ifdef USE_TLSF @@ -144,6 +149,7 @@ private: LuaState lua; luabridge::LuaRef * _lua_dsp; std::string _script; + std::string _origin; std::string _docs; bool _lua_does_channelmapping; bool _lua_has_inline_display; diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index 9b51565b9c..bae1bd6d3d 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -87,6 +87,7 @@ LuaProc::LuaProc (const LuaProc &other) #endif , _lua_dsp (0) , _script (other.script ()) + , _origin (other._origin) , _lua_does_channelmapping (false) , _lua_has_inline_display (false) , _designated_bypass_port (UINT32_MAX) @@ -763,6 +764,7 @@ LuaProc::add_state (XMLNode* root) const g_free (b64); XMLNode* script_node = new XMLNode (X_("script")); script_node->add_property (X_("lua"), LUA_VERSION); + script_node->add_property (X_("origin"), _origin); script_node->add_content (b64s); root->add_child_nocopy (*script_node); @@ -787,6 +789,10 @@ LuaProc::set_script_from_state (const XMLNode& node) } if ((child = node.child (X_("script"))) != 0) { + XMLProperty const* prop; + if ((prop = node.property ("origin")) != 0) { + _origin = prop->value(); + } for (XMLNodeList::const_iterator n = child->children ().begin (); n != child->children ().end (); ++n) { if (!(*n)->is_content ()) { continue; } gsize size; @@ -1242,7 +1248,9 @@ LuaPluginInfo::load (Session& session) } try { - PluginPtr plugin (new LuaProc (session.engine (), session, script)); + LuaProc* lp = new LuaProc (session.engine (), session, script); + lp->set_origin (path); + PluginPtr plugin (lp); return plugin; } catch (failed_constructor& err) { ; -- cgit v1.2.3