Re: [frogs] chord_name_engraver - help with c++ ... |
[ Thread Index |
Date Index
| More lilynet.net/frogs Archives
]
On 05/07/11 00:25, Wols Lists wrote:
> This frog is back ... I said I'd wait until 2.14 which has finally
> arrived :-) But I've revamped my code a bit and am having problems...
>
> SCM capopitch = get_property ( "capoPitch" );
> bool capo = false;
> Pitch *c_p = unsmob_pitch (capopitch);
> if ( c_p != NULL )
> {
> if ( &c_p::get_notename != 0 || &c_p::get_alteration != NATURAL )
> {
> capo = true;
> }
> }
>
> I assume the simplest test to tell if capoPitch has been set is to
> unsmob it? Presumably if the property hasn't been set, the pointer will
> be returned as NULL?
>
> Then, a pure c++ problem, when I'm testing for notename and alteration,
> I'm getting compile errors:
>
> chord-name-engraver.cc: In member function ‘void
> Chord_name_engraver::process_music()’:
> chord-name-engraver.cc:108: error: ‘c_p’ is not a class or namespace
> chord-name-engraver.cc:108: error: ‘c_p’ is not a class or namespace
>
> Given that Pitch is declared as a class in pitch.hh, and when I tried
> "c_p->get_notename" it blew up with a different error, this implies my
> c++-fu is wanting :-( Can you help me with the correct syntax?
>
Ummm... forget that - I've managed to get it working. But my test is
still blowing up, this time because get_alteration is a rational, and I
can't get it to work. But I think I know where I'm going from here ...
I've found pitch.cc and I think I can change tack and test for "diff == 0".
But I'm sure there'll be a few more emails soon :-)
Cheers,
Wol
---
----
Join the Frogs!