public void Reset() { Loop = -1; _volume = 100; Channels = new Channel[16]; _tonequeue.Clear(); _rpns = new ControlEvent[4]; BTone = new Tone[16]; Panic(); Tones = new Dictionary<int, Tone>[16]; LastTone = new Tone[16]; for (var i = 0; i < 16; i++) { Tones[i] = new Dictionary<int, Tone>(); if (i != 10) Channels[i] = new Channel(0, false, 64, 100, 127, 0, 0, new Rpn(0), new Rpn(0), new Rpn(2)); else Channels[i] = new Channel(0, true, 64, 100, 127, 0, 0, new Rpn(0), new Rpn(0), new Rpn(2)); } }
private void DrawChannels(int x, int y, Channel ch, Graphics g, int chcnt) { //g.DrawRectangle(Pens.Black, x, y, 32, 126); g.DrawString("V", new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x + 1, y + 2); g.DrawRectangle(Pens.Black, x + 2, y + 12, 6, 64); g.DrawString("E", new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x + 7, y + 2); g.DrawRectangle(Pens.Black, x + 8, y + 12, 6, 64); g.DrawString("N", new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x + 13, y + 2); g.DrawRectangle(Pens.Black, x + 14, y + 12, 6, 64); g.DrawString("O", new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x + 19, y + 2); g.DrawRectangle(Pens.Black, x + 20, y + 12, 10, 64); g.DrawRectangle(Pens.Black, x + 2, y + 78, 28, 8); g.DrawRectangle(Pens.Black, x + 2, y + 88, 28, 8); g.DrawString(string.Format("{0, 5}", ch.Inst), new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x, y + 98); g.FillRectangle(Brushes.Lime, x + 3, y + 13 + (64 - 64 * (ch.Volume / 127f)), 5, 64 * (ch.Volume / 127f) - 1); g.FillRectangle(Brushes.Lime, x + 9, y + 13 + (64 - 64 * (ch.Expression / 127f)), 5, 64 * (ch.Expression / 127f) - 1); g.FillRectangle(Brushes.Lime, GetRectBy4Point(x + 16, y + 79, (int) (x + 3 + ch.Panpot * (26 / 127f)), y + 85)); g.FillRectangle(Brushes.Lime, GetRectBy4Point(x + 16, y + 89, (int) (x + 16 + ch.Pitchbend * (13 / 8192f)), y + 95)); for (var i = y + 14; i < y + 14 + 62; i += 2) { g.DrawLine(Pens.Black, x + 3, i, x + 7, i); g.DrawLine(Pens.Black, x + 9, i, x + 13, i); } Tone lt; if (_seq.Sm.LastTone[chcnt] != null) { lt = (Tone) _seq.Sm.LastTone[chcnt].Clone(); var a = lt.OutVolume * (ch.Volume / 127f) * (ch.Expression / 127f) * (lt.Velocity / 127f) / 255f; g.FillRectangle(Brushes.Lime, x + 15, y + 13 + (64 - 64 * (lt.OutVolume / 255f)), 5, 64 * (lt.OutVolume / 255f) - 1); g.FillRectangle(Brushes.Lime, x + 21, y + 13 + (64 - 64 * a), 9, 64 * a - 1); g.DrawString( string.Format("{0, 5}", (int) (lt.Freq * Math.Pow(2, ch.Pitchbend / 8192.0 * (ch.BendRange.Data / 12.0)) * Math.Pow(2, ch.Tweak.Data / 8192f * (2 / 12f)) * Math.Pow(2, ch.NoteShift.Data / 12f))), new Font(FontFamily.GenericMonospace, 7), Brushes.Black, x + 1, y + 108); } for (var i = y + 14; i < y + 14 + 62; i += 2) { g.DrawLine(Pens.Black, x + 15, i, x + 19, i); g.DrawLine(Pens.Black, x + 21, i, x + 30, i); } //(int)(tone.Value.OutVolume * (channels[i].volume / 127.0) * (channels[i].expression / 127.0) * (tone.Value.Velocity / 127.0)) }