]> git.sesse.net Git - nageru/commitdiff
Add a theme function Nageru.schedule_cut().
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 1 Mar 2024 11:00:56 +0000 (12:00 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 1 Mar 2024 11:01:35 +0000 (12:01 +0100)
This allows the theme to schedule a video file cut.
Based on code by Marcus Nilsen.

nageru/theme.cpp

index 19c90d4783c9a695f1175cb6268740973d3d730f..cf323b0bb041a2c86b0119567085dbce512fd9ba 100644 (file)
@@ -1448,6 +1448,15 @@ int Nageru_set_audio_bus_mute(lua_State *L)
        return 0;
 }
 
+int Nageru_schedule_cut(lua_State *L)
+{
+       if (global_mixer == nullptr) {
+               luaL_error(L, "Cuts can not be scheduled before the theme is done initializing.");
+       }
+       global_mixer->schedule_cut();
+       return 0;
+}
+
 int Nageru_get_audio_bus_eq_level_db(lua_State *L)
 {
        if (global_audio_mixer == nullptr) {
@@ -1660,6 +1669,9 @@ void Theme::register_globals()
                { "get_audio_bus_mute", Nageru_get_audio_bus_mute },
                { "set_audio_bus_mute", Nageru_set_audio_bus_mute },
 
+               // Misc.
+               { "schedule_cut", Nageru_schedule_cut },
+
                { nullptr, nullptr }
        };
        lua_pushlightuserdata(L, this);