Converting string-number-event into an integer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting string-number-event into an integer

Marc Hohl
Hello all,

after reading through quite a lot of files in lily/,
I have still no idea how to obtain the digit from a
string-number-event for further use as an integer.

For example, if I have
c4\4
I want the "4" to be an integer variable in C++.

My code is similar to the routine in tab-note-heads-engraver.cc,
and I want to get the content of the vector string_events
(which is stored in line 116) converted to integers.

TIA

Marc




---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|

Re: Converting string-number-event into an integer

Carl Sorensen



On 3/5/10 2:00 AM, "Marc Hohl" <[hidden email]> wrote:

> Hello all,
>
> after reading through quite a lot of files in lily/,
> I have still no idea how to obtain the digit from a
> string-number-event for further use as an integer.
>
> For example, if I have
> c4\4
> I want the "4" to be an integer variable in C++.
>
> My code is similar to the routine in tab-note-heads-engraver.cc,
> and I want to get the content of the vector string_events
> (which is stored in line 116) converted to integers.

I can't try this out right now, because my LilyPond is broken, thanks to
some MacPorts intrigue with dynamic link libraries :(, but it should work to
do something very similar to

string_events[i]->get_property("string-number")

If you look in the Internals Reference under 1.3 Music properties, you'll
see that string-number is the number of the string in a StringNumberEvent.

HTH,

Carl


---
----
Join the Frogs!