public override void Visit(ToneCommand visitee)
            {
                var stepTicks = CalcTicksFromLength(visitee.Length, this.ticksPerBar, this.length);
                var gateTicks = (int)(stepTicks * this.gateRatio);

                // TODO ちゃんと書き直す
                Data.ToneName toneName; switch (visitee.ToneName.BaseName.ToUpper())
                {
                case "C": toneName = Data.ToneName.C; break;

                case "D": toneName = Data.ToneName.D; break;

                case "E": toneName = Data.ToneName.E; break;

                case "F": toneName = Data.ToneName.F; break;

                case "G": toneName = Data.ToneName.G; break;

                case "A": toneName = Data.ToneName.A; break;

                case "B": toneName = Data.ToneName.B; break;

                default: throw new Exception();
                }

                var tone = new Tone {
                    Octave = this.octave, ToneName = toneName, Accidental = visitee.ToneName.Accidental
                };
                var freq = this.detune?.GetDetunedFreq(this.temperament[tone]) ?? this.temperament[tone];

                this.result.AddRange(this.owner.freqUsers.Select(u => new ValueInstruction <float>(u, freq)));
                if (!this.slur)
                {
                    this.result.AddRange(this.owner.noteUsers.Select(u => new NoteInstruction(u, true)));
                }
                this.result.Add(new WaitInstruction(gateTicks));

                if (!visitee.Slur)
                {
                    this.result.AddRange(this.owner.noteUsers.Select(u => new NoteInstruction(u, false)));
                }

                if (stepTicks - gateTicks > 0)
                {
                    this.result.Add(new WaitInstruction(stepTicks - gateTicks));
                }

                this.slur = visitee.Slur;
            }
예제 #2
0
 public virtual void Visit(ToneCommand visitee)
 {
 }