Search in sources :

Example 11 with MxlMeasure

use of com.xenoage.zong.musicxml.types.partwise.MxlMeasure in project Zong by Xenoage.

the class Test01a method test.

@ToDo("the editiorial sharp (sharp in parenthesis) in the last measure is not supported yet")
@Test
public void test() {
    Pitch[] expectedPitches = getExpectedPitches();
    MxlPart part = getFirstPart();
    assertEquals(26, part.getMeasures().size());
    int iPitch = 0;
    for (int iM = 0; iM < part.getMeasures().size(); iM++) {
        MxlMeasure measure = part.getMeasures().get(iM);
        for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
            if (data.getMusicDataContentType() == MxlMusicDataContentType.Note) {
                // check note and pitch
                MxlFullNote note = ((MxlNote) data).getContent().getFullNote();
                MxlPitch pitch = (MxlPitch) (note.getContent());
                assertEquals("note " + iPitch, expectedPitches[iPitch++], pitch.getPitch());
            }
        }
    }
    assertEquals("not all notes found", expectedPitches.length, iPitch);
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlFullNote(com.xenoage.zong.musicxml.types.groups.MxlFullNote) MxlPitch(com.xenoage.zong.musicxml.types.MxlPitch) MxlPitch(com.xenoage.zong.musicxml.types.MxlPitch) Pitch(com.xenoage.zong.core.music.Pitch) MxlPart(com.xenoage.zong.musicxml.types.partwise.MxlPart) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) ToDo(musicxmltestsuite.tests.utils.ToDo) Test(org.junit.Test)

Example 12 with MxlMeasure

use of com.xenoage.zong.musicxml.types.partwise.MxlMeasure in project Zong by Xenoage.

the class Test01c method test.

@Test
public void test() {
    MxlMeasure measure = getFirstMeasure();
    for (MxlMusicDataContent data : measure.getMusicData().getContent()) {
        if (data.getMusicDataContentType() == MxlMusicDataContentType.Note) {
            // check pitch
            MxlNote note = (MxlNote) data;
            MxlFullNote fullNote = note.getContent().getFullNote();
            MxlPitch pitch = (MxlPitch) (fullNote.getContent());
            assertEquals(Companion.pi('G', 0, 4), pitch.getPitch());
            // check lyric
            assertEquals(1, note.getLyrics().size());
            assertEquals("A", ((MxlSyllabicText) note.getLyrics().get(0).getContent()).getText().getValue());
            return;
        }
    }
    fail("note not found");
}
Also used : MxlMusicDataContent(com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent) MxlFullNote(com.xenoage.zong.musicxml.types.groups.MxlFullNote) MxlPitch(com.xenoage.zong.musicxml.types.MxlPitch) MxlSyllabicText(com.xenoage.zong.musicxml.types.MxlSyllabicText) MxlMeasure(com.xenoage.zong.musicxml.types.partwise.MxlMeasure) MxlNote(com.xenoage.zong.musicxml.types.MxlNote) Test(org.junit.Test)

Aggregations

MxlMeasure (com.xenoage.zong.musicxml.types.partwise.MxlMeasure)12 MxlMusicDataContent (com.xenoage.zong.musicxml.types.choice.MxlMusicDataContent)11 MxlPart (com.xenoage.zong.musicxml.types.partwise.MxlPart)10 Test (org.junit.Test)10 ToDo (musicxmltestsuite.tests.utils.ToDo)4 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)3 MxlAttributes (com.xenoage.zong.musicxml.types.MxlAttributes)3 MxlPitch (com.xenoage.zong.musicxml.types.MxlPitch)3 MxlFullNote (com.xenoage.zong.musicxml.types.groups.MxlFullNote)3 Pitch (com.xenoage.zong.core.music.Pitch)2 MxlKey (com.xenoage.zong.musicxml.types.MxlKey)2 MxlNormalNote (com.xenoage.zong.musicxml.types.choice.MxlNormalNote)2 Tuple2 (com.xenoage.utils.kernel.Tuple2)1 Fraction (com.xenoage.utils.math.Fraction)1 ColumnElementWrite (com.xenoage.zong.commands.core.music.ColumnElementWrite)1 MeasureAddUpTo (com.xenoage.zong.commands.core.music.MeasureAddUpTo)1 MeasureElementWrite (com.xenoage.zong.commands.core.music.MeasureElementWrite)1 VoiceElementWrite (com.xenoage.zong.commands.core.music.VoiceElementWrite)1 Measure (com.xenoage.zong.core.music.Measure)1 Part (com.xenoage.zong.core.music.Part)1