Search in sources :

Example 1 with Tuple2

use of com.xenoage.utils.kernel.Tuple2 in project Zong by Xenoage.

the class Base43e method getExpectedClefs.

static List<Tuple2<MP, Clef>> getExpectedClefs() {
    List<Tuple2<MP, Clef>> clefs = alist();
    clefs.add(t(atBeat(0, 0, unknown, Companion.get_0()), new Clef(ClefType.Companion.getClefTreble())));
    clefs.add(t(atBeat(0, 2, unknown, Companion.get_0()), new Clef(new ClefType(ClefSymbol.C, 2))));
    clefs.add(t(atBeat(1, 0, unknown, Companion.get_0()), new Clef(ClefType.Companion.getClefBass())));
    clefs.add(t(atBeat(1, 1, unknown, Companion.get_0()), new Clef(ClefType.Companion.getClefTreble())));
    return clefs;
}
Also used : Tuple2(com.xenoage.utils.kernel.Tuple2) Clef(com.xenoage.zong.core.music.clef.Clef) ClefType(com.xenoage.zong.core.music.clef.ClefType)

Example 2 with Tuple2

use of com.xenoage.utils.kernel.Tuple2 in project Zong by Xenoage.

the class Test21d method test.

@Test
public void test() {
    MxlPart part = getFirstPart();
    List<Tuple2<MP, ? extends Direction>> expectedDirections = getExpectedDirections();
    // check only directions in this test
    int iDirection = 0;
    for (int iMeasure = 0; iMeasure <= 1; iMeasure++) {
        MxlMeasure measure = part.getMeasures().get(iMeasure);
        for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
            if (data.getMusicDataContentType() == MxlMusicDataContentType.Direction) {
                // check type
                MxlDirection dir = (MxlDirection) data;
                MxlDirectionTypeContent content = dir.getDirectionTypes().get(0).getContent();
                if (iDirection == 0) {
                    // Words "Largo"
                    assertEquals(0, iMeasure);
                    assertEquals(MxlDirectionTypeContentType.Words, content.getDirectionTypeContentType());
                    assertEquals("Largo", ((MxlWords) content).getFormattedText().getValue());
                } else if (iDirection == 1) {
                    // Dynamic "fp"
                    assertEquals(0, iMeasure);
                    assertEquals(MxlDirectionTypeContentType.Dynamics, content.getDirectionTypeContentType());
                    assertEquals(DynamicValue.fp, ((MxlDynamics) content).getElement());
                } else if (iDirection == 2) {
                    // Dynamic "p"
                    assertEquals(1, iMeasure);
                    assertEquals(MxlDirectionTypeContentType.Dynamics, content.getDirectionTypeContentType());
                    assertEquals(DynamicValue.p, ((MxlDynamics) content).getElement());
                }
                iDirection++;
            }
        }
    }
    assertEquals("not all directions found", expectedDirections.size(), iDirection);
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlDynamics(com.xenoage.zong.musicxml.types.MxlDynamics) Tuple2(com.xenoage.utils.kernel.Tuple2) MxlDirectionTypeContent(com.xenoage.zong.musicxml.types.choice.MxlDirectionTypeContent) MxlWords(com.xenoage.zong.musicxml.types.MxlWords) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) MxlDirection(com.xenoage.zong.musicxml.types.MxlDirection) Direction(com.xenoage.zong.core.music.direction.Direction) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) MxlDirection(com.xenoage.zong.musicxml.types.MxlDirection) Test(org.junit.Test)

Example 3 with Tuple2

use of com.xenoage.utils.kernel.Tuple2 in project Zong by Xenoage.

the class Base21d method getExpectedDirections.

default List<Tuple2<MP, ? extends Direction>> getExpectedDirections() {
    List<Tuple2<MP, ? extends Direction>> expectedDirections = alist();
    Words largo = new Words(new UnformattedText("Largo"));
    largo.setPositioning(Placement.Above);
    expectedDirections.add(t(mp0, largo));
    Dynamic fp = new Dynamic(DynamicValue.fp);
    fp.setPositioning(Placement.Below);
    expectedDirections.add(t(mp0, fp));
    Dynamic p = new Dynamic(DynamicValue.p);
    fp.setPositioning(Placement.Below);
    expectedDirections.add(t(mp0.withMeasure(1), p));
    return expectedDirections;
}
Also used : Dynamic(com.xenoage.zong.core.music.direction.Dynamic) Tuple2(com.xenoage.utils.kernel.Tuple2) Words(com.xenoage.zong.core.music.direction.Words) UnformattedText(com.xenoage.zong.core.text.UnformattedText) Direction(com.xenoage.zong.core.music.direction.Direction)

Example 4 with Tuple2

use of com.xenoage.utils.kernel.Tuple2 in project Zong by Xenoage.

the class Base43e method getExpectedDirections.

static List<Tuple2<MP, Direction>> getExpectedDirections() {
    Wedge wedge;
    List<Tuple2<MP, Direction>> directions = alist();
    directions.add(t(atBeat(0, 0, unknown, Companion.get_0()), new Dynamic(DynamicValue.ffff)));
    directions.add(t(atBeat(0, 0, unknown, Companion.fr(3, 4)), new Dynamic(DynamicValue.p)));
    directions.add(t(atBeat(1, 0, unknown, Companion.get_0()), wedge = new Wedge(WedgeType.Crescendo)));
    directions.add(t(atBeat(1, 0, unknown, Companion.fr(2, 4)), wedge.getWedgeEnd()));
    return directions;
}
Also used : Dynamic(com.xenoage.zong.core.music.direction.Dynamic) Tuple2(com.xenoage.utils.kernel.Tuple2) Wedge(com.xenoage.zong.core.music.direction.Wedge)

Example 5 with Tuple2

use of com.xenoage.utils.kernel.Tuple2 in project Zong by Xenoage.

the class Base46c method getExpectedClefs.

static List<Tuple2<MP, Clef>> getExpectedClefs() {
    List<Tuple2<MP, Clef>> clefs = alist();
    clefs.add(t(atBeat(0, 0, unknown, Companion.get_0()), new Clef(ClefType.Companion.getClefTreble())));
    clefs.add(t(atBeat(0, 2, unknown, Companion.get_0()), new Clef(new ClefType(ClefSymbol.C, 2))));
    clefs.add(t(atBeat(0, 3, unknown, Companion.fr(2, 4)), new Clef(ClefType.Companion.getClefTreble())));
    return clefs;
}
Also used : Tuple2(com.xenoage.utils.kernel.Tuple2) Clef(com.xenoage.zong.core.music.clef.Clef) ClefType(com.xenoage.zong.core.music.clef.ClefType)

Aggregations

Tuple2 (com.xenoage.utils.kernel.Tuple2)5 Clef (com.xenoage.zong.core.music.clef.Clef)2 ClefType (com.xenoage.zong.core.music.clef.ClefType)2 Direction (com.xenoage.zong.core.music.direction.Direction)2 Dynamic (com.xenoage.zong.core.music.direction.Dynamic)2 Wedge (com.xenoage.zong.core.music.direction.Wedge)1 Words (com.xenoage.zong.core.music.direction.Words)1 UnformattedText (com.xenoage.zong.core.text.UnformattedText)1 MxlDirection (com.xenoage.zong.musicxml.types.MxlDirection)1 MxlDynamics (com.xenoage.zong.musicxml.types.MxlDynamics)1 MxlWords (com.xenoage.zong.musicxml.types.MxlWords)1 MxlDirectionTypeContent (com.xenoage.zong.musicxml.types.choice.MxlDirectionTypeContent)1 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)1 MxlMeasure (com.xenoage.zong.musicxml.types.partwise.MxlMeasure)1 MxlPart (com.xenoage.zong.musicxml.types.partwise.MxlPart)1 Test (org.junit.Test)1