When I implemented Expandfigurationcommand, I didn't know about Chord and
GenericChord.  "Sets.h" doesn't jump out as containing chord classes, I
just stumbled on it recently.  I didn't intend to duplicate existing
stuff, and I wanted to capture chords better anyways, so I rewrote
Expandfigurationcommand to use GenericChord.

In doing so, I stumbled across a subtle issue with the AbstractSet
hierarchy: AbstractSet tries to call virtual functions in its ctor, via
initialise.  That doesn't do what you want in derived classes.  That's not
a compiler bug, it's a deliberate choice C++ made.  A base ctor always
calls its static versions of virtual functions, not (as one might think)
derived versions.

So I changed how AbstractSet and its descendants call "initialise".  Now
Chord and GlobalChord are derived classes, not template instantiations,
and initialise is called in their ctors, also in my new derived class's
and in NotationChord's.  "grep" tells me that that's everything, and
everything compiles.  I left everything else as it was.

I'm aware that my approach merely puts the problem one step further off:
deriving from GenericChord now behaves as expected but deriving from Chord
etc still doesn't.  But the other recommended solutions for C++ are fairly
complex, involving helper classes and smart pointers and such.  It seemed
to me that I'd have risked making more serious problems.  And this
approach covers everything we're actually doing right now.  So I added
some explanatory comments for future developers and left it at that.

New virtual function initialiseFinish is called by initialise.  Its
rationale is fairly subtle: the code couldn't just be run in ctors,
because we can't guarantee that initialise has already run.

New class ChordFromCounterpoint, which is like Chord but also collects
notes that started earlier and are still sounding.

Improved functionality in ExpandFigurationCommand:
 * Can handle chords of other than 3 notes.

 * Can handle chords formed via separate moving voices, no longer just
   block chords.

        Tom Breton (Tehom)



------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to