On 2/10/10 6:42 PM, "Eric Knapp" <ekn...@gmail.com> wrote:

> 
> With this in mind, my string marker function needs to have all the
> pitches and strings for a chord to determine where to draw the
> markers. I'm envisioning a function that receives two lists and can
> work out all the combinations. What I can't figure out is how to
> capture the chord and all its data together. I'm getting all the
> individual events, but that's not enough.
> 
> Am I making sense and what do you suggest?
> 

You're making great sense.  This is *really* easy, once you understand how
LilyPond engravers work.

As an example, look at lily/fretboard-engraver.cc.

The engraver contains two vectors: note_events_ and tabstring_events_.

The listeners for notes and string-events do a push_back on  note_events_
and tabstring_events_, respectively.  That's all they do.

The process_music function, which is called after all the events are
listened to, then works with note_events_ and tabstring_events_.  All of the
information on the notes and strings are there.

You can also see this same structure (but with a touch more complexity) in
lily/tab-note-heads-engraver.cc.

So your staff-tab-string-marker-engraver (or whatever it's called) will
listen to both note-events and string-number-events, and create these
vectors.  Then, based on the contents of the vectors, it can create the
appropriate stringMarker grobs, with the correct X-offset to put the string
markers in the right position.

Let me know if you have more questions on this.

Thanks,

Carl



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to