Skip to content

Commit 3233c02

Browse files
committed
Fix broken tests when in release config.
1 parent 1775099 commit 3233c02

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

src/engine/MidiPipe.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ int LuaMidiPipe::size (lua_State* L)
169169
return 1;
170170
}
171171

172+
int LuaMidiPipe::clear (lua_State* L)
173+
{
174+
auto* pipe = *(LuaMidiPipe**) lua_touserdata (L, 1);
175+
for (int i = pipe->buffers.size(); --i >= 0;)
176+
(**pipe->buffers.getUnchecked(i)).buffer.clear();
177+
return 0;
178+
}
179+
172180
}
173181

174182
static int midipipe_new (lua_State* L)
@@ -191,6 +199,7 @@ static const luaL_Reg methods[] = {
191199
{ "get", Element::LuaMidiPipe::get },
192200
{ "resize", Element::LuaMidiPipe::resize },
193201
{ "size", Element::LuaMidiPipe::size },
202+
{ "clear", Element::LuaMidiPipe::clear },
194203
{ nullptr, nullptr }
195204
};
196205

src/engine/MidiPipe.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class LuaMidiPipe final
8383
static int get (lua_State* L);
8484
static int resize (lua_State* L);
8585
static int size (lua_State* L);
86+
static int clear (lua_State* L);
8687

8788
private:
8889
lua_State* state = nullptr;

src/engine/nodes/LuaNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ struct LuaNode::Context
316316
317317
local a = AudioBuffer (__ln_validate_nchans, __ln_validate_nframes)
318318
local m = MidiPipe (__ln_validate_nmidi)
319-
319+
320320
for _ = 1,4 do
321321
for i = 0,m:size() - 1 do
322322
local b = m:get(i)

tests/scripting/ScriptManagerTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19+
// FIXME: Local lua paths in release build
20+
#if JUCE_DEBUG
21+
1922
#include "Tests.h"
2023
#include "scripting/ScriptManager.h"
2124
#include "scripting/LuaBindings.h"
@@ -41,3 +44,4 @@ class ScriptManagerTest : public UnitTestBase
4144
};
4245

4346
static ScriptManagerTest sScriptManagerTest;
47+
#endif

0 commit comments

Comments
 (0)