Optimize plugin-processing for non-automated params
[ardour.git] / libs / ardour / ardour / luascripting.h
index a5a066b2cd57657690cbd0d217f6755db85fb4d1..7570ff1bc84716100090f85ae71d2f96d75fef50 100644 (file)
@@ -23,6 +23,7 @@
 #include <boost/shared_ptr.hpp>
 #include <glibmm/threads.h>
 
+#include "pbd/signals.h"
 #include "ardour/libardour_visibility.h"
 
 namespace ARDOUR {
@@ -36,22 +37,36 @@ class LIBARDOUR_API LuaScriptInfo {
                Session,
                EditorHook,
                EditorAction,
+               Snippet,
+               SessionInit,
+       };
+
+       /* binary flags, valid for ActionScripts */
+       enum ScriptSubType {
+               None          = 0x00,
+               RouteSetup    = 0x01,
+               SessionSetup  = 0x02,
        };
 
        static std::string type2str (const ScriptType t);
        static ScriptType str2type (const std::string& str);
 
-       LuaScriptInfo (ScriptType t, const std::string &n, const std::string &p)
+       LuaScriptInfo (ScriptType t, const std::string &n, const std::string &p, const std::string &uid)
        : type (t)
+       , subtype (0)
        , name (n)
        , path (p)
+       , unique_id (uid)
        { }
 
        virtual ~LuaScriptInfo () { }
 
        ScriptType type;
+       uint32_t   subtype;
+
        std::string name;
        std::string path;
+       std::string unique_id;
 
        std::string author;
        std::string license;
@@ -65,11 +80,12 @@ struct LIBARDOUR_API LuaScriptParam {
                                const std::string& n,
                                const std::string& t,
                                const std::string& d,
-                               bool o)
+                               bool o, bool p)
                        : name (n)
                        , title (t)
                        , dflt (d)
                        , optional (o)
+                       , preseeded (p)
                        , is_set (false)
                        , value (d)
        {}
@@ -78,6 +94,7 @@ struct LIBARDOUR_API LuaScriptParam {
                std::string title;
                std::string dflt;
                bool optional;
+               bool preseeded;
                bool is_set;
                std::string value;
 };
@@ -98,24 +115,19 @@ public:
        ~LuaScripting ();
 
        LuaScriptList &scripts (LuaScriptInfo::ScriptType);
+       void refresh (bool run_scan = false);
+       PBD::Signal0<void> scripts_changed;
 
-       void refresh ();
-       static LuaScriptInfoPtr script_info (const std::string &script ) { return scan_script ("", script); }
-
-       static LuaScriptParamList script_params (LuaScriptInfoPtr, const std::string &);
-       static LuaScriptParamList session_script_params (LuaScriptInfoPtr lsi) {
-               return script_params (lsi, "sess_params");
-       }
-
+       static LuaScriptInfoPtr script_info (const std::string &script);
        static bool try_compile (const std::string&, const LuaScriptParamList&);
-       static std::string get_factory_bytecode (const std::string&);
+       static std::string get_factory_bytecode (const std::string&, const std::string& ffn = "factory", const std::string& fp = "f");
+       static std::string user_script_dir ();
 
 private:
        static LuaScripting* _instance; // singleton
        LuaScripting ();
 
        void scan ();
-       void check_scan ();
        static LuaScriptInfoPtr scan_script (const std::string &, const std::string & sc = "");
        static void lua_print (std::string s);
 
@@ -123,6 +135,9 @@ private:
        LuaScriptList *_sl_session;
        LuaScriptList *_sl_hook;
        LuaScriptList *_sl_action;
+       LuaScriptList *_sl_snippet;
+       LuaScriptList *_sl_setup;
+       LuaScriptList *_sl_tracks;
        LuaScriptList  _empty_script_info;
 
        Glib::Threads::Mutex _lock;