Skip to content
ahankinson edited this page Sep 11, 2011 · 5 revisions

I think a good philosophy to go with when deciding what methods to implement is whether or not it requires the assembly of information from many different parts of the structure. For example, note->raisePitch(3) would only operate on a single Note object, but tie->getMembers() would have to scan through the tree, and only return member notes/chords in the same voice (layer) across multiple measures.

So, here are a few methods that I can think of that we might want to implement.

Beam:

getMembers()
returns a vector MeiElement*

Tie:

getMembers()
returns a vector MeiElement*

Slur:

getMembers()
returns a vector MeiElement*

Chord:

getMembers()
returns a vector MeiElement*

Staff:

getStaffDef()
returns the staffDef element for a given <staff>, or NULL if no staffDef exists.

Layer:

getLayerDef()
returns the layerDef element for a given <layer>, or NULL if no layerDef exists.

Score:

getLayer(string sval, string lval)
Returns a vector MeiElement* that collapses all the members of layer n=nval e.g., score->getLayer(1) = [measure, note, rest, note, note, measure, rest, rest, note, note, measure, beam, chord, measure] This method would look for all <staff n=sval> elements and all the <layer=lval> members of that. Potential problems: What to do if a layer/voice disappears and then reappears?

SourceDesc:

getSources()```
Returns a vector MeiElement* of the child <source> elements. From there we can get the source xml:id, which annotates the sources.

MeiDocument:

iron(string pathway)
"Flattens" an MEI file with a given choice in any place where there is a possibility of two or more pathways. For example, document->iron("xyz123") would return an MeiDocument where the app/rdg elements have been collapsed to only select the source material from a source definition with the xml:id="xyz123".

MeiElement:

findMostRecent(string tagname)
Since a lot of operations in MEI depend on an element setting a context (e.g., a scoreDef changing certain score parameters) we may need a method that looks backwards from the current object to find the most recent occurrence of something. This may be useful to wrap some helper methods around in the musical realm (e.g., "Find me the most recent clef change")