Search in sources :

Example 1 with BeamIterator

use of com.xenoage.zong.core.util.BeamIterator in project Zong by Xenoage.

the class BeamsSpacer method compute.

public Map<Beam, BeamSpacing> compute(Score score, Notations notations, FramesSpacing frames) {
    Map<Beam, BeamSpacing> ret = map();
    BeamIterator itB = new BeamIterator(score);
    for (Beam beam : itB) {
        MP mp = itB.getMp();
        int staffLinesCount = score.getStaff(mp).getLinesCount();
        val frame = frames.getFrame(mp.measure);
        val system = frame.getSystem(mp.measure);
        val beamNotation = (BeamNotation) notations.get(beam);
        ret.put(beam, beamSpacer.compute(beamNotation, system, score));
    }
    return ret;
}
Also used : Beam(com.xenoage.zong.core.music.beam.Beam) lombok.val(lombok.val) BeamSpacing(com.xenoage.zong.musiclayout.spacing.BeamSpacing) MP(com.xenoage.zong.core.position.MP) BeamIterator(com.xenoage.zong.core.util.BeamIterator) BeamNotation(com.xenoage.zong.musiclayout.notation.BeamNotation)

Example 2 with BeamIterator

use of com.xenoage.zong.core.util.BeamIterator in project Zong by Xenoage.

the class Notator method computeAll.

/**
 * Computes the {@link Notation}s of all elements and returns them.
 */
public Notations computeAll(Context context) {
    context.saveMp();
    Score score = context.score;
    Notations notations = new Notations();
    // iterate over all column elements, measure elements and voice elements
    ColumnElementIterator itC = new ColumnElementIterator(score);
    for (ColumnElement e : itC) {
        // column elements: one notation for each staff
        for (int iStaff : range(context.score.getStavesCount())) {
            context.mp = itC.getMp().withStaff(iStaff);
            notations.add(compute(e, context, notations), iStaff);
        }
    }
    MeasureElementIterator itM = new MeasureElementIterator(score);
    for (MeasureElement e : itM) {
        context.mp = itM.getMp();
        notations.add(compute(e, context, notations));
    }
    VoiceElementIterator itV = new VoiceElementIterator(score);
    for (VoiceElement e : itV) {
        context.mp = itV.getMp();
        notations.add(compute(e, context, notations));
    }
    BeamIterator itB = new BeamIterator(score);
    for (Beam e : itB) {
        context.mp = itB.getMp();
        notations.add(compute(e, context, notations));
    }
    context.restoreMp();
    return notations;
}
Also used : Beam(com.xenoage.zong.core.music.beam.Beam) Score(com.xenoage.zong.core.Score) VoiceElementIterator(com.xenoage.zong.core.util.VoiceElementIterator) Notations(com.xenoage.zong.musiclayout.notation.Notations) BeamIterator(com.xenoage.zong.core.util.BeamIterator) ColumnElementIterator(com.xenoage.zong.core.util.ColumnElementIterator) MeasureElementIterator(com.xenoage.zong.core.util.MeasureElementIterator)

Aggregations

Beam (com.xenoage.zong.core.music.beam.Beam)2 BeamIterator (com.xenoage.zong.core.util.BeamIterator)2 Score (com.xenoage.zong.core.Score)1 MP (com.xenoage.zong.core.position.MP)1 ColumnElementIterator (com.xenoage.zong.core.util.ColumnElementIterator)1 MeasureElementIterator (com.xenoage.zong.core.util.MeasureElementIterator)1 VoiceElementIterator (com.xenoage.zong.core.util.VoiceElementIterator)1 BeamNotation (com.xenoage.zong.musiclayout.notation.BeamNotation)1 Notations (com.xenoage.zong.musiclayout.notation.Notations)1 BeamSpacing (com.xenoage.zong.musiclayout.spacing.BeamSpacing)1 lombok.val (lombok.val)1