Hi Martin,
2011/6/20 Martin Konečný <[email protected]>:
> My understanding of Liquidsoap is that when it starts, it generates a tree
> of sources and sinks as in this figure:
> http://savonet.sourceforge.net/images/basic-radio-graph.png
> Your code seems to imply I have to change my tree dynamically during
> runtime?
Both statements are correct. The tree (rather, acyclic graph)
construction is mostly at startup time, but there are a few
exceptions. The most common one is with the use of transitions, which
are available with switch and cross operators. I was suggesting to use
cross, which allows you to customize the change from one track to the
next using a transition.
Here is some code doing what I proposed:
s = playlist("~/media/audio")
skipped = ref false
fade_duration = 3.
def skip(_)
skipped := true
source.skip(s)
"OK"
end
server.register("skip",skip)
def transition(before,after)
if !skipped then
log("Fading out before skip...")
skipped := false
sequence([fade.final(type="sin",duration=fade_duration,before),after])
else
skipped := false
sequence([before,after])
end
end
out(cross(conservative=true,duration=fade_duration,transition,s))
Note that I used a sinusoidal fade rather than a linear one. It sounds
better, we should probably not have linear as the default.
One thing that I didn't understand is why I had to use fade.final (do
the fade immediately, then cut the track) and fade.out didn't work (it
didn't fade, as if it didn't detect the coming end of track... perhaps
a bug in remaining time estimation in the buffer for the end of
track).
You'll notice that the transition is a sequence in both cases, which
is why cross() is a bit of an overkill. There might be other ways,
perhaps using fade.out with a duration updated through metadata... But
if you have some crossfading already (I believe you do) you should be
able to combine all this in a single cross, which would be as
efficient as it should.
And thanks bringing this up, it's a cool application.
Cheers,
--
David
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users