//- plugin management ------------------------------------------------- public void loadPlugin() { String pluginPath = ""; #if (DEBUG) //useful for testing, don't have to go through the FileOPen dialog over & over string[] vstlist = File.ReadAllLines("vst.lst"); pluginPath = vstlist[vstnum++]; if (vstnum >= vstlist.Length) { vstnum = 0; //wrap it around } #else loadPluginDialog.Title = "load a VST"; loadPluginDialog.InitialDirectory = curPluginPath; loadPluginDialog.Filter = "VST plugins (*.dll)|*.dll|All files (*.*)|*.*"; loadPluginDialog.ShowDialog(); pluginPath = loadPluginDialog.FileName; if (pluginPath.Length == 0) { return; } curPluginPath = Path.GetDirectoryName(pluginPath); #endif VSTPanel panel = currentRig.addPanel(pluginPath); if (panel == null) { MessageBox.Show("failed to load the plugin file: " + pluginPath, "Plugin Load Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//- panel management ---------------------------------------------------------- public void addPanel(VSTPanel panel) { panels.Add(panel); panelSpace.Size = new Size(VSTPanel.PANELWIDTH, VSTPanel.PANELHEIGHT * panels.Count); panel.Location = new Point(0, VSTPanel.PANELHEIGHT * (panels.Count - 1)); panelSpace.Controls.Add(panel); updateScrollBar(); }
public PluginInfoWnd(VSTPanel _panel) { InitializeComponent(); this.BackColor = Color.FromArgb(0x3f, 0xff, 0x00); panel = _panel; plugin = panel.plugin; //flags String flags = ""; if ((plugin.flags & (1 << 0)) != 0) { flags += " Has editor\n"; } if ((plugin.flags & (1 << 4)) != 0) { flags += " Supports replacing processing\n"; } if ((plugin.flags & (1 << 5)) != 0) { flags += " Program data is handled in chunks\n"; } if ((plugin.flags & (1 << 8)) != 0) { flags += " Is a synth\n"; } if ((plugin.flags & (1 << 9)) != 0) { flags += " Does not produce sound when input is silent\n"; } if ((plugin.flags & (1 << 12)) != 0) { flags += " Supports double precision processing\n"; } //unique ID byte[] idbytes = BitConverter.GetBytes(plugin.uniqueID); String idstr = System.Text.Encoding.ASCII.GetString(idbytes); char[] idchars = idstr.ToCharArray(); Array.Reverse(idchars); idstr = new String(idchars); String infotext = plugin.name + "\n" + plugin.vendor + "\n\n" + //plugin.version + "\n" + plugin.numPrograms + " programs\n" + plugin.numParams + " parameters\n" + plugin.numInputs + " inputs\n" + plugin.numOutputs + " outputs\n\n" + "Flags : 0x" + plugin.flags.ToString("X4") + "\n" + flags + "Unique ID : " + idstr + "\n"; lblPlugInfo.Text = infotext; }
public PluginParamWnd(VSTPanel _panel) { InitializeComponent(); panel = _panel; parameters = panel.plugin.parameters; int paramcount = parameters.Length; paramNames = new Label[paramcount]; paramValues = new Label[paramcount]; paramsliders = new HScrollBar[paramcount]; for (int i = 0; i < paramcount; i++) { VSTParam param = parameters[i]; Label paramName = new Label(); paramName.Text = param.name; paramName.AutoSize = true; paramName.Location = new Point(10, i * PARAMVSPACE + 10); paramNames[i] = paramName; pnlParams.Controls.Add(paramName); } for (int i = 0; i < paramcount; i++) { VSTParam param = parameters[i]; Label paramValue = new Label(); paramValue.Text = param.value.ToString("F4"); paramValue.AutoSize = true; paramValue.Location = new Point(180, i * PARAMVSPACE + 10); paramValues[i] = paramValue; pnlParams.Controls.Add(paramValue); HScrollBar paramSlider = new HScrollBar(); paramSlider.Minimum = 0; paramSlider.Maximum = 10039; paramSlider.Tag = i; paramSlider.SmallChange = 1; paramSlider.LargeChange = 10000 / 250; paramSlider.Value = (int)(param.value * 10000); paramSlider.Location = new Point(230, i * PARAMVSPACE + 10); paramSlider.Width = 250; paramSlider.ValueChanged += new EventHandler(paramSliderValueChanged); paramsliders[i] = paramSlider; pnlParams.Controls.Add(paramSlider); } pnlParams.Height = 500; Label gutter = new Label(); gutter.Text = ""; gutter.Height = 10; gutter.Location = new Point(10, paramcount * PARAMVSPACE); pnlParams.Controls.Add(gutter); }
public void removePanel(VSTPanel panel) { panelSpace.Controls.Remove(panel); panels.Remove(panel); panelSpace.Size = new Size(VSTPanel.PANELWIDTH, VSTPanel.PANELHEIGHT * panels.Count); for (int i = 0; i < panels.Count; i++) { panels[i].plugNum = i; panels[i].Location = new Point(0, VSTPanel.PANELHEIGHT * i); } updateScrollBar(); Invalidate(); }
//cons public PluginSettingsWnd(VSTPanel _panel) { InitializeComponent(); panel = _panel; plugin = panel.plugin; waveDevices = panel.host.waveDevices; midiDevices = panel.midiDevices; cbxAudioIn.DataSource = waveDevices.getInDevNameList(); cbxAudioOut.DataSource = waveDevices.getOutDevNameList(); cbxMidiIn.DataSource = midiDevices.getInDevNameList(); cbxMidiIn.SelectedIndex = cbxMidiIn.FindString((panel.midiInDevice != null) ? panel.midiInDevice.devName : "no input"); cbxMidiOut.DataSource = midiDevices.getOutDevNameList(); }
public PanelMidiOut(VSTPanel _panel) : base(_panel.plugName) { panel = _panel; }