Search in sources :

Example 1 with MxlTimeContentType

use of com.xenoage.zong.musicxml.types.choice.MxlTimeContent.MxlTimeContentType in project Zong by Xenoage.

the class AttributesReader method readTime.

private TimeSignature readTime(MxlTime mxlTime) {
    if (mxlTime == null)
        return null;
    TimeSignature time = null;
    MxlTimeContentType type = mxlTime.getContent().getTimeContentType();
    if (type == MxlTimeContentType.SenzaMisura) {
        // senza misura
        time = new TimeSignature(Companion.getTimeSenzaMisura());
    } else if (type == MxlTimeContentType.NormalTime) {
        // normal time
        MxlNormalTime mxlNormalTime = (MxlNormalTime) mxlTime.getContent();
        // common, cut or fractional?
        if (mxlTime.getSymbol() == MxlTimeSymbol.Cut)
            time = new TimeSignature(TimeType.Companion.getTimeAllaBreve());
        else if (mxlTime.getSymbol() == MxlTimeSymbol.Common)
            time = new TimeSignature(TimeType.Companion.getTimeCommon());
        else
            // otherwise, we currently support only normal fractional time signatures
            time = new TimeSignature(Companion.timeType(mxlNormalTime.getBeats(), mxlNormalTime.getBeatType()));
    }
    return time;
}
Also used : MxlTimeContentType(com.xenoage.zong.musicxml.types.choice.MxlTimeContent.MxlTimeContentType) TimeSignature(com.xenoage.zong.core.music.time.TimeSignature)

Aggregations

TimeSignature (com.xenoage.zong.core.music.time.TimeSignature)1 MxlTimeContentType (com.xenoage.zong.musicxml.types.choice.MxlTimeContent.MxlTimeContentType)1