Ejemplo n.º 1
0
        public void TestDisplayTranspositionPitchResultsInAccidental()
        {
            var import = new AlphaTexImporter();

            import.Init(ByteBuffer.FromBuffer(Encoding.UTF8.GetBytes("\\tuning none . e3.8")));
            var score = import.ReadScore();

            var settings = Settings.Defaults;

            // no transposition
            settings.TranspositionPitches = new [] { 0 };
            ModelUtils.ApplyPitchOffsets(settings, score);
            var helper     = new AccidentalHelper();
            var accidental = helper.ApplyAccidental(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);
            var line       = helper.GetNoteLine(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);

            Assert.AreEqual(AccidentalType.None, accidental);
            Assert.AreEqual(17, line);

            // one semitone up => one line up
            settings.TranspositionPitches = new[] { 1 };
            ModelUtils.ApplyPitchOffsets(settings, score);
            helper     = new AccidentalHelper();
            accidental = helper.ApplyAccidental(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);
            line       = helper.GetNoteLine(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);
            Assert.AreEqual(AccidentalType.None, accidental);
            Assert.AreEqual(16, line);

            // two semitones up => one line up + sharp
            settings.TranspositionPitches = new[] { 2 };
            ModelUtils.ApplyPitchOffsets(settings, score);
            helper     = new AccidentalHelper();
            accidental = helper.ApplyAccidental(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);
            line       = helper.GetNoteLine(score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].Notes[0]);
            Assert.AreEqual(AccidentalType.Sharp, accidental);
            Assert.AreEqual(16, line);
        }
Ejemplo n.º 2
0
 public ScoreBarRenderer(Bar bar)
     : base(bar)
 {
     AccidentalHelper = new AccidentalHelper();
 }
Ejemplo n.º 3
0
 // TODO[performance]: Maybe we should cache this (check profiler)
 public int GetNoteLine(Note n)
 {
     return(AccidentalHelper.GetNoteLine(n));
 }
Ejemplo n.º 4
0
 public ScoreBarRenderer(ScoreRenderer renderer, Bar bar)
     : base(renderer, bar)
 {
     AccidentalHelper = new AccidentalHelper();
 }
Ejemplo n.º 5
0
 public float GetYPositionForNoteValue(int noteValue)
 {
     return(GetScoreY(AccidentalHelper.GetNoteLineForValue(noteValue, true)));
 }