Here is yet another approach... It is an API which has the concept of
"opening" a song, getting 1 or more measures from it, and then "closing"
the song. I think in terms of C and C++ so please forgive the syntactical
stricnine.


ABCSong * pSong;
ABCMeasure * pMeasure;

pSong = new ABCSong( ... ); // allocates ABC song object for header info, voices, et.c

pSong->Open( <file> , <song_title>, ... ); // open file, read song contents and info.
pSong->Verify(); // parse song to see if its valid


// song is good, process it...
while(  pSong->MoreNotes() )
{
   ...
   ...
   pMeasure = pSong->GetMeasure(...);
   pMeasure.Play();
   pMeasure.Print( <window settings>, ... );
  ,,,
  ,,,
}

pSong->Close();

...
...

This assumes defined objects ABCSong and ABCMeasure which I've invented surreptitiously.
I'm thinking along these lines because I want an ABC parser that I can process a measure
at a time. So this would be my initial stab at these needs; I don't know if this is ultimately
what I need.


Anyway, this simple model could be used for just playing, just printing/displaying, or both.

However, the idea of the ABCMeasure as an arbitrary aggregation of notes could further be
aggregated into a Line for printing and other notation adjustment.


In this manner, the interface is simple and direct. Versioning info can be embedded in the
objects themselves without the need for that nasty ...Ex() convention. Instead, there may
be some reflective API's like GetVersion() or GetCapability() on the parser/player that
would permit many more variants over a longer lifecycle.



-- The penalty that good men pay for not being interested in politics is to be governed by men worse than themselves. -- Plato, philosopher (427-347 BCE)

To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to