Search in sources :

Example 6 with Notation

use of com.xenoage.zong.musiclayout.notation.Notation in project Zong by Xenoage.

the class MeasureStamper method stampLeading.

/**
 * Stamps the {@link MeasureElement}s of the leading spacing.
 * @param leadingXMm  the horizontal position on the staff in mm, where
 *                    the leading spacing of the measure starts.
 */
public List<Stamping> stampLeading(MeasureSpacing measure, float leadingXMm, StamperContext context) {
    LeadingSpacing leading = measure.leading;
    if (leading == null)
        return emptyList;
    List<Stamping> ret = alist(leading.elements.size());
    for (ElementSpacing element : leading.elements) {
        MusicElement me = element.getElement();
        if (me != null) {
            float xMm = leadingXMm + element.xIs * measure.interlineSpace;
            Notation notation = context.getNotation(me);
            if (notation == null)
                throw new RuntimeException("No notation for element " + me + " at " + MP.getMP(me));
            ret.add(stamp(notation, xMm, context));
        }
    }
    return ret;
}
Also used : ElementSpacing(com.xenoage.zong.musiclayout.spacing.ElementSpacing) Stamping(com.xenoage.zong.musiclayout.stampings.Stamping) MusicElement(com.xenoage.zong.core.music.MusicElement) LeadingSpacing(com.xenoage.zong.musiclayout.spacing.LeadingSpacing) Notation(com.xenoage.zong.musiclayout.notation.Notation) ClefNotation(com.xenoage.zong.musiclayout.notation.ClefNotation) TimeNotation(com.xenoage.zong.musiclayout.notation.TimeNotation) TraditionalKeyNotation(com.xenoage.zong.musiclayout.notation.TraditionalKeyNotation)

Aggregations

Notation (com.xenoage.zong.musiclayout.notation.Notation)6 ElementSpacing (com.xenoage.zong.musiclayout.spacing.ElementSpacing)5 MusicElement (com.xenoage.zong.core.music.MusicElement)3 Stamping (com.xenoage.zong.musiclayout.stampings.Stamping)3 Fraction (com.xenoage.utils.math.Fraction)2 ChordNotation (com.xenoage.zong.musiclayout.notation.ChordNotation)2 ClefNotation (com.xenoage.zong.musiclayout.notation.ClefNotation)2 TimeNotation (com.xenoage.zong.musiclayout.notation.TimeNotation)2 TraditionalKeyNotation (com.xenoage.zong.musiclayout.notation.TraditionalKeyNotation)2 MaybeNull (com.xenoage.utils.annotations.MaybeNull)1 VoiceElement (com.xenoage.zong.core.music.VoiceElement)1 Chord (com.xenoage.zong.core.music.chord.Chord)1 Clef (com.xenoage.zong.core.music.clef.Clef)1 Key (com.xenoage.zong.core.music.key.Key)1 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)1 RestNotation (com.xenoage.zong.musiclayout.notation.RestNotation)1 BeamSpacing (com.xenoage.zong.musiclayout.spacing.BeamSpacing)1 BorderSpacing (com.xenoage.zong.musiclayout.spacing.BorderSpacing)1 ChordSpacing (com.xenoage.zong.musiclayout.spacing.ChordSpacing)1 ElementWidth (com.xenoage.zong.musiclayout.spacing.ElementWidth)1