use of com.xenoage.zong.musicxml.types.choice.MxlNotationsContent in project Zong by Xenoage.
the class MxlNotations method write.
public void write(XmlWriter writer) {
writer.writeElementStart(elemName);
for (MxlNotationsContent element : elements) element.write(writer);
writer.writeElementEnd();
}
use of com.xenoage.zong.musicxml.types.choice.MxlNotationsContent in project Zong by Xenoage.
the class MxlNotations method read.
public static MxlNotations read(XmlReader reader) {
List<MxlNotationsContent> elements = alist();
while (reader.openNextChildElement()) {
String childName = reader.getElementName();
MxlNotationsContent element = null;
if (childName.equals(MxlAccidentalMark.elemName)) {
element = MxlAccidentalMark.read(reader);
}
switch(childName) {
case MxlArticulations.elemName:
element = MxlArticulations.read(reader);
break;
case MxlDynamics.elemName:
element = MxlDynamics.read(reader);
break;
case MxlFermata.elemName:
element = MxlFermata.read(reader);
break;
case MxlOrnaments.elemName:
element = MxlOrnaments.read(reader);
break;
case MxlSlurOrTied.elemNameSlur:
case MxlSlurOrTied.elemNameTied:
element = MxlSlurOrTied.read(reader);
break;
}
reader.closeElement();
if (element != null)
elements.add(element);
}
return new MxlNotations(elements);
}
use of com.xenoage.zong.musicxml.types.choice.MxlNotationsContent in project Zong by Xenoage.
the class NotationsReader method readToNote.
public void readToNote(Chord chord, int noteIndex, int staffIndexInPart, Context context) {
StaffDetails staffDetails = StaffDetails.fromContext(context, staffIndexInPart);
ArrayList<Annotation> annotations = alist(0);
for (MxlNotations mxlNotationsElement : mxlNotations) {
for (MxlNotationsContent mxlNC : mxlNotationsElement.getElements()) {
MxlNotationsContentType mxlNCType = mxlNC.getNotationsContentType();
switch(mxlNCType) {
case SlurOrTied:
{
SlurReader.readToContext(chord, noteIndex, staffIndexInPart, context, (MxlSlurOrTied) mxlNC);
break;
}
case Dynamics:
{
Dynamic dynamics = DynamicsReader.read((MxlDynamics) mxlNC, staffDetails);
new DirectionAdd(dynamics, chord).execute();
break;
}
case Articulations:
{
MxlArticulations mxlArticulations = (MxlArticulations) mxlNC;
annotations.addAll(ArticulationReader.read(mxlArticulations));
break;
}
case Fermata:
{
Fermata fermata = FermataReader.read((MxlFermata) mxlNC, staffDetails);
annotations.add(fermata);
break;
}
case Ornaments:
{
MxlOrnaments mxlOrnaments = (MxlOrnaments) mxlNC;
annotations.addAll(OrnamentReader.read(mxlOrnaments));
break;
}
default:
}
}
}
if (annotations.size() > 0)
chord.setAnnotations(annotations);
}
Aggregations