use of com.xenoage.zong.core.music.key.Key in project Zong by Xenoage.
the class AttributesReader method readToContext.
/**
* Reads the given attributes element.
*/
public void readToContext(Context context) {
// divisions
Integer divisions = mxlAttributes.getDivisions();
if (divisions != null)
context.setDivisions(divisions);
// key signature
Key key = readKey(mxlAttributes.getKey());
if (key != null)
context.writeColumnElement(key);
// time signature
TimeSignature time = readTime(mxlAttributes.getTime());
if (// TODO: attribute "number" for single staves
time != null)
context.writeColumnElement(time);
// clefs
if (mxlAttributes.getClefs() != null) {
for (MxlClef mxlClef : mxlAttributes.getClefs()) {
ClefReader clefReader = new ClefReader(mxlClef);
Clef clef = clefReader.read();
int staff = clefReader.readStaff();
if (clef != null)
context.writeMeasureElement(clef, staff);
}
}
// transposition changes - TODO: clean solution for instrument changes
PitchedInstrument instrument = readTransposedInstrument(mxlAttributes.getTranspose());
if (instrument != null) {
// write to all staves of this part
for (int staff = 0; staff < context.getPartStaffIndices().getCount(); staff++) context.writeMeasureElement(new InstrumentChange(instrument), staff);
}
}
Aggregations