private void UI_Chanvis_Load(object sender, EventArgs e) { discard_events = false; this.Icon = Program.icon; var center = new Point( this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2); var x = 17; Vu = new NPatch.VolumeSlider[src.wf.Channels]; gVu = new Verter[Vu.Length]; for (var a = 0; a < gVu.Length; a++) { var c = new Verter(); c.Tag = a; c.A_GRAD_1 = System.Drawing.Color.FromArgb(220, 0, 255); c.A_GRAD_2 = System.Drawing.Color.Blue; c.title = "Channel " + (a + 1); c.level = 255; c.enabled = chans.Contains(a); c.valueChanged += c_valueChanged; if (!src.isPlay) { c.disableOutput(); } Vu[a] = new NPatch.VolumeSlider(); c.giSlider.src = Vu[a]; Vu[a].enVU = true; this.Controls.Add(c); c.Location = new Point(x, -13); x += c.Width + 16; gVu[a] = c; } x += 17; if (x > this.Width) { this.Width = x; } panel1.BringToFront(); this.Location = new Point( center.X - this.Width / 2, center.Y - this.Height / 2); feed = null; outDev = -1; chdev(0); }
void chdev(int steps) { gPreviewOn.Enabled = false; gDevSub.Enabled = false; gDevAdd.Enabled = false; Application.DoEvents(); outDev += steps; if (outDev < -1) { outDev = WaveOut.DeviceCount - 1; } if (outDev >= WaveOut.DeviceCount) { outDev = -1; } gNDev.Text = outDev == -1 ? "windows-default" : "output " + (outDev + 1); if (feed != null) { feed.Dispose(); } var chans = new List <int>(); for (int a = 0; a < gVu.Length; a++) { if (gVu[a].enabled) { chans.Add(a); } } this.chans = chans.ToArray(); feed = new Testfeed(src, this.chans, Vu, gPreviewOn.Checked ? outDev : -2); gPreviewOn.Enabled = true; gDevSub.Enabled = true; gDevAdd.Enabled = true; if (!feed.ok) { this.Close(); } }