Search in sources :

Example 6 with MxlPlacement

use of com.xenoage.zong.musicxml.types.enums.MxlPlacement in project Zong by Xenoage.

the class MxlDirection method read.

/**
 * Returns null, when no supported content was found.
 */
@MaybeNull
public static MxlDirection read(XmlReader reader) {
    // attributes
    MxlPlacement placement = MxlPlacement.read(reader);
    // elements
    List<MxlDirectionType> directionTypes = alist();
    Integer staff = null;
    MxlSound sound = null;
    while (reader.openNextChildElement()) {
        String n = reader.getElementName();
        switch(n) {
            case MxlDirectionType.elemName:
                MxlDirectionType directionType = MxlDirectionType.read(reader);
                if (directionType != null)
                    directionTypes.add(directionType);
                break;
            case "staff":
                staff = reader.getTextInt();
                break;
            case MxlSound.elemName:
                sound = MxlSound.read(reader);
                break;
        }
        reader.closeElement();
    }
    if (directionTypes.size() > 0) {
        return new MxlDirection(directionTypes, staff, sound, placement);
    } else {
        return null;
    }
}
Also used : MxlPlacement(com.xenoage.zong.musicxml.types.enums.MxlPlacement) MaybeNull(com.xenoage.utils.annotations.MaybeNull)

Example 7 with MxlPlacement

use of com.xenoage.zong.musicxml.types.enums.MxlPlacement in project Zong by Xenoage.

the class ArticulationReader method readArticulation.

private static Articulation readArticulation(MxlArticulationsContent mxlAC) {
    MxlArticulationsContentType mxlACType = mxlAC.getArticulationsContentType();
    ArticulationType type = Equivalents.articulations.getBy2(mxlACType);
    if (type == null)
        return null;
    Articulation articulation = new Articulation(type);
    // read placement
    MxlPlacement mxlPlacement = mxlAC.getEmptyPlacement().getPlacement();
    articulation.setPlacement(PositioningReader.readPlacement(mxlPlacement));
    return articulation;
}
Also used : MxlArticulationsContentType(com.xenoage.zong.musicxml.types.choice.MxlArticulationsContent.MxlArticulationsContentType) Articulation(com.xenoage.zong.core.music.annotation.Articulation) MxlPlacement(com.xenoage.zong.musicxml.types.enums.MxlPlacement) ArticulationType(com.xenoage.zong.core.music.annotation.ArticulationType)

Aggregations

MxlPlacement (com.xenoage.zong.musicxml.types.enums.MxlPlacement)7 MaybeNull (com.xenoage.utils.annotations.MaybeNull)3 MxlPrintStyle (com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle)2 NonNull (com.xenoage.utils.annotations.NonNull)1 Articulation (com.xenoage.zong.core.music.annotation.Articulation)1 ArticulationType (com.xenoage.zong.core.music.annotation.ArticulationType)1 DynamicValue (com.xenoage.zong.core.music.direction.DynamicValue)1 MxlPosition (com.xenoage.zong.musicxml.types.attributes.MxlPosition)1 MxlArticulationsContentType (com.xenoage.zong.musicxml.types.choice.MxlArticulationsContent.MxlArticulationsContentType)1 MxlAccidentalText (com.xenoage.zong.musicxml.types.enums.MxlAccidentalText)1 MxlStartStopContinue (com.xenoage.zong.musicxml.types.enums.MxlStartStopContinue)1