-local main_chain_hq = make_sbs_chain(true)
-local main_chain_lq = make_sbs_chain(false)
-
--- A chain to fade between two inputs (live chain only)
-local fade_chain_hq = EffectChain.new(16, 9)
-local fade_chain_hq_input0 = fade_chain_hq:add_live_input()
-local fade_chain_hq_input1 = fade_chain_hq:add_live_input()
-fade_chain_hq_input0:connect_signal(0)
-fade_chain_hq_input1:connect_signal(1)
-local fade_chain_mix_effect = fade_chain_hq:add_effect(MixEffect.new(), fade_chain_hq_input0, fade_chain_hq_input1)
-fade_chain_hq:finalize(true)
-
--- A chain to show a single input on screen (HQ version).
-local simple_chain_hq = EffectChain.new(16, 9)
-local simple_chain_hq_input = simple_chain_hq:add_live_input()
-simple_chain_hq_input:connect_signal(0) -- First input card. Can be changed whenever you want.
-simple_chain_hq:finalize(true)
-
--- A chain to show a single input on screen (LQ version).
-local simple_chain_lq = EffectChain.new(16, 9)
-local simple_chain_lq_input = simple_chain_lq:add_live_input()
-simple_chain_lq_input:connect_signal(0) -- First input card. Can be changed whenever you want.
-simple_chain_lq:finalize(false)
+-- Chains to fade between two inputs, in various configurations.
+local fade_chains = {}
+for input0_type, input0_live in pairs({static = false, live = true, livedeint = true}) do
+ local input0_deint = (input0_live == "livedeint")
+ fade_chains[input0_type] = {}
+ for input1_type, input1_live in pairs({static = false, live = true, livedeint = true}) do
+ local input1_deint = (input1_live == "livedeint")
+ fade_chains[input0_type][input1_type] = {}
+ for _, hq in pairs({true, false}) do
+ fade_chains[input0_type][input1_type][hq] =
+ make_fade_chain(input0_live, input0_deint, input1_live, input1_deint, hq)
+ end
+ end
+end
+
+-- A chain to show a single input on screen.
+function make_simple_chain(input_deint, hq)
+ local chain = EffectChain.new(16, 9)
+
+ local input = chain:add_live_input(false, input_deint)
+ input:connect_signal(0) -- First input card. Can be changed whenever you want.
+ local wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+ chain:finalize(hq)
+
+ return {
+ chain = chain,
+ input = input,
+ wb_effect = wb_effect
+ }
+end
+
+-- Make all possible combinations of single-input chains.
+local simple_chains = {}
+for input_type, input_deint in pairs({live = false, livedeint = true}) do
+ simple_chains[input_type] = {}
+ for _, hq in pairs({true, false}) do
+ simple_chains[input_type][hq] = make_simple_chain(input_deint, hq)
+ end
+end
+
+-- A chain to show a single static picture on screen (HQ version).
+local static_chain_hq = EffectChain.new(16, 9)
+local static_chain_hq_input = static_chain_hq:add_effect(ImageInput.new("bg.jpeg"))
+static_chain_hq:finalize(true)
+
+-- A chain to show a single static picture on screen (LQ version).
+local static_chain_lq = EffectChain.new(16, 9)
+local static_chain_lq_input = static_chain_lq:add_effect(ImageInput.new("bg.jpeg"))
+static_chain_lq:finalize(false)
+
+-- Used for indexing into the tables of chains.
+function get_input_type(signals, signal_num)
+ if signal_num == STATIC_SIGNAL_NUM then
+ return "static"
+ elseif signals:get_interlaced(signal_num) then
+ return "livedeint"
+ else
+ return "live"
+ end
+end