Search in sources :

Example 6 with MusicContext

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

the class StemNotatorTest method testPitch.

private void testPitch(Pitch[] pitches, float start, float end) {
    MusicContext context = MusicContext.Companion.getSimpleInstance();
    Chord chord;
    NotesNotation chordNotesAlignment;
    StemNotation chordStemAlignment;
    Fraction fraction = Companion.fr(1, 1);
    chord = ChordFactory.chord(pitches, fraction);
    ChordLps linepositions = new ChordLps(chord, context);
    StemDirection stemDirection = singleStemDirector.compute(linepositions, 5);
    chordNotesAlignment = notesNotator.compute(chord, stemDirection, defaultChordWidthsNormal, context);
    chordStemAlignment = testee.compute(Stem.Companion.getDefaultStem(), chordNotesAlignment.getLps(), stemDirection, 0, Companion.getStaff5Lines(), 1);
    assertEquals(start, chordStemAlignment.startSlp.lp, Delta.DELTA_FLOAT);
    assertEquals(end, chordStemAlignment.endSlp.lp, Delta.DELTA_FLOAT);
}
Also used : ChordLps(com.xenoage.zong.musiclayout.notation.chord.ChordLps) NotesNotation(com.xenoage.zong.musiclayout.notation.chord.NotesNotation) Fraction(com.xenoage.utils.math.Fraction) MusicContext(com.xenoage.zong.core.music.MusicContext) Chord(com.xenoage.zong.core.music.chord.Chord) StemDirection(com.xenoage.zong.core.music.chord.StemDirection) StemNotation(com.xenoage.zong.musiclayout.notation.chord.StemNotation)

Aggregations

MusicContext (com.xenoage.zong.core.music.MusicContext)6 Chord (com.xenoage.zong.core.music.chord.Chord)3 Score (com.xenoage.zong.core.Score)2 StemDirection (com.xenoage.zong.core.music.chord.StemDirection)2 ChordLps (com.xenoage.zong.musiclayout.notation.chord.ChordLps)2 NotesNotation (com.xenoage.zong.musiclayout.notation.chord.NotesNotation)2 StemNotation (com.xenoage.zong.musiclayout.notation.chord.StemNotation)2 ElementWidth (com.xenoage.zong.musiclayout.spacing.ElementWidth)2 FontInfo (com.xenoage.utils.font.FontInfo)1 TextMeasurer (com.xenoage.utils.font.TextMeasurer)1 Fraction (com.xenoage.utils.math.Fraction)1 ColumnHeader (com.xenoage.zong.core.header.ColumnHeader)1 Pitch (com.xenoage.zong.core.music.Pitch)1 Clef (com.xenoage.zong.core.music.clef.Clef)1 Key (com.xenoage.zong.core.music.key.Key)1 TraditionalKey (com.xenoage.zong.core.music.key.TraditionalKey)1 Lyric (com.xenoage.zong.core.music.lyric.Lyric)1 SyllableType (com.xenoage.zong.core.music.lyric.SyllableType)1 MP (com.xenoage.zong.core.position.MP)1 FormattedText (com.xenoage.zong.core.text.FormattedText)1