diff --git a/src/engine/MidiPipe.cpp b/src/engine/MidiPipe.cpp index 6576aef6b..28280b591 100644 --- a/src/engine/MidiPipe.cpp +++ b/src/engine/MidiPipe.cpp @@ -169,6 +169,14 @@ int LuaMidiPipe::size (lua_State* L) return 1; } +int LuaMidiPipe::clear (lua_State* L) +{ + auto* pipe = *(LuaMidiPipe**) lua_touserdata (L, 1); + for (int i = pipe->buffers.size(); --i >= 0;) + (**pipe->buffers.getUnchecked(i)).buffer.clear(); + return 0; +} + } static int midipipe_new (lua_State* L) @@ -191,6 +199,7 @@ static const luaL_Reg methods[] = { { "get", Element::LuaMidiPipe::get }, { "resize", Element::LuaMidiPipe::resize }, { "size", Element::LuaMidiPipe::size }, + { "clear", Element::LuaMidiPipe::clear }, { nullptr, nullptr } }; diff --git a/src/engine/MidiPipe.h b/src/engine/MidiPipe.h index e4416c290..66f6914c2 100644 --- a/src/engine/MidiPipe.h +++ b/src/engine/MidiPipe.h @@ -83,6 +83,7 @@ class LuaMidiPipe final static int get (lua_State* L); static int resize (lua_State* L); static int size (lua_State* L); + static int clear (lua_State* L); private: lua_State* state = nullptr; diff --git a/src/engine/nodes/LuaNode.cpp b/src/engine/nodes/LuaNode.cpp index b3d130c48..0febd7908 100644 --- a/src/engine/nodes/LuaNode.cpp +++ b/src/engine/nodes/LuaNode.cpp @@ -316,7 +316,7 @@ struct LuaNode::Context local a = AudioBuffer (__ln_validate_nchans, __ln_validate_nframes) local m = MidiPipe (__ln_validate_nmidi) - + for _ = 1,4 do for i = 0,m:size() - 1 do local b = m:get(i) diff --git a/tests/scripting/ScriptManagerTest.cpp b/tests/scripting/ScriptManagerTest.cpp index 36d1326ef..7ec954a62 100644 --- a/tests/scripting/ScriptManagerTest.cpp +++ b/tests/scripting/ScriptManagerTest.cpp @@ -16,6 +16,9 @@ along with this program. If not, see . */ +// FIXME: Local lua paths in release build +#if JUCE_DEBUG + #include "Tests.h" #include "scripting/ScriptManager.h" #include "scripting/LuaBindings.h" @@ -41,3 +44,4 @@ class ScriptManagerTest : public UnitTestBase }; static ScriptManagerTest sScriptManagerTest; +#endif