summaryrefslogtreecommitdiff
path: root/src/tangara/lua/lua_queue.cpp
diff options
context:
space:
mode:
authorcooljqln <cooljqln@noreply.codeberg.org>2024-09-19 04:44:16 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2024-09-19 04:44:16 +0000
commit1eddfe97d9398215d4512785c669cf7cc94b6223 (patch)
tree6b7223e9c0e677705ec3ccfd5846f8fe0cdebeb1 /src/tangara/lua/lua_queue.cpp
parent9aa77ec5ad369cd7d5ca46d475df29d971416a73 (diff)
parent7f43d4d1265ce7f456b36f51987c812d35bcd616 (diff)
downloadtangara-fw-1eddfe97d9398215d4512785c669cf7cc94b6223.tar.gz
Merge pull request 'daniel/persistent-positions' (#104) from daniel/persistent-positions into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/104 Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Diffstat (limited to 'src/tangara/lua/lua_queue.cpp')
-rw-r--r--src/tangara/lua/lua_queue.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tangara/lua/lua_queue.cpp b/src/tangara/lua/lua_queue.cpp
index 7eb32c62..07093390 100644
--- a/src/tangara/lua/lua_queue.cpp
+++ b/src/tangara/lua/lua_queue.cpp
@@ -79,10 +79,24 @@ static auto queue_open_playlist(lua_State* state) -> int {
return 0;
}
+static auto queue_play_from(lua_State* state) -> int {
+ Bridge* instance = Bridge::Get(state);
+ audio::TrackQueue& queue = instance->services().track_queue();
+ size_t len = 0;
+ const char* str = luaL_checklstring(state, 1, &len);
+ if (!str) {
+ return 0;
+ }
+ auto pos = luaL_checkinteger(state, 2);
+ queue.playFromPosition(str, pos);
+ return 0;
+}
+
static const struct luaL_Reg kQueueFuncs[] = {
{"add", queue_add},
{"clear", queue_clear},
{"open_playlist", queue_open_playlist},
+ {"play_from", queue_play_from},
{NULL, NULL}};
static auto lua_queue(lua_State* state) -> int {