X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fluaproc.h;h=a07725417983d693da8a288d9f88d90e2ede6a42;hb=HEAD;hp=887280921c88ac80e2a780a72d3ec9f59578f5e3;hpb=7840bb1b14dcf2501b2cd6adc3f2960397a115f7;p=ardour.git diff --git a/libs/ardour/ardour/luaproc.h b/libs/ardour/ardour/luaproc.h index 887280921c..a077254179 100644 --- a/libs/ardour/ardour/luaproc.h +++ b/libs/ardour/ardour/luaproc.h @@ -17,6 +17,13 @@ 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* print runtime and garbage-collection timing statistics */ +//#define WITH_LUAPROC_STATS + +/* memory allocation system, default: ReallocPool */ +//#define USE_TLSF // use TLSF instead of ReallocPool +//#define USE_MALLOC // or plain OS provided realloc (no mlock) -- if USE_TLSF isn't defined + #ifndef __ardour_luaproc_h__ #define __ardour_luaproc_h__ @@ -24,16 +31,25 @@ #include #include -#include "pbd/reallocpool.h" +#ifdef USE_TLSF +# include "pbd/tlsf.h" +#else +# include "pbd/reallocpool.h" +#endif + #include "pbd/stateful.h" #include "ardour/types.h" #include "ardour/plugin.h" #include "ardour/luascripting.h" #include "ardour/dsp_filter.h" +#include "ardour/lua_api.h" #include "lua/luastate.h" -#include "LuaBridge/LuaBridge.h" + +namespace luabridge { + class LuaRef; +} namespace ARDOUR { @@ -60,6 +76,8 @@ public: std::string get_docs () const { return _docs; } std::string get_parameter_docs (uint32_t) const; + PluginOutputConfiguration possible_output () const { return _output_configs; } + std::set automatable() const; void activate () { } @@ -67,11 +85,12 @@ public: void cleanup () { } int set_block_size (pframes_t /*nframes*/) { return 0; } - framecnt_t signal_latency() const { return 0; } + samplecnt_t signal_latency() const { return _signal_latency; } int connect_and_run (BufferSet& bufs, - ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset); + samplepos_t start, samplepos_t end, double speed, + ChanMapping const& in, ChanMapping const& out, + pframes_t nframes, samplecnt_t offset); std::string describe_parameter (Evoral::Parameter); void print_parameter (uint32_t, char*, uint32_t len) const; @@ -82,55 +101,83 @@ public: bool parameter_is_input (uint32_t) const; bool parameter_is_output (uint32_t) const; + uint32_t designated_bypass_port () { + return _designated_bypass_port; + } + std::string state_node_name() const { return "luaproc"; } void add_state (XMLNode *) const; int set_state (const XMLNode&, int version); int set_script_from_state (const XMLNode&); - bool load_preset (PresetRecord) { return false; } + bool load_preset (PresetRecord); + std::string do_save_preset (std::string); + void do_remove_preset (std::string); + bool has_editor() const { return false; } - bool can_support_io_configuration (const ChanCount& in, ChanCount& out); + bool can_support_io_configuration (const ChanCount& in, ChanCount& out, ChanCount* imprecise); bool configure_io (ChanCount in, ChanCount out); ChanCount output_streams() const { return _configured_out; } ChanCount input_streams() const { return _configured_in; } - std::string do_save_preset (std::string) { return ""; } - void do_remove_preset (std::string) { } - bool has_inline_display () { return _lua_has_inline_display; } void setup_lua_inline_gui (LuaState *lua_gui); + DSP::DspShm* instance_shm () { return &lshm; } + LuaTableRef* instance_ref () { return &lref; } + private: - void find_presets () { } + 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 + PBD::TLSF _mempool; +#else PBD::ReallocPool _mempool; +#endif LuaState lua; luabridge::LuaRef * _lua_dsp; + luabridge::LuaRef * _lua_latency; std::string _script; + std::string _origin; std::string _docs; bool _lua_does_channelmapping; bool _lua_has_inline_display; void queue_draw () { QueueDraw(); /* EMIT SIGNAL */ } - DSP::DspShm* instance_shm () { return &lshm; } DSP::DspShm lshm; + LuaTableRef lref; + + boost::weak_ptr route () const; + void init (); bool load_script (); void lua_print (std::string s); + std::string preset_name_to_uri (const std::string&) const; + std::string presets_file () const; + XMLTree* presets_tree () const; + boost::shared_ptr parse_scale_points (luabridge::LuaRef*); std::vector > _ctrl_params; std::map _param_desc; std::map _param_doc; + uint32_t _designated_bypass_port; + + samplecnt_t _signal_latency; float* _control_data; float* _shadow_data; @@ -138,9 +185,17 @@ private: ChanCount _configured_in; ChanCount _configured_out; + bool _configured; + + ChanCount _selected_in; + ChanCount _selected_out; + + PluginOutputConfiguration _output_configs; + bool _has_midi_input; bool _has_midi_output; + #ifdef WITH_LUAPROC_STATS int64_t _stats_avg[2]; int64_t _stats_max[2]; @@ -157,7 +212,6 @@ class LIBARDOUR_API LuaPluginInfo : public PluginInfo PluginPtr load (Session& session); std::vector get_presets (bool user_only) const; - bool is_instrument () const { return false; } bool reconfigurable_io() const { return true; } };