[frogs] Music expressions and iterators (was: bend implementation)

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


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!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/