diff options
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | applause.c | 8 | ||||
-rw-r--r-- | applause.lua | 4 |
3 files changed, 10 insertions, 9 deletions
@@ -2,15 +2,8 @@ CC = gcc CFLAGS = -std=c99 -Wall -O2 -LUAJIT = yes - -ifeq ($(LUAJIT),yes) LUA_CFLAGS = $(shell pkg-config --cflags luajit) LUA_LDFLAGS = $(shell pkg-config --libs luajit) -else -LUA_CFLAGS = $(shell pkg-config --cflags lua5.1) -LUA_LDFLAGS = $(shell pkg-config --libs lua5.1) -endif READLINE_CFLAGS = READLINE_LDFLAGS = -lreadline -lhistory @@ -16,6 +16,7 @@ #include <lua.h> #include <lauxlib.h> #include <lualib.h> +#include <luajit.h> #include <readline/readline.h> #include <readline/history.h> @@ -494,6 +495,13 @@ l_Stream_play(lua_State *L) luaL_checktype(L, -1, LUA_TFUNCTION); /* + * Make sure JIT compilation is turned on for the generator function + * and all subfunctions. + * This should not be necessary theoretically. + */ + luaJIT_setmode(L, -1, LUAJIT_MODE_ALLFUNC | LUAJIT_MODE_ON); + + /* * Perform garbage collection cycle and turn it off * temporarily. This improves the realtime properties * of the sample generation loop below. diff --git a/applause.lua b/applause.lua index c701bc3..644c23d 100644 --- a/applause.lua +++ b/applause.lua @@ -2,7 +2,7 @@ local sndfile = require "sndfile" local ffi = require "ffi" local bit = require "bit" --- Make table.new() available +-- Make table.new() available (a LuaJIT extension) require "table.new" -- @@ -336,7 +336,7 @@ function Stream:totable() end local tick = self:tick() - local vector = {} + local vector = table.new(self:len(), 0) while true do local value = tick() |