diff --git a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq index 82ef411b1..3d070152c 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq @@ -32,6 +32,24 @@ def transition(a,b) = fade.final(duration=!default_dj_fade, a) ]) end +# we need this function for special transition case(from default to queue) +# we don't want the trasition fade to have effect on the first song that would +# be played siwtching out of the default(silent) source +def transition_default(a,b) = + log("transition called...") + if !just_switched then + just_switched := false + add(normalize=false, + [ sequence([ blank(duration=0.01), + fade.initial(duration=!default_dj_fade, b) ]), + fade.final(duration=!default_dj_fade, a) ]) + else + just_switched := false + b + end +end + + # Define a transition that fades out the # old source, adds a single, and then # plays the new source diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index 54649b8b1..7391be42c 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -24,6 +24,7 @@ s3_connected = ref '' s1_namespace = ref '' s2_namespace = ref '' s3_namespace = ref '' +just_switched = ref false %include "ls_lib.liq" @@ -47,9 +48,9 @@ default = amplify(id="silence_src", 0.00001, noise()) default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default) ignore(output.dummy(default, fallible=true)) -master_dj_enabled = ref false; -live_dj_enabled = ref false; -scheduled_play_enabled = ref false; +master_dj_enabled = ref false +live_dj_enabled = ref false +scheduled_play_enabled = ref false def make_master_dj_available() master_dj_enabled := true @@ -69,6 +70,7 @@ end def make_scheduled_play_available() scheduled_play_enabled := true + just_switched := true end def make_scheduled_play_unavailable() @@ -150,7 +152,7 @@ def append_dj_inputs(master_harbor_input_port, master_harbor_input_mount_point, end end -s = switch(id="default_switch", track_sensitive=false, transitions=[transition, transition], [({!scheduled_play_enabled},queue),({true},default)]) +s = switch(id="default_switch", track_sensitive=false, transitions=[transition_default, transition], [({!scheduled_play_enabled},queue),({true},default)]) s = append_dj_inputs(master_live_stream_port, master_live_stream_mp, dj_live_stream_port, dj_live_stream_mp, s) # Attach a skip command to the source s: