Search in sources :

Example 11 with MeasureAdd

use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.

the class RepetitionsFinderTest method testRepeatsWithinVoltas.

/**
 * Test case with repeats within voltas:
 *                   _______________ ___
 * voltas:           1               2
 * measures:   |    |   |:  |  :|  :|   ||
 * numbers:    |0   |1  |2  |3  |4  |5  ||
 */
@Test
public void testRepeatsWithinVoltas() {
    score = ScoreFactory.create1Staff();
    new MeasureAdd(score, 5).execute();
    writeVolta(1, 4, range(1, 1));
    writeForwardRepeat(2);
    writeBackwardRepeat(3, 1);
    writeBackwardRepeat(4, 1);
    writeVolta(5, 1, range(2, 2));
    val expectedRepetitions = new Repetitions(ilist(repetition(0, 4), repetition(2, 5), repetition(0, 1), repetition(5, 6)));
    runTest(new TestCase(score, expectedRepetitions));
}
Also used : lombok.val(lombok.val) MeasureAdd(com.xenoage.zong.commands.core.music.MeasureAdd) Test(org.junit.Test)

Example 12 with MeasureAdd

use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.

the class RepetitionsFinderTest method testAdvanced.

/**
 * A more advanced test case with the following repetitions:
 *                                                               ____ ________ ________________              ___ ___
 * voltas/repeats:                         2x                    1+2  3        4     senzarep                1   2
 * measures:  |   |(segno)  |:  |   |   :|   |   |(tocoda)  |:  |   :|   |   :|   |  (dalsegno)|(coda) |:   |  :|   ||
 * numbers:   |0  |1        |2  |3  |4   |5  |6  |7         |8  |9   |10 |11  |12 |13          |14     |15  |16 |17 ||
 */
@Test
public void testAdvanced() {
    score = ScoreFactory.create1Staff();
    new MeasureAdd(score, 17).execute();
    writeNavigationTarget(1, new Segno());
    writeForwardRepeat(2);
    writeBackwardRepeat(4, 2);
    writeNavigationOrigin(6, new Coda());
    writeForwardRepeat(8);
    writeVolta(9, 1, range(1, 2));
    writeBackwardRepeat(9, 2);
    writeVolta(10, 2, range(3, 3));
    writeBackwardRepeat(11, 1);
    writeVolta(12, 2, range(4, 4));
    writeNavigationOrigin(13, segno(false));
    writeNavigationTarget(14, new Coda());
    writeForwardRepeat(15);
    writeVolta(16, 1, range(1, 1));
    writeBackwardRepeat(16, 1);
    writeVolta(17, 1, range(2, 2));
    val expectedRepetitions = new Repetitions(ilist(repetition(0, 5), repetition(2, 5), repetition(2, 10), repetition(8, 10), repetition(8, 9), repetition(10, 12), repetition(8, 9), // -> dal segno senza rep
    repetition(12, 14), repetition(1, 7), repetition(14, 17), repetition(15, 16), repetition(17, 18)));
    runTest(new TestCase(score, expectedRepetitions));
}
Also used : lombok.val(lombok.val) MeasureAdd(com.xenoage.zong.commands.core.music.MeasureAdd) Test(org.junit.Test)

Example 13 with MeasureAdd

use of com.xenoage.zong.commands.core.music.MeasureAdd in project Zong by Xenoage.

the class VoltaGroupFinderTest method createScore.

private Score createScore() {
    Score score = ScoreFactory.create1Staff();
    new MeasureAdd(score, getLast(getLast(voltaGroups)) + 4).execute();
    for (val voltaGroup : voltaGroups) {
        for (int iVolta = 0; iVolta < voltaGroup.length - 1; iVolta++) {
            int startMeasure = voltaGroup[iVolta];
            int length = voltaGroup[iVolta + 1] - voltaGroup[iVolta];
            val numbers = range(iVolta + 1, iVolta + 1);
            score.getHeader().getColumnHeader(startMeasure).setVolta(new Volta(length, numbers, numbers.toString(), false));
        }
    }
    return score;
}
Also used : lombok.val(lombok.val) Score(com.xenoage.zong.core.Score) MeasureAdd(com.xenoage.zong.commands.core.music.MeasureAdd) Volta(com.xenoage.zong.core.music.volta.Volta)

Aggregations

MeasureAdd (com.xenoage.zong.commands.core.music.MeasureAdd)13 lombok.val (lombok.val)11 Test (org.junit.Test)8 PartAdd (com.xenoage.zong.commands.core.music.PartAdd)3 Score (com.xenoage.zong.core.Score)3 Part (com.xenoage.zong.core.music.Part)3 MeasureElementWrite (com.xenoage.zong.commands.core.music.MeasureElementWrite)2 Dynamic (com.xenoage.zong.core.music.direction.Dynamic)2 TimeSignature (com.xenoage.zong.core.music.time.TimeSignature)2 Volta (com.xenoage.zong.core.music.volta.Volta)2 Cursor (com.xenoage.zong.io.selection.Cursor)2 ColumnElementWrite (com.xenoage.zong.commands.core.music.ColumnElementWrite)1 DaCapo (com.xenoage.zong.core.music.direction.DaCapo)1 Wedge (com.xenoage.zong.core.music.direction.Wedge)1 WedgeEnd (com.xenoage.zong.core.music.direction.WedgeEnd)1 Rest (com.xenoage.zong.core.music.rest.Rest)1