Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demos/modipulate-lua/8vb/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function love.load()

--love.timer.sleep(500)

song:play(true)
song:play()
end

----
Expand Down
4 changes: 2 additions & 2 deletions demos/modipulate-lua/console/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function love.load()
song:onRowChange(rowChanged)
song:onNote(noteChanged)

song:play(true)
song:play()
end


Expand Down Expand Up @@ -112,7 +112,7 @@ function love.keypressed(k)
elseif k == 'o' then
-- Load & play a new song (at the same time)
song2 = modipulate.loadSong('../../media/8vb1.it')
song2:play(true)
song2:play()
end
end

Expand Down
2 changes: 1 addition & 1 deletion demos/modipulate-lua/not-ddr/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ a / s Transpose (octave)\
font = love.graphics.newFont('Courier_New.ttf', 12)
love.graphics.setFont(font)

song:play(true)
song:play()
end

----
Expand Down
39 changes: 0 additions & 39 deletions src/modipulate-osc/patterns.txt

This file was deleted.

26 changes: 22 additions & 4 deletions src/modipulate_lua/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,29 @@ static int modipulateLua_song_destroy(lua_State *L) {


static int modipulateLua_song_play(lua_State *L) {
const char* usage = "Usage: play(bool) where bool is true to play the song, false to stop it";
luaL_argcheck(L, lua_gettop(L) == 2, 0, usage);
const char* usage = "Usage: play() or play(bool) where bool is true to play or false to stop";
int nargs = lua_gettop(L);
int playbool = 1;
luaL_argcheck(L, nargs >= 1 && nargs <= 2, 0, usage);
modipulate_song_t* lua_song = check_modipulate_song_t(L, 1);
if (nargs == 2)
{
luaL_argcheck(L, lua_isboolean(L, 2), 2, usage);
playbool = (int) lua_toboolean(L, 2);
}

MODIPULATE_LUA_ERROR(L, modipulate_song_play(lua_song->song, playbool));

return 0;
}


static int modipulateLua_song_stop(lua_State *L) {
const char* usage = "Usage: stop()";
luaL_argcheck(L, lua_gettop(L) == 1, 0, usage);
modipulate_song_t* lua_song = check_modipulate_song_t(L, 1);
luaL_argcheck(L, lua_isboolean(L, 2), 2, usage);

MODIPULATE_LUA_ERROR(L, modipulate_song_play(lua_song->song, (int) lua_toboolean(L, 2)));
MODIPULATE_LUA_ERROR(L, modipulate_song_play(lua_song->song, 0));

return 0;
}
Expand Down Expand Up @@ -410,6 +427,7 @@ static const luaL_reg modipulate_song_meta_methods[] = {

static const luaL_reg modipulate_song_methods[] = {
{"play", modipulateLua_song_play},
{"stop", modipulateLua_song_stop},
{"getSampleName", modipulateLua_song_get_sample_name},
{"getInstrumentName", modipulateLua_song_get_instrument_name},
{"volumeCommand", modipulateLua_song_volume_command},
Expand Down