[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access "current duration" from music functions
From: |
David Kastrup |
Subject: |
Re: Access "current duration" from music functions |
Date: |
Fri, 26 Jun 2020 20:29:26 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Lukas-Fabian Moser <lfm@gmx.de> writes:
> Hi David,
>>> But it does not seem to be possible to _set_ this "current duration"
>>> from scheme, does it?
>> Why would that be a good idea?
>
> Consider a situation where \myFunction with signature (ly:duration?)
> generates some complex music expression in which the given duration is
> used.
>
> Currently, in
>
> (*) { a2 \myFunction 4 c }
>
> is equivalent to
>
> { a2 \myFunction 4 c2 }
>
> but in some situations it might be more natural for the user to expect
> (*) to yield
>
> { a2 \myFunction 4 c4 }.
>
>
> (More concretely, in our use case, \myFunction expected "a chord or a
> duration". This leads to a behaviour where
>
> a2 \myFunction 4
>
> does not change the "current duration", but
>
> a2 \myFunction <a c>4
>
> does.)
So let it expect a music expression only. 4 is a pitchless note event.
Interestingly,
zing =
#(define-void-function (x) (ly:music?)
#f)
\fixed c' { c1 \zing c4 c \zing 2 c c }
does not actually work. But that arguably is a bug that should get
fixed. If a duration is accepted as a note, it should affect the
default note duration.
--
David Kastrup