From 4192710ac874ed9b44edec9968832c4e03340f16 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 14 May 2023 02:44:27 +0200 Subject: [PATCH] Add Lua bindings to remove routes --- libs/ardour/luabindings.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 8d2ae5f7db..c3aeb7fd1b 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -416,6 +416,20 @@ static RCConfiguration* _libardour_config () { return ARDOUR::Config; } +template +static int to_ptr (lua_State *L) +{ + int top = lua_gettop (L); + if (top != 1) { + return luaL_argerror (L, 1, "invalid number of arguments."); + } + T o = luabridge::Stack::get (L, 1); + T* p = new T (o); + std::shared_ptr sp (p); + luabridge::Stack>::push (L, sp); + return 1; +} + void LuaBindings::stddef (lua_State* L) { @@ -2131,6 +2145,7 @@ LuaBindings::common (lua_State* L) // std::shared_ptr .beginPtrStdList > ("RouteListPtr") .addVoidPtrConstructor > > () + .addStaticCFunction ("from_routelist", &to_ptr) .endClass () // std::shared_ptr @@ -2190,6 +2205,7 @@ LuaBindings::common (lua_State* L) // std::shared_ptr > > .beginPtrStdList > ("RegionListPtr") .addVoidPtrConstructor > > () + .addStaticCFunction ("from_regionlist", &to_ptr) .endClass () // RegionFactory::RegionMap @@ -2912,6 +2928,8 @@ LuaBindings::common (lua_State* L) .addFunction ("new_route_group", &Session::new_route_group) .addFunction ("session_range_is_free", &Session::session_range_is_free) .addFunction ("set_session_range_is_free", &Session::set_session_range_is_free) + .addFunction ("remove_route", &Session::remove_route) + .addFunction ("remove_routes", &Session::remove_routes) .addFunction ("remove_route_group", (void (Session::*)(RouteGroup*))&Session::remove_route_group) .addFunction ("cut_copy_section", &Session::cut_copy_section) .addFunction ("vca_manager", &Session::vca_manager_ptr)