Search in sources :

Example 6 with SlurWaypoint

use of com.xenoage.zong.core.music.slur.SlurWaypoint in project Zong by Xenoage.

the class SlurStamper method createForSingleSystem.

/**
 * Creates a {@link SlurStamping} for a curved line that
 * uses only a single system. The slur may span over multiple staves.
 */
SlurStamping createForSingleSystem(SlurCache slurCache) {
    Slur slur = slurCache.getSlur();
    SlurWaypoint wp1 = slur.getStart();
    SlurWaypoint wp2 = slur.getStop();
    // end points of the bezier curve
    VSide side = slurCache.getSide();
    SP p1 = computeEndPoint(slur, slurCache.getDefaultStartSp(), wp1.getBezierPoint());
    SP p2 = computeEndPoint(slur, slurCache.getDefaultStopSp(), wp2.getBezierPoint());
    // control points of the bezier curve
    BezierPoint b1 = wp1.getBezierPoint();
    BezierPoint b2 = wp2.getBezierPoint();
    SP c1 = (// custom formatting
    b1 != null && b1.getControl() != null ? // custom formatting
    b1.getControl() : // default formatting
    computeLeftControlPoint(slur, p1, p2, slurCache.getStartStaff()));
    SP c2 = (// custom formatting
    b2 != null && b2.getControl() != null ? // custom formatting
    b2.getControl() : // default formatting
    computeRightControlPoint(slur, p1, p2, slurCache.getStopStaff()));
    return new SlurStamping(slur, p1, p2, c1, c2, slurCache.getStartStaff(), slurCache.getStopStaff());
}
Also used : BezierPoint(com.xenoage.zong.core.music.format.BezierPoint) Slur(com.xenoage.zong.core.music.slur.Slur) ContinuedSlur(com.xenoage.zong.musiclayout.continued.ContinuedSlur) SlurStamping(com.xenoage.zong.musiclayout.stampings.SlurStamping) SP(com.xenoage.zong.core.music.format.SP) SlurWaypoint(com.xenoage.zong.core.music.slur.SlurWaypoint) VSide(com.xenoage.utils.math.VSide)

Example 7 with SlurWaypoint

use of com.xenoage.zong.core.music.slur.SlurWaypoint in project Zong by Xenoage.

the class SlursTest method assertSlurBetween.

public static void assertSlurBetween(Chord[] chords, int chord1Index, int chord2Index, SlurType expectedSlurType) {
    Slur slur = getStartSlur(chords, chord1Index);
    assertEquals(expectedSlurType, slur.getType());
    List<SlurWaypoint> waypoints = slur.getWaypoints();
    assertEquals(2, waypoints.size());
    assertEquals(chords[chord1Index], waypoints.get(0).getChord());
    assertEquals(chords[chord2Index], waypoints.get(1).getChord());
}
Also used : Slur(com.xenoage.zong.core.music.slur.Slur) SlurWaypoint(com.xenoage.zong.core.music.slur.SlurWaypoint)

Aggregations

SlurWaypoint (com.xenoage.zong.core.music.slur.SlurWaypoint)7 BezierPoint (com.xenoage.zong.core.music.format.BezierPoint)4 SP (com.xenoage.zong.core.music.format.SP)4 Slur (com.xenoage.zong.core.music.slur.Slur)4 VSide (com.xenoage.utils.math.VSide)3 SlurStamping (com.xenoage.zong.musiclayout.stampings.SlurStamping)3 WaypointPosition (com.xenoage.zong.core.music.WaypointPosition)2 Chord (com.xenoage.zong.core.music.chord.Chord)2 Score (com.xenoage.zong.core.Score)1 Pitch (com.xenoage.zong.core.music.Pitch)1 Beam (com.xenoage.zong.core.music.beam.Beam)1 Lyric (com.xenoage.zong.core.music.lyric.Lyric)1 SyllableType (com.xenoage.zong.core.music.lyric.SyllableType)1 SlurType (com.xenoage.zong.core.music.slur.SlurType)1 Tuplet (com.xenoage.zong.core.music.tuplet.Tuplet)1 OtherReader.readBezierPoint (com.xenoage.zong.io.musicxml.in.readers.OtherReader.readBezierPoint)1 OtherReader.readVSide (com.xenoage.zong.io.musicxml.in.readers.OtherReader.readVSide)1 OpenSlur (com.xenoage.zong.io.musicxml.in.util.OpenSlur)1 OpenUnnumberedTieds (com.xenoage.zong.io.musicxml.in.util.OpenUnnumberedTieds)1 ContinuedSlur (com.xenoage.zong.musiclayout.continued.ContinuedSlur)1