lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing Grob properties


From: Urs Liska
Subject: Re: Accessing Grob properties
Date: Fri, 22 Jan 2016 20:29:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0


Am 22.01.2016 um 18:49 schrieb David Kastrup:
> Urs Liska <address@hidden> writes:
>
>> ...
>> I am now trying to implement configuration through
>>
>>     \override Beam.subdivide-details.beam-count = #'metric
>>     \override Beam.subdivide-details.ignore-shortening = ##f
>> etc.
>>
>> but I don't see the proper way of doing so (in C++).
>>
>> I am able to retrieve the property value somewhere in the Beam class
>> (beam.cc), but I don't seem to manage to get that information into
>> Beaming_options or Beaming_pattern.
>> Is it possible that the Beam object is only created when the
>> Beaming_pattern has already been completed?
> Maybe, but the beaming options are fetched at start time via
>
> lily/auto-beam-engraver.cc:244:  beam_settings_ = Grob_property_info (context 
> (), ly_symbol2scm ("Beam")).updated ();

Thank you. From here I could inject a new field in Beaming_options and
make Beaming_pattern::beamify use it.
This was the hook I was looking for.

But ...

>
>> Apart from that question I'd ask more generally:
>> How could I manage to get hold of the values in a Beam.subdivide-details
>> alist from within Beaming_pattern::beamify?
> Using calls of scm_assq_ref or so?

It seems I'm now at a similar point in C++ Guile (scm_whatsoever) as I
was with Guile Scheme at an earlier stage :-(

  SCM subdivide_details =
        scm_assq_ref (beam_settings_, ly_symbol2scm ("subdivide-details"));

seems to fetch the right thing, namely something like
    '((beam-count . metric))

But then I start to get lost.
I would expect

  SCM beam_count_prop =
        scm_assq_ref (subdivide_details, ly_symbol2scm ("beam-count"));

to assign beam_count_prop a symbol "metric" - as I get when I do the
same thing in Scheme.

However, from there I don't get any further, and it seems I totally
don't understand how the Scheme types are matched in C++.
Any attempt to compare the content of beam_count_prop with a set of
predefined values seems to fail, and even

    if (scm_equal_p (ly_symbol2scm ("one"), ly_symbol2scm ("two")))

returns true (using scm_equal_p equally as for the eq and eqv versions.

I would have expected that

  beaming_options_.subdivided_beam_count_ =
    (scm_eqv_p (ly_symbol2scm("one"), ly_symbol2scm("one")))
            ? ONE
            : (scm_eqv_p (subdiv_beam_count_prop,
ly_symbol2scm("base-moment")))
                ? BASE_MOMENT
                : METRIC;

would assing the (new) member subdivided_beam_count one out of the three
constants, depending on the value of the property:

\override Beam.subdivide-details.beam-count = #'base-moment
=> BASE_MOMENT
etc.

But it always uses ONE
(which is consistent with the above observation).

In short:
What I want to achieve is
- read the property subdivide-details.beam-count from the available
beam_settings_
- assign the appropriate value from an enum (ONE/BASE_MOMENT/METRIC) to
the beaming_options field.

Any further assistance possible?

Thanks
Urs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]