use of com.xenoage.zong.core.music.clef.ClefType 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;
}
use of com.xenoage.zong.core.music.clef.ClefType in project Zong by Xenoage.
the class ElementStamper method createClefStamping.
/**
* Creates a stamping for the given clef.
*/
public StaffSymbolStamping createClefStamping(ClefNotation clef, float xMm, StamperContext context) {
val staff = context.getCurrentStaffStamping();
ClefType clefType = clef.element.getType();
return new StaffSymbolStamping(clef, staff, context.getSymbol(CommonSymbol.getClef(clefType.getSymbol())), null, sp(xMm, clefType.getLp()), clef.scaling, false);
}
use of com.xenoage.zong.core.music.clef.ClefType in project Zong by Xenoage.
the class ScoreTest method createTestScoreClefsKeys.
/**
* Creates a score with a single staff, two measures,
* and a number of clefs, keys and chords.
* The score, the list of clefs and the list of keys is returned.
*/
private Tuple3<Score, List<ClefType>, List<Key>> createTestScoreClefsKeys() {
// create two measures:
// clef-g, key-Gmaj, C#1/4, clef-f, Db1/4, clef-g, key-Fmaj, Cnat1/4 |
// C#1/4, key-Cmaj, clef-f, C2/4.
Score score = ScoreFactory.create1Staff();
new MeasureAdd(score, 1).execute();
List<ClefType> clefs = alist();
List<Key> keys = alist();
ClefType c;
Key k;
// measure 0
Measure measure = score.getMeasure(atMeasure(0, 0));
new Clef(ClefType.Companion.getClefTreble());
clefs.add(c = ClefType.Companion.getClefTreble());
new MeasureElementWrite(new Clef(c), measure, Companion.fr(0, 4)).execute();
keys.add(k = new TraditionalKey(1, Mode.Major));
new MeasureElementWrite(k, measure, Companion.fr(0, 4)).execute();
new VoiceElementWrite(measure.getVoice(0), atElement(0, 0, 0, 0), chord(Companion.pi(0, 1, 4), Companion.fr(1, 4)), null).execute();
clefs.add(c = ClefType.Companion.getClefBass());
new MeasureElementWrite(new Clef(c), measure, Companion.fr(1, 4)).execute();
new VoiceElementWrite(measure.getVoice(0), atElement(0, 0, 0, 1), chord(Companion.pi(1, -1, 4), Companion.fr(1, 4)), null).execute();
clefs.add(c = ClefType.Companion.getClefTreble());
new MeasureElementWrite(new Clef(c), measure, Companion.fr(2, 4)).execute();
keys.add(k = new TraditionalKey(-1, Mode.Major));
new MeasureElementWrite(k, measure, Companion.fr(2, 4)).execute();
new VoiceElementWrite(measure.getVoice(0), atElement(0, 0, 0, 2), chord(Companion.pi(0, 0, 4), Companion.fr(1, 4)), null).execute();
// measure 1
measure = score.getMeasure(atMeasure(0, 1));
new VoiceElementWrite(measure.getVoice(0), atElement(0, 1, 0, 0), chord(Companion.pi(0, 1, 4), Companion.fr(1, 4)), null).execute();
keys.add(k = new TraditionalKey(0, Mode.Major));
new MeasureElementWrite(k, measure, Companion.fr(1, 4)).execute();
clefs.add(c = ClefType.Companion.getClefBass());
new MeasureElementWrite(new Clef(c), measure, Companion.fr(1, 4)).execute();
new VoiceElementWrite(measure.getVoice(0), atElement(0, 1, 0, 1), chord(Companion.pi(0, 0, 4), Companion.fr(2, 4)), null).execute();
return t3(score, clefs, keys);
}
use of com.xenoage.zong.core.music.clef.ClefType in project Zong by Xenoage.
the class Test12a method checkClef.
private void checkClef(Score score, int measure, ClefSymbol expectedSymbol, int expectedClefLP, int expectedC4LP) {
ClefType clef = score.getMeasure(atMeasure(0, measure)).getClefs().getFirst().getElement().getType();
assertEquals("measure " + measure, expectedSymbol, clef.getSymbol());
assertEquals("measure " + measure, expectedClefLP, clef.getLp());
assertEquals("measure " + measure, expectedC4LP, clef.getLp(Companion.pi('C', 0, 4)));
}
use of com.xenoage.zong.core.music.clef.ClefType in project Zong by Xenoage.
the class TraditionalKeyNotator method compute.
public TraditionalKeyNotation compute(TraditionalKey key, Context context) {
// compute width
float width = 0;
int fifth = key.getFifths();
if (fifth > 0)
width = fifth * context.settings.spacings.widthSharp;
else
width = -fifth * context.settings.spacings.widthFlat;
ElementWidth keyWidth = new ElementWidth(0, width, 1);
// compute LPs
ClefType contextClef = context.score.getClef(context.mp, Before);
int c4Lp = contextClef.getLp(Companion.pi(0, 0, 4));
int minLp = contextClef.getKeySignatureLowestLp(fifth);
return new TraditionalKeyNotation(key, keyWidth, c4Lp, minLp);
}
Aggregations