Re: [frogs] chord-name-engraver plus capo - schemeing away ...

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


On 27 August 2010 16:59, Wols Lists <antlists@xxxxxxxxxxxxxxx> wrote:
>  Okay. I (think I) know how to call scheme from C++. And I've been told
> it's a lot easier to manipulate markup in scheme than C++. So I need to
> write two functions in scheme, and call them from my engraver. Help! :-)

I'm still not convinced you need a separate formatter.

What's the difference between the main chord markup and the capo
markup apart from being transposed?

Does the capo markup use the same pitches as the main chord?

If the only difference is that the capo is generated based on capoFret
(i.e., all other elements are the same), then there's no reason why
you can't read capoFret from the chord formatter and do all the
formatting internally, completely bypassing the engraver.

The other option is to create a separate grob for the capo, then it's
easy to position it relative to the existing ChordName.

> (define (parenthesize-markup markup)
>  (make-line-markup (list (make-simple-markup "(") markup
> (make-simple-markup ")"))
>
> ??? I can't believe it's that easy! there must be more to it than that!

Easier: use the \parenthesize markup command (which creates proper
curves rather than using glyphs from the font).

> Secondly, where do I put this function if I have got it right.

If it's something similar to the existing formatter, then you'd put it
in scm/translation-functions.scm.

> Thirdly, how do I create "" or " " as my separator and do I need it ...

\line automatically spaces the markups word-space apart, so you
shouldn't need to introduce any extra separators.

> Fourthly, given that I know the name of the function, is that all I need
> to pass from C++, or do I need to get a pointer to the function from
> somewhere?

If it's defined in one of the .scm files, you use
ly_lily_module_constant () to get the proc, then call it using one of
the scm_call_... functions (depending on the number of arguments).

Cheers,
Neil

---
----
Join the Frogs!


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