use of com.xenoage.zong.core.music.chord.Chord 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();
Staff staff = getFirstStaff();
assertEquals(26, staff.getMeasures().size());
int iPitch = 0;
for (int iM = 0; iM < staff.getMeasures().size(); iM++) {
Measure measure = staff.getMeasures().get(iM);
Voice voice = measure.getVoice(0);
for (VoiceElement e : voice.getElements()) {
if (e instanceof Chord) {
// check note and pitch
Chord chord = (Chord) e;
assertEquals(expectedPitches[iPitch++], chord.getNotes().get(0).getPitch());
}
}
}
assertEquals("not all notes found", expectedPitches.length, iPitch);
}
use of com.xenoage.zong.core.music.chord.Chord in project Zong by Xenoage.
the class Test01b method test.
@Test
public void test() {
Pitch[] expectedPitches = getExpectedPitches();
int iPitch = 0;
Staff staff = getFirstStaff();
for (int iM = 0; iM < staff.getMeasures().size(); iM++) {
Measure measure = staff.getMeasures().get(iM);
Voice voice = measure.getVoice(0);
for (VoiceElement e : voice.getElements()) {
if (e instanceof Chord) {
// check note and pitch
Chord chord = (Chord) e;
assertEquals(expectedPitches[iPitch++], chord.getNotes().get(0).getPitch());
}
}
}
// TODO - ignore this test, since MusicXML input file has a bug (only a single measure),
// so currently only the first measure is tested
// assertEquals("not all notes found", expectedPitches.length, iPitch);
}
use of com.xenoage.zong.core.music.chord.Chord 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() {
int[] expectedLPs = getExpectedLPs();
Staff staff = getFirstStaff();
ScoreFrameLayout scoreFrameLayout = getScoreFrameLayout();
int chordIndex = 0;
for (int iM = 0; iM < staff.getMeasures().size(); iM++) {
Measure measure = staff.getMeasures().get(iM);
Voice voice = measure.getVoice(0);
for (VoiceElement e : voice.getElements()) {
if (e instanceof Chord) {
// check LP
// TODO
}
}
}
}
use of com.xenoage.zong.core.music.chord.Chord in project Zong by Xenoage.
the class Test21b method test.
@Test
public void test() {
Score score = getScore();
MP mp = mp0;
for (int i = 0; i < expectedChordsCount; i++) {
Chord chord = (Chord) score.getVoice(mp).getElementAt(mp.beat);
assertEquals(expectedChord.getNotes(), chord.getNotes());
assertEquals(expectedChord.getDuration(), chord.getDuration());
mp = mp.withBeat(mp.beat.add(Companion.fr(1, 4)));
if (mp.beat.compareTo(Companion.get_1()) >= 0) {
mp = mp.withMeasure(mp.measure + 1).withBeat(Companion.get_0());
}
}
}
use of com.xenoage.zong.core.music.chord.Chord in project Zong by Xenoage.
the class Test21d method testMeasure0.
@Test
public void testMeasure0() {
// F4, whole, with accent and fermata
Chord chord = (Chord) score.getVoice(mp0).getElementAt(Companion.get_0());
assertEquals(1, chord.getNotes().size());
assertEquals(Companion.pi('F', 0, 4), chord.getNotes().get(0).getPitch());
assertEquals(Companion.get_1(), chord.getDuration());
assertEquals(2, chord.getAnnotations().size());
assertEquals(articulation(ArticulationType.Accent, Placement.Below), chord.getAnnotations().get(0));
assertEquals(fermata(Placement.Above), chord.getAnnotations().get(1));
// words "Largo"
List<MeasureElement> directions = score.getMeasure(mp0).getMeasureElements().getAll(Companion.get_0());
// clef, words, dynamics
assertEquals(3, directions.size());
Words words = (Words) directions.get(1);
assertEquals("Largo", words.getText().toString());
assertEquals(Placement.Above, words.getPositioning());
// dynamics "fp"
Dynamic dynamics = (Dynamic) directions.get(2);
assertEquals(DynamicValue.fp, dynamics.getValue());
assertEquals(Placement.Below, dynamics.getPositioning());
}
Aggregations