Search in sources :

Example 1 with MxlRepeat

use of com.xenoage.zong.musicxml.types.attributes.MxlRepeat in project Zong by Xenoage.

the class BarlineReader method read.

private void read() {
    MxlRightLeftMiddle location = mxlBarline.getLocation();
    MxlRepeat repeat = mxlBarline.getRepeat();
    BarlineStyle style = null;
    if (mxlBarline.getBarStyle() != null)
        style = Equivalents.barlineStyles.getBy2(mxlBarline.getBarStyle().getBarStyle());
    if (repeat != null) {
        // repeat barline
        if (repeat.getDirection() == MxlBackwardForward.Forward) {
            style = notNull(style, BarlineStyle.HeavyLight);
            barline = Companion.barlineForwardRepeat(style);
        } else if (repeat.getDirection() == MxlBackwardForward.Backward) {
            style = notNull(style, BarlineStyle.LightHeavy);
            int times = notNull(repeat.getTimes(), 1);
            barline = Companion.barlineBackwardRepeat(style, times);
        }
    } else if (style != null) {
        // regular barline
        barline = Companion.barline(style);
    }
    if (barline != null) {
        // side / beat
        if (location == MxlRightLeftMiddle.Left)
            side = Left;
        else if (location == MxlRightLeftMiddle.Right)
            side = Right;
    }
}
Also used : MxlRightLeftMiddle(com.xenoage.zong.musicxml.types.enums.MxlRightLeftMiddle) MxlRepeat(com.xenoage.zong.musicxml.types.attributes.MxlRepeat) BarlineStyle(com.xenoage.zong.core.music.barline.BarlineStyle)

Example 2 with MxlRepeat

use of com.xenoage.zong.musicxml.types.attributes.MxlRepeat in project Zong by Xenoage.

the class MxlBarline method read.

public static MxlBarline read(XmlReader reader) {
    // attributes
    MxlRightLeftMiddle location = MxlRightLeftMiddle.readOr(reader, defaultLocation);
    // elements
    MxlBarStyleColor barStyle = null;
    MxlEnding ending = null;
    MxlRepeat repeat = null;
    while (reader.openNextChildElement()) {
        String n = reader.getElementName();
        switch(n) {
            case MxlBarStyleColor.elemName:
                barStyle = MxlBarStyleColor.read(reader);
                break;
            case MxlEnding.elemName:
                ending = MxlEnding.read(reader);
                break;
            case MxlRepeat.elemName:
                repeat = MxlRepeat.read(reader);
                break;
        }
        reader.closeElement();
    }
    return new MxlBarline(barStyle, ending, repeat, location);
}
Also used : MxlRightLeftMiddle(com.xenoage.zong.musicxml.types.enums.MxlRightLeftMiddle) MxlRepeat(com.xenoage.zong.musicxml.types.attributes.MxlRepeat)

Aggregations

MxlRepeat (com.xenoage.zong.musicxml.types.attributes.MxlRepeat)2 MxlRightLeftMiddle (com.xenoage.zong.musicxml.types.enums.MxlRightLeftMiddle)2 BarlineStyle (com.xenoage.zong.core.music.barline.BarlineStyle)1