Hey,

I have a bit more time now. We did a liquidsoap demo at the end of the
afternoon. That went pretty well, we managed to hide the bugs from the
SVN version, and show cools examples with audio and video :)

On Thu, Nov 20, 2008 at 4:27 PM, Gil Brandão <[EMAIL PROTECTED]> wrote:
> So if I want to "push a source", I have to implement a protocol (that makes 
> sense :)

There is some sense to this. In fact, we thought of allowing protocols
to resolve into a sequence (conjunction) of files instead of just an
alternative. But it's nowhere near existing for now. I think there's a
simpler way for you.

> I like clever hacks :) By the way, about functional programming, I
> have worked with lisp,
> but liquidsoap it's even more hardcore ( "No assignation, only
> definitions. x = expr doesn't modify x, it just defines a new x" : no
> setq?)

Hehe :) Liquidsoap is a "purely" functional language, no side effect,
no assignment, yes. That's mostly because it does not need those for
our kind of application. In the beginning it did not have functions
(it was a language for describing (directed acylic) graphs) then we
added functions for handling transitions -- functions are of course
also very useful for structuring more our scripts, re-use widgets,
etc. The interactive strings are sort of setq-able variables, but can
only contain a string. They do not really belong to the language, but
are strapped awkwardly on top of it.

>  - I don't want to rely on file length. I'm "almost a control
> engineer" (doing my thesis), and  I'm aware of time integration
> problems, so I like enforcing  time resets when they make sense.
>
> - I will need 3* kinds of prime sources (plus live, but that one I'll
> handle later and looks pretty well documented); 2 of them are random
> playlists, which don't have any special length (and thus need to be
> stopped );  So when the time comes, I need to change between them (I
> will have an external scheduler).

Okay. Part of your needs involves switching from one playlist to the
other at a precise time. I'll describe a naive way of obtaining this
behavior. We shall use the switch operator. Usually it goes like:
switch(track_sensitive=false,[
 ({ 0h-12h }, listA),
 ({12h-0h  }, listB)
])

That's too static for you, no problem. The { .. } notation is nothing
special, it just means fun () -> ... it's a function that's evaluated
to know whether the source should be played or not. Inside the
function you don't need to use time interval checking 0h-12h. That
thing looks fancy but it's an expression like another. For example we
can write instead { "ok"==get_process_output("myscript") }. This means
that at every frame, liq will call your script to know whether it
should switch to a source or not.

This kind of thing works well, but is naive. A drawback is that it
calls your script very often. A better solution would be passive. For
example, use { ["ok"]==server.execute("var.get blah") } and change the
content of the variable as needed using the server interface.

It's not so bad, but a bit ugly. I think the example is well
motivated, and if I don't find a better way to solve it, it'll be a
good reason for adding real references (setq-able variables) inside
our script language.

I hope these examples help you design your script.

Cheers,
-- 
David

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to