implement LuaProc inline display
This commit is contained in:
parent
4ef3e25185
commit
c648adfe43
@ -30,6 +30,7 @@
|
||||
#include "ardour/types.h"
|
||||
#include "ardour/plugin.h"
|
||||
#include "ardour/luascripting.h"
|
||||
#include "ardour/dsp_filter.h"
|
||||
|
||||
#include "lua/luastate.h"
|
||||
#include "LuaBridge/LuaBridge.h"
|
||||
@ -98,6 +99,8 @@ public:
|
||||
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);
|
||||
|
||||
private:
|
||||
void find_presets () { }
|
||||
@ -114,6 +117,11 @@ private:
|
||||
std::string _script;
|
||||
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;
|
||||
|
||||
void init ();
|
||||
bool load_script ();
|
||||
|
@ -122,10 +122,22 @@ LuaProc::init ()
|
||||
LuaBindings::common (L);
|
||||
LuaBindings::dsp (L);
|
||||
|
||||
luabridge::getGlobalNamespace (L)
|
||||
.beginNamespace ("Ardour")
|
||||
.beginClass <LuaProc> ("LuaProc")
|
||||
.addFunction ("queue_draw", &LuaProc::queue_draw)
|
||||
.addFunction ("shmem", &LuaProc::instance_shm)
|
||||
.endClass ()
|
||||
.endNamespace ();
|
||||
|
||||
// add session to global lua namespace
|
||||
luabridge::push <Session *> (L, &_session);
|
||||
lua_setglobal (L, "Session");
|
||||
|
||||
// instance
|
||||
luabridge::push <LuaProc *> (L, this);
|
||||
lua_setglobal (L, "self");
|
||||
|
||||
// sandbox
|
||||
lua.do_command ("io = nil os = nil loadfile = nil require = nil dofile = nil package = nil debug = nil");
|
||||
#if 0
|
||||
@ -206,6 +218,11 @@ LuaProc::load_script ()
|
||||
|
||||
_ctrl_params.clear ();
|
||||
|
||||
luabridge::LuaRef lua_render = luabridge::getGlobal (L, "render_inline");
|
||||
if (lua_render.isFunction ()) {
|
||||
_lua_has_inline_display = true;
|
||||
}
|
||||
|
||||
luabridge::LuaRef lua_params = luabridge::getGlobal (L, "dsp_params");
|
||||
if (lua_params.isFunction ()) {
|
||||
|
||||
@ -842,6 +859,37 @@ LuaProc::get_scale_points (uint32_t port) const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LuaProc::setup_lua_inline_gui (LuaState *lua_gui)
|
||||
{
|
||||
lua_State* LG = lua_gui->getState ();
|
||||
LuaBindings::stddef (LG);
|
||||
LuaBindings::common (LG);
|
||||
LuaBindings::dsp (LG);
|
||||
|
||||
#ifndef NDEBUG
|
||||
lua_gui->Print.connect (sigc::mem_fun (*this, &LuaProc::lua_print));
|
||||
#endif
|
||||
|
||||
lua_gui->do_command ("function ardour () end");
|
||||
lua_gui->do_command (_script);
|
||||
|
||||
// TODO think: use a weak-pointer here ?
|
||||
// (the GUI itself uses a shared ptr to this plugin, so we should be good)
|
||||
luabridge::getGlobalNamespace (LG)
|
||||
.beginNamespace ("Ardour")
|
||||
.beginClass <LuaProc> ("LuaProc")
|
||||
.addFunction ("shmem", &LuaProc::instance_shm)
|
||||
.endClass ()
|
||||
.endNamespace ();
|
||||
|
||||
luabridge::push <LuaProc *> (LG, this);
|
||||
lua_setglobal (LG, "self");
|
||||
|
||||
luabridge::push <float *> (LG, _shadow_data);
|
||||
lua_setglobal (LG, "CtrlPorts");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
|
Loading…
Reference in New Issue
Block a user