X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fluaproc.cc;h=6617e8582f35831b64d3da6d9a07a69b1435f801;hb=8139becb1898187729b0ea57f145302d4975bf3a;hp=0e181dbb6b80734ee5f88f541bc3963ed41d578d;hpb=579d856cc7ded1817028eaf0cecf5f344fe3e335;p=ardour.git diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc index 0e181dbb6b..6617e8582f 100644 --- a/libs/ardour/luaproc.cc +++ b/libs/ardour/luaproc.cc @@ -163,7 +163,7 @@ LuaProc::init () lua_setglobal (L, "self"); // sandbox - lua.do_command ("io = nil os = nil loadfile = nil require = nil dofile = nil package = nil debug = nil"); + lua.sandbox (true); #if 0 lua.do_command ("for n in pairs(_G) do print(n) end print ('----')"); // print global env #endif @@ -236,10 +236,9 @@ LuaProc::load_script () luabridge::LuaRef lua_dsp_init = luabridge::getGlobal (L, "dsp_init"); if (lua_dsp_init.type () == LUA_TFUNCTION) { try { - lua_dsp_init (_session.nominal_frame_rate ()); + lua_dsp_init (_session.nominal_sample_rate ()); } catch (luabridge::LuaException const& e) { - ; - } + } catch (...) { } } _ctrl_params.clear (); @@ -354,6 +353,8 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan } } catch (luabridge::LuaException const& e) { _iotable = NULL; + } catch (...) { + _iotable = NULL; } } @@ -584,6 +585,8 @@ LuaProc::configure_io (ChanCount in, ChanCount out) std::cerr << "LuaException: " << e.what () << "\n"; #endif return false; + } catch (...) { + return false; } } } @@ -596,9 +599,9 @@ LuaProc::configure_io (ChanCount in, ChanCount out) int LuaProc::connect_and_run (BufferSet& bufs, - framepos_t start, framepos_t end, double speed, + samplepos_t start, samplepos_t end, double speed, ChanMapping in, ChanMapping out, - pframes_t nframes, framecnt_t offset) + pframes_t nframes, samplecnt_t offset) { if (!_lua_dsp) { return 0; @@ -670,7 +673,7 @@ LuaProc::connect_and_run (BufferSet& bufs, if (valid) { for (MidiBuffer::iterator m = bufs.get_midi(idx).begin(); m != bufs.get_midi(idx).end(); ++m, ++e) { - const Evoral::Event ev(*m, false); + const Evoral::Event ev(*m, false); luabridge::LuaRef lua_midi_data (luabridge::newTable (L)); const uint8_t* data = ev.buffer(); for (uint32_t i = 0; i < ev.size(); ++i) { @@ -713,7 +716,7 @@ LuaProc::connect_and_run (BufferSet& bufs, if (!i.value ()["time"].isNumber ()) { continue; } if (!i.value ()["data"].isTable ()) { continue; } luabridge::LuaRef data_tbl (i.value ()["data"]); - framepos_t tme = i.value ()["time"]; + samplepos_t tme = i.value ()["time"]; if (tme < 1 || tme > nframes) { continue; } uint8_t data[64]; size_t size = 0; @@ -734,6 +737,8 @@ LuaProc::connect_and_run (BufferSet& bufs, std::cerr << "LuaException: " << e.what () << "\n"; #endif return -1; + } catch (...) { + return -1; } #ifdef WITH_LUAPROC_STATS int64_t t1 = g_get_monotonic_time ();