Re: [frogs] chord-name-engraver plus capo - schemeing away ... |
[ Thread Index |
Date Index
| More lilynet.net/frogs Archives
]
On 27/08/10 17:18, Neil Puttock wrote:
> 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?
It isn't "just transposed". The final output is both the original chord
and the transposed chord.
> Does the capo markup use the same pitches as the main chord?
Yes.
> 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.
But it's the engraver calling the formatter, isn't it? I've just twigged
what you're saying - no I CAN'T do that, because the formatter has to be
called twice, once using capoFret, and once not. How do I tell it
whether or not to use it?
> The other option is to create a separate grob for the capo, then it's
> easy to position it relative to the existing ChordName.
>
What happens if the user moves the ChordName? And how do I link one grob
to another so they move as one?
>> (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).
>
I'll play with that - I'll probably be back. I was looking for that.
>> 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).
>
Thanks. So get the parenthesis function, get the make-line-markup
function, and off we go. There might be a few more calls for help, though.
> Cheers,
> Neil
Cheers,
Anthony
---
----
Join the Frogs!