[frogs] Music expressions and iterators (was: bend implementation) |
[ Thread Index |
Date Index
| More lilynet.net/frogs Archives
]
- To: "frogs@xxxxxxxxxxx" <frogs@xxxxxxxxxxx>
- Subject: [frogs] Music expressions and iterators (was: bend implementation)
- From: Marc Hohl <marc@xxxxxxxxxx>
- Date: Sat, 06 Feb 2010 09:17:31 +0100
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1265444253; l=1871; s=domk; d=hohlart.de; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Subject:To:MIME-Version:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=bWlfQaJjJbRwSOYniVy3L3o2J5U=; b=HZRlVJNOBZh6SGHcFFcl/ieu/H4Kzh3xMNJnxO+7ZQ6tyiaedW0T0dYg5SXHs0WH5rR IjKXLnTwKBS5Ha/tiXaeL8NIRGdL1tWzBn0r7Ttahl8YEDtKrBs/LV4WP8rns4tbKD45g 2Q9zWwveoY0xlo/Ha/h1/0lJCMFDcWxUbdQ=
Carl Sorensen schrieb:
[...]
I'm not positive this is the right way, but I think it's getting closer. And
I think that defining a BendMusic or BentMusic music expression is the best
way I've thought of yet to get bends in the music tree.
I have looked at scm/define-music-types.scm where all music expressions
are defined.
As I see it now, a StringBendMusic music expression should be much like the
SequentialMusic music expression which an additional 'referencePitch
that holds
the reference pitch which the engraver uses to get the information of
how the current
note is bent relative to this value.
Looking at the definition for SequentialMusic, I find
(SequentialMusic
. ((description . "Music expressions concatenated.
Syntax: @code{\\sequential @{ @dots{} @}} or simply @code{@{ @dots{} @}}")
(length-callback . ,ly:music-sequence::cumulative-length-callback)
(start-callback . ,ly:music-sequence::first-start-callback)
(elements-callback . ,(lambda (m) (ly:music-property m 'elements)))
(iterator-ctor . ,ly:sequential-iterator::constructor)
(types . (general-music sequential-music))
))
I think the start-callback is executed each time lilypond enters the
music expression.
I am not sure what the length-callback does - does he calculate the
length of whole expression?
The elements-callback seems to filter the 'elements in the
SequentialMusic tree via the
lambda construct and acts upon its values.
The iterator-ctor is some kind of constuctor which iterates over the
music tree. I looked
at lily/sequential-iterator.cc but didn't understand a lot.
Do I have to understand all this in order to go on with bends, or is it
sufficient to copy most
of the structures?
Moreover, how can I let the engraver do its work on the structure? Via
the elements-callback?
Thanks in advance
Marc
---
----
Join the Frogs!