]> git.sesse.net Git - ultimatescore/blobdiff - nageru/ultimate.lua
Make the roster scripts executable.
[ultimatescore] / nageru / ultimate.lua
index 6bfa1c1988319175d2485e9c20db1f20a454982f..16cb5b1497d042c30e21e23eece7df91ba300f86 100644 (file)
@@ -1,6 +1,6 @@
 -- Nageru theme for TFK mini-tournament 2017, based on the default theme.
 
-local futatabi_server = "http://10.42.0.2:9096"
+local futatabi_server = "http://10.42.0.1:9096"
 
 local state = {
        transition_start = -2.0,
@@ -24,7 +24,7 @@ local state = {
        live_signal_num = 0,
        preview_signal_num = 1
 }
-local NUM_CAMERAS = 6
+local NUM_CAMERAS = 7
 
 -- Valid values for live_signal_num and preview_signal_num.
 local INPUT0_SIGNAL_NUM = 0
@@ -33,6 +33,8 @@ local INPUT2_SIGNAL_NUM = 2
 local INPUT3_SIGNAL_NUM = 3
 local INPUT4_SIGNAL_NUM = 4
 local INPUT5_SIGNAL_NUM = 5
+local INPUT6_SIGNAL_NUM = 6
+local COMMENTATOR_SIGNAL_NUM = 4
 local VIDEO_SIGNAL_NUM = NUM_CAMERAS
 local SBS_SIGNAL_NUM = NUM_CAMERAS + 1
 local STATIC_SIGNAL_NUM = NUM_CAMERAS + 2
@@ -60,7 +62,7 @@ local bg_video = VideoInput.new(cef_path .. "/flow-720.mp4", Nageru.VIDEO_FORMAT
 local iptv_video = VideoInput.new(futatabi_server, Nageru.VIDEO_FORMAT_YCBCR)
 iptv_video:change_rate(10.0)
 
-local static_image = ImageInput.new(cef_path .. "/nageru/dsn-bg.png")
+local static_image = ImageInput.new(cef_path .. "/nageru/tfk_pause.png")
 local first_frame = true
 local multiviewer_enabled = false
 
@@ -93,7 +95,7 @@ function make_fade_input(scene)
        local ret = {
                input = scene:add_input(),
                resample_effect = scene:add_optional_effect(ResampleEffect.new()),  -- Activated if scaling.
-               wb_effect = scene:add_auto_white_balance()
+               wb_effect = scene:add_white_balance()
        }
        ret.overlay = make_overlay(scene, ret.wb_effect)
        return ret
@@ -134,7 +136,7 @@ fade_scene = make_fade_scene()
 
 function make_sbs_input(scene, has_overlay)
        local input = scene:add_input()
-       local wb_effect = scene:add_auto_white_balance()
+       local wb_effect = scene:add_white_balance()
        local overlay = has_overlay and make_overlay(scene, wb_effect) or nil
        local resample_effect = scene:add_effect({ResampleEffect.new(), ResizeEffect.new()})
        local padding_effect = scene:add_effect(IntegralPaddingEffect.new())
@@ -179,7 +181,7 @@ function make_simple_scene_no_finalize()
 
        local input = scene:add_input()
        local resample_effect = scene:add_effect({ResampleEffect.new(), ResizeEffect.new(), IdentityEffect.new()})
-       local wb_effect = scene:add_auto_white_balance()
+       local wb_effect = scene:add_white_balance()
        local overlay = make_overlay(scene, wb_effect)
 
        return {
@@ -202,7 +204,7 @@ local simple_scene = make_simple_scene()
 -- Load all the stinger frames.
 local stinger_images = {}
 for idx=0,24 do
-       local filename = cef_path .. "/stinger/esk-blur" .. string.rep("0", 3 - string.len(tostring(idx))) .. idx .. ".png"
+       local filename = cef_path .. "/stinger/blur" .. string.rep("0", 3 - string.len(tostring(idx))) .. idx .. ".png"
        stinger_images[idx] = ImageInput.new(filename)
 end
 
@@ -296,7 +298,7 @@ function num_channels()
 end
 
 function is_plain_signal(num)
-       return (num >= INPUT0_SIGNAL_NUM and num <= INPUT5_SIGNAL_NUM) or (num == VIDEO_SIGNAL_NUM)
+       return (num >= INPUT0_SIGNAL_NUM and num <= INPUT6_SIGNAL_NUM) or (num == VIDEO_SIGNAL_NUM)
 end
 
 -- Helper function to write e.g. “720p60”. The difference between this
@@ -370,9 +372,11 @@ function channel_name(channel)
        elseif signal_num == INPUT3_SIGNAL_NUM then
                return "Goal R (" .. get_channel_resolution(signal_num) .. ")"
        elseif signal_num == INPUT4_SIGNAL_NUM then
-               return "Ambience (" .. get_channel_resolution(signal_num) .. ")"
-       elseif signal_num == INPUT5_SIGNAL_NUM then
                return "Commentators (" .. get_channel_resolution(signal_num) .. ")"
+       elseif signal_num == INPUT5_SIGNAL_NUM then
+               return "Hall A2 (" .. get_channel_resolution(signal_num) .. ")"
+       elseif signal_num == INPUT6_SIGNAL_NUM then
+               return "Hall A1 (" .. get_channel_resolution(signal_num) .. ")"
        elseif signal_num == VIDEO_SIGNAL_NUM then
                local res = last_resolution[iptv_video:get_signal_num()]
                if (not res) or res.last_subtitle == nil then
@@ -469,12 +473,12 @@ function in_transition(t)
 end
 
 function is_sbs_participating_signal(signal_num)
-       return signal_num == INPUT0_SIGNAL_NUM or signal_num == INPUT4_SIGNAL_NUM
+       return signal_num == INPUT0_SIGNAL_NUM or signal_num == COMMENTATOR_SIGNAL_NUM
 end
 
 function simple_signal_has_overlay(signal_num)
        -- The commentator output has no overlay on it.
-       return signal_num ~= INPUT4_SIGNAL_NUM
+       return signal_num ~= COMMENTATOR_SIGNAL_NUM
 end
 
 -- API ENTRY POINT
@@ -724,6 +728,8 @@ function fetch_input_resolution(signals, signal_num)
        return res
 end
 
+local last_alsa_sound_shark_volume = -1   -- Always update on the first frame.
+
 function update_volume()
        if Nageru.get_num_audio_buses() < 3 or
           Nageru.get_audio_bus_name(2) ~= 'Sound Shark' then
@@ -741,6 +747,13 @@ function update_volume()
                volume_db = -100.0
        end
        cef_input:execute_javascript_async("set_sound_shark_volume_db(" .. volume_db .. ")")
+
+       local desired_alsa_sound_shark_volume = (volume_db < -40.0) and 0 or 154  -- 154 corresponds to 70% in alsamixer for this input.
+       if desired_alsa_sound_shark_volume ~= last_alsa_sound_shark_volume then
+               os.execute("amixer -D hw:CARD=USB sset 'Mix A Input 04' " .. desired_alsa_sound_shark_volume .. " &")
+               os.execute("amixer -D hw:CARD=USB sset 'Mix B Input 04' " .. desired_alsa_sound_shark_volume .. " &")
+               last_alsa_sound_shark_volume = desired_alsa_sound_shark_volume
+       end
 end
 
 local last_rate = 0.0
@@ -933,7 +946,7 @@ end
 
 function prepare_sbs_scene(state, scene, t, transition_type, src_signal, dst_signal, screen_width, screen_height, input_resolution, hq)
        scene.input0.input:display(0)
-       scene.input1.input:display(5)
+       scene.input1.input:display(COMMENTATOR_SIGNAL_NUM)
 
        -- Both inputs are the same size (true side-by-side).
        local pos0 = pos_from_top_left(1280 - 616 - 16, 186, 616, 347, screen_width, screen_height)
@@ -959,7 +972,7 @@ function prepare_sbs_scene(state, scene, t, transition_type, src_signal, dst_sig
 
                if signal == INPUT0_SIGNAL_NUM then
                        affine_param = find_affine_param(pos0, lerp_pos(pos0, pos_fs, real_t))
-               elseif signal == INPUT4_SIGNAL_NUM then
+               elseif signal == COMMENTATOR_SIGNAL_NUM then
                        affine_param = find_affine_param(pos1, lerp_pos(pos1, pos_fs, real_t))
                end
        end