X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=theme.lua;h=495f1fc3cbff2d752c36e504ef00a7081d7b6354;hb=e45ebd282e3c6c369475ef0987945eca62ef8f58;hp=04195f28f7d58f707cba5e8ec7ab5a109c290f1e;hpb=52e243fee63f15d7cc57ec24b72bcef5a3f0adcd;p=nageru diff --git a/theme.lua b/theme.lua index 04195f2..495f1fc 100644 --- a/theme.lua +++ b/theme.lua @@ -333,6 +333,41 @@ function channel_signal(channel) end end +-- API ENTRY POINT +-- Called every frame. Returns the color (if any) to paint around the given +-- channel. Returns a CSS color (typically to mark live and preview signals); +-- "transparent" is allowed. +-- Will never be called for live (0) or preview (1). +function channel_color(channel) + if channel_involved_in(channel, live_signal_num) then + return "#f00" + end + if channel_involved_in(channel, preview_signal_num) then + return "#0f0" + end + return "transparent" +end + +function channel_involved_in(channel, signal_num) + if signal_num == INPUT0_SIGNAL_NUM then + return channel == 2 + end + if signal_num == INPUT1_SIGNAL_NUM then + return channel == 3 + end + if signal_num == SBS_SIGNAL_NUM then + return (channel == 2 or channel == 3) + end + if signal_num == STATIC_SIGNAL_NUM then + return (channel == 5) + end + if signal_num == FADE_SIGNAL_NUM then + return (channel_involved_in(channel, fade_src_signal) or + channel_involved_in(channel, fade_dst_signal)) + end + return false +end + -- API ENTRY POINT -- Returns if a given channel supports setting white balance (starting from 2). -- Called only once for each channel, at the start of the program. @@ -400,8 +435,7 @@ function get_transitions(t) end -- API ENTRY POINT --- Called when the user clicks a transition button. For our case, --- we only do cuts, so we ignore the parameters; just switch live and preview. +-- Called when the user clicks a transition button. function transition_clicked(num, t) if num == 0 then -- Cut. @@ -820,9 +854,9 @@ end function calc_fade_progress(t, transition_start, transition_end) local tt = (t - transition_start) / (transition_end - transition_start) if tt < 0.0 then - tt = 0.0 + return 0.0 elseif tt > 1.0 then - tt = 1.0 + return 1.0 end -- Make the fade look maybe a tad more natural, by pumping it