-local main_chain = EffectChain.new(16, 9);
-local input0 = main_chain:add_live_input();
-input0:connect_signal(0);
-local input1 = main_chain:add_live_input();
-input1:connect_signal(1);
-local resample_effect = main_chain:add_effect(ResampleEffect.new(), input0);
-local padding_effect = main_chain:add_effect(IntegralPaddingEffect.new());
-padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0);
-
-local resample2_effect = main_chain:add_effect(ResampleEffect.new(), input1);
--- Effect *saturation_effect = main_chain->add_effect(new SaturationEffect());
--- CHECK(saturation_effect->set_float("saturation", 0.3f));
-local wb_effect = main_chain:add_effect(WhiteBalanceEffect.new());
-wb_effect:set_float("output_color_temperature", 3500.0);
-local padding2_effect = main_chain:add_effect(IntegralPaddingEffect.new());
-
-main_chain:add_effect(OverlayEffect.new(), padding_effect, padding2_effect);
-main_chain:finalize(true);
-
--- A chain to show a single input on screen.
-local simple_chain = EffectChain.new(16, 9);
-local simple_chain_input = simple_chain:add_live_input();
-simple_chain_input:connect_signal(0); -- First input card. Can be changed whenever you want.
-simple_chain:finalize(false);
+function make_sbs_chain(hq)
+ local chain = EffectChain.new(16, 9)
+ local input0 = chain:add_live_input(true)
+ input0:connect_signal(0)
+ local input0_wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+ local input1 = chain:add_live_input(true)
+ input1:connect_signal(1)
+ local input1_wb_effect = chain:add_effect(WhiteBalanceEffect.new())
+
+ local resample_effect = nil
+ local resize_effect = nil
+ if (hq) then
+ resample_effect = chain:add_effect(ResampleEffect.new(), input0_wb_effect)
+ else
+ resize_effect = chain:add_effect(ResizeEffect.new(), input0_wb_effect)
+ end
+
+ local padding_effect = chain:add_effect(IntegralPaddingEffect.new())
+ padding_effect:set_vec4("border_color", 0.0, 0.0, 0.0, 1.0)
+
+ local resample2_effect = nil
+ local resize2_effect = nil
+ if (hq) then
+ resample2_effect = chain:add_effect(ResampleEffect.new(), input1_wb_effect)
+ else
+ resize2_effect = chain:add_effect(ResizeEffect.new(), input1_wb_effect)
+ end
+ local padding2_effect = chain:add_effect(IntegralPaddingEffect.new())
+
+ chain:add_effect(OverlayEffect.new(), padding_effect, padding2_effect)
+ chain:finalize(hq)
+
+ return {
+ chain = chain,
+ input0 = {
+ input = input0,
+ white_balance_effect = input0_wb_effect,
+ resample_effect = resample_effect,
+ resize_effect = resize_effect,
+ padding_effect = padding_effect
+ },
+ input1 = {
+ input = input1,
+ white_balance_effect = input1_wb_effect,
+ resample_effect = resample2_effect,
+ resize_effect = resize2_effect,
+ padding_effect = padding2_effect
+ }
+ }
+end
+
+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_vtv_chain_hq = EffectChain.new(16, 9)
+local fade_vtv_chain_hq_input0 = fade_vtv_chain_hq:add_live_input(true)
+local fade_vtv_chain_hq_wb0_effect = fade_vtv_chain_hq:add_effect(WhiteBalanceEffect.new())
+local fade_vtv_chain_hq_input1 = fade_vtv_chain_hq:add_live_input(true)
+local fade_vtv_chain_hq_wb1_effect = fade_vtv_chain_hq:add_effect(WhiteBalanceEffect.new())
+fade_vtv_chain_hq_input0:connect_signal(0)
+fade_vtv_chain_hq_input1:connect_signal(1)
+local fade_vtv_chain_mix_effect = fade_vtv_chain_hq:add_effect(MixEffect.new(), fade_vtv_chain_hq_wb0_effect, fade_vtv_chain_hq_wb1_effect)
+fade_vtv_chain_hq:finalize(true)
+
+-- A chain to fade between an inputs and a picture (live chain only)
+local fade_vtp_chain_hq = EffectChain.new(16, 9)
+local fade_vtp_chain_hq_input0 = fade_vtp_chain_hq:add_live_input(true)
+local fade_vtp_chain_hq_wb0_effect = fade_vtp_chain_hq:add_effect(WhiteBalanceEffect.new())
+local fade_vtp_chain_hq_input1 = fade_vtp_chain_hq:add_effect(ImageInput.new("bg.jpeg"))
+fade_vtp_chain_hq_input0:connect_signal(0)
+local fade_vtp_chain_mix_effect = fade_vtp_chain_hq:add_effect(MixEffect.new(), fade_vtp_chain_hq_wb0_effect, fade_vtp_chain_hq_input1)
+fade_vtp_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(true)
+simple_chain_hq_input:connect_signal(0) -- First input card. Can be changed whenever you want.
+local simple_chain_hq_wb_effect = simple_chain_hq:add_effect(WhiteBalanceEffect.new())
+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(true)
+simple_chain_lq_input:connect_signal(0) -- First input card. Can be changed whenever you want.
+local simple_chain_lq_wb_effect = simple_chain_lq:add_effect(WhiteBalanceEffect.new())
+simple_chain_lq:finalize(false)
+
+-- 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)