Search in sources :

Example 1 with DynamicValue

use of com.xenoage.zong.core.music.direction.DynamicValue in project Zong by Xenoage.

the class MxlDynamics method read.

/**
 * Reads the given element and returns it, or returns null if
 * the element is empty or not supported.
 */
@MaybeNull
public static MxlDynamics read(XmlReader reader) {
    // attributes
    MxlPrintStyle printStyle = MxlPrintStyle.read(reader);
    MxlPlacement placement = MxlPlacement.read(reader);
    // get first element
    if (false == reader.openNextChildElement())
        // dynamics element may be empty according to schema
        return null;
    String childText = reader.getElementName();
    reader.closeElement();
    DynamicValue element = getEnumValue(childText, DynamicValue.values());
    if (element != null)
        return new MxlDynamics(element, printStyle, placement);
    else
        return null;
}
Also used : MxlPlacement(com.xenoage.zong.musicxml.types.enums.MxlPlacement) MxlPrintStyle(com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle) DynamicValue(com.xenoage.zong.core.music.direction.DynamicValue) MaybeNull(com.xenoage.utils.annotations.MaybeNull)

Example 2 with DynamicValue

use of com.xenoage.zong.core.music.direction.DynamicValue in project Zong by Xenoage.

the class DynamicsReader method read.

public static Dynamic read(MxlDynamics mxlDynamics, StaffDetails staffDetails) {
    DynamicValue type = mxlDynamics.getElement();
    Positioning positioning = new PositioningReader(staffDetails).readFromAny(mxlDynamics);
    Dynamic dynamics = new Dynamic(type);
    dynamics.setPositioning(positioning);
    return dynamics;
}
Also used : Positioning(com.xenoage.zong.core.music.format.Positioning) Dynamic(com.xenoage.zong.core.music.direction.Dynamic) DynamicValue(com.xenoage.zong.core.music.direction.DynamicValue)

Aggregations

DynamicValue (com.xenoage.zong.core.music.direction.DynamicValue)2 MaybeNull (com.xenoage.utils.annotations.MaybeNull)1 Dynamic (com.xenoage.zong.core.music.direction.Dynamic)1 Positioning (com.xenoage.zong.core.music.format.Positioning)1 MxlPrintStyle (com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle)1 MxlPlacement (com.xenoage.zong.musicxml.types.enums.MxlPlacement)1