lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get context in Scheme function (determining current moment)


From: David Kastrup
Subject: Re: Get context in Scheme function (determining current moment)
Date: Wed, 04 Dec 2013 16:39:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Urs Liska <address@hidden> writes:

> Hi,
>
> when I'm trying to determine the the position in a piece when inside a
> music function I think I have to use either
> ly:context-current-moment
> or
> ly:context-now

That's stupid: they do the same thing.  Why do we have the same function
twice?

> Both functions take a 'context' as argument, but I don't see where
> this should be taken from.
>
> so
> a)
> how do I get a current context from when inside a Scheme function?

That one's easy: there first _has_ to be a current context.  Contexts
are only created when a music expression is getting iterated.  So you
need to have your Scheme function called during iteration.  The easiest
way to do this is to use \applyMusic.

It will be called for every iteration of a score, so if you are doing
midi, you'll get it called there as well.

> and
> b)
> how would I proceed to determine the position in a score when the
> Scheme function is called?

Seems like it would do that.

Again: what are you trying to do?

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]