public void LoadChannelStrips(Preferences form, Panel prefsPanel, int width = 0, int height = 0) { _paramInfo = new BASS_VST_PARAM_INFO(); int c = BassVst.BASS_VST_GetParamCount(VstEffectHandle); for (int i = 0; i < c; i++) { // get the info about the parameter _paramValue = BassVst.BASS_VST_GetParam(VstEffectHandle, i); BassVst.BASS_VST_GetParamInfo(VstEffectHandle, i, _paramInfo); _paramValue = BassVst.BASS_VST_GetParam(VstEffectHandle, i); Console.WriteLine(_paramInfo.ToString() + " : " + _paramValue.ToString()); } // show the embedded editor _vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(VstEffectHandle, _vstInfo) && _vstInfo.hasEditor) { form.Closing += new CancelEventHandler(f_Closing); //form.Text = _vstInfo.effectName + " " + Effects.GetorSetFx; BassVst.BASS_VST_EmbedEditor(VstEffectHandle, prefsPanel.Handle); _vstEffectHandle = VstEffectHandle; } }
public void Show(int width = 0, int height = 0) { // if (_vstEffectHandle != 0) // { // return; // } _paramInfo = new BASS_VST_PARAM_INFO(); int c = BassVst.BASS_VST_GetParamCount(VstEffectHandle); for (int i = 0; i < c; i++) { // get the info about the parameter _paramValue = BassVst.BASS_VST_GetParam(VstEffectHandle, i); BassVst.BASS_VST_GetParamInfo(VstEffectHandle, i, _paramInfo); _paramValue = BassVst.BASS_VST_GetParam(VstEffectHandle, i); Console.WriteLine(_paramInfo.ToString() + " : " + _paramValue.ToString()); } // show the embedded editor _vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(VstEffectHandle, _vstInfo) && _vstInfo.hasEditor) { // create a new System.Windows.Forms.Form Form f = new Form(); if (width != 0 && height != 0) { f.ClientSize = new Size(width, height); } else { f.ClientSize = new Size(_vstInfo.editorWidth, _vstInfo.editorHeight); } f.MaximizeBox = false; f.MinimizeBox = false; f.FormBorderStyle = FormBorderStyle.FixedSingle; f.Closing += new CancelEventHandler(f_Closing); f.Text = _vstInfo.effectName + " " + Effects.GetorSetFx; f.Show(); BassVst.BASS_VST_EmbedEditor(VstEffectHandle, f.Handle); _vstEffectHandle = VstEffectHandle; } }
/// <summary> /// Retrieving a program name other than the current one enforces to change the current program inernally /// </summary> /// <param name="vstHandle"></param> /// <returns></returns> List <string> VST_GET_AFFECT(int vstHandle) { List <string> spis = null; BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(vstHandle, vstInfo)) { if (vstInfo.aeffect != IntPtr.Zero) { BASS_VST_AEFFECT aeffect = BASS_VST_AEFFECT.FromIntPtr(vstInfo.aeffect); // list all available programs for (int i = 0; i < aeffect.numPrograms; i++) { spis.Add(aeffect.GetProgramName(i)); } } } return(spis); }
public void OPEN_VST(string s) { foreach (var w in work_list_vst) { if (w.wnd != null) { if (w.wnd.IsDisposed) { BassVst.BASS_VST_EmbedEditor(w.handle, IntPtr.Zero); } } } string path = get_path_VST(s); int _hdl = getHAndle(get_nameVTS(path)); if (_hdl < 0) { System.Windows.MessageBox.Show("Ошибка открытия " + s); return; } // show the embedded editor BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(_hdl, vstInfo) && vstInfo.hasEditor) { int id = getID(_hdl); if (work_list_vst[id].wnd != null) { if (!work_list_vst[id].wnd.IsDisposed) { return; } } work_list_vst[id].wnd = new Form(); work_list_vst[id].wnd.Width = vstInfo.editorWidth + 4; work_list_vst[id].wnd.Height = vstInfo.editorHeight + 34; work_list_vst[id].wnd.Closing += new CancelEventHandler(windsp_Closing); work_list_vst[id].wnd.Text = data.name + " " + vstInfo.effectName; work_list_vst[id].wnd.Show(); BassVst.BASS_VST_EmbedEditor(_hdl, work_list_vst[id].wnd.Handle); } }
public static void InitializeDummyVSTs() { try { if (MainWindow.KMCStatus.VSTMode == true) { if (Properties.Settings.Default.LoudMaxEnabled == true && MainWindow.KMCStatus.RenderingMode == true) { BASS_VST_INFO LMInfo = new BASS_VST_INFO(); MainWindow.VSTs._DummyLoudMaxHan = BassVst.BASS_VST_ChannelSetDSP(0, String.Format("{0}\\LoudMax.dll", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)), BASSVSTDsp.BASS_VST_KEEP_CHANS, 0); BassVst.BASS_VST_GetInfo(MainWindow.VSTs._LoudMaxHan, LMInfo); BASSVSTShowDialog(false, 0, MainWindow.VSTs._DummyLoudMaxHan, LMInfo); } for (int i = 0; i <= 7; i++) { if (!MainWindow.VSTs.VSTInfo[i].isInstrument) // VSTi check { MainWindow.VSTs._DummyVSTHandles[i] = BassVst.BASS_VST_ChannelSetDSP(0, MainWindow.VSTs.VSTDLLs[i], BASSVSTDsp.BASS_VST_DEFAULT, 0); if (MainWindow.VSTs._DummyVSTHandles[i] != 0) { int vstParams = BassVst.BASS_VST_GetParamCount(MainWindow.VSTs._DummyVSTHandles[i]); if (BassVst.BASS_VST_GetInfo(MainWindow.VSTs._DummyVSTHandles[i], MainWindow.VSTs.VSTInfo[i]) && MainWindow.VSTs.VSTInfo[i].hasEditor) { BASSVSTShowDialog(false, 0, MainWindow.VSTs._DummyVSTHandles[i], MainWindow.VSTs.VSTInfo[i]); } } } } } } catch (Exception ex) { BASSCloseStreamCrash(ex); } }
/// <summary> /// Open VST Plugin Configuration window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ShowConfigWindow() { DSPPluginInfo pluginInfo = (DSPPluginInfo)listBoxSelectedPlugins.SelectedItem; if (pluginInfo == null) { return; } if (pluginInfo.DSPPluginType == DSPPluginInfo.PluginType.VST) { _vstHandle = _vstHandles[pluginInfo.Name]; BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(_vstHandle, vstInfo) && vstInfo.hasEditor) { // Set a handle to the callback procedure _vstProc = new VSTPROC(vstEditorCallBack); BassVst.BASS_VST_SetCallback(_vstHandle, _vstProc, IntPtr.Zero); // create a new System.Windows.Forms.Form Form f = new MPConfigForm(); f.Width = vstInfo.editorWidth + 4; f.Height = vstInfo.editorHeight + 34; f.Closing += new CancelEventHandler(f_Closing); f.Text = vstInfo.effectName; BassVst.BASS_VST_EmbedEditor(_vstHandle, f.Handle); f.ShowDialog(); } else { MessageBox.Show("Plugin has no Configuration"); } } else { _waDspPlugin = _waDspPlugins[pluginInfo.FilePath]; BassWaDsp.BASS_WADSP_Start(_waDspPlugin, 0, 0); BassWaDsp.BASS_WADSP_Config(_waDspPlugin); } }
/// <summary> /// Play the selected Music File /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btPlay_Click(object sender, EventArgs e) { if (File.Exists(textBoxMusicFile.Text)) { // Init BASS BassAudioEngine bassEngine = BassMusicPlayer.Player; if (bassEngine.BassFreed) { bassEngine.InitBass(); } _stream = Bass.BASS_StreamCreateFile(textBoxMusicFile.Text, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_SAMPLE_SOFTWARE); if (_stream != 0) { // Attach the BASS DSP Effects to the stream if (_gain != null) { _gain.ChannelHandle = _stream; _gain.Start(); } if (checkBoxDAmp.Checked) { _dampHandle = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_BFX_DAMP, _dampPrio); Bass.BASS_FXSetParameters(_dampHandle, _damp); } if (checkBoxCompressor.Checked) { _compHandle = Bass.BASS_ChannelSetFX(_stream, BASSFXType.BASS_FX_BFX_COMPRESSOR, _compPrio); Bass.BASS_FXSetParameters(_compHandle, _comp); } // Attach the plugins to the stream foreach (DSPPluginInfo dsp in listBoxSelectedPlugins.Items) { if (dsp.DSPPluginType == DSPPluginInfo.PluginType.VST) { _vstHandle = BassVst.BASS_VST_ChannelSetDSP(_stream, dsp.FilePath, BASSVSTDsp.BASS_VST_DEFAULT, 1); // Copy the parameters of the old handle int vstold = _vstHandles[dsp.Name]; BassVst.BASS_VST_SetParamCopyParams(vstold, _vstHandle); // Now find out to which stream the old handle was assigned and free it BASS_VST_INFO bassvstinfo = new BASS_VST_INFO(); BassVst.BASS_VST_GetInfo(vstold, bassvstinfo); BassVst.BASS_VST_ChannelRemoveDSP(bassvstinfo.channelHandle, vstold); _vstHandles[dsp.Name] = _vstHandle; } else { _waDspPlugin = _waDspPlugins[dsp.FilePath]; BassWaDsp.BASS_WADSP_Start(_waDspPlugin, 0, 0); BassWaDsp.BASS_WADSP_ChannelSetDSP(_waDspPlugin, _stream, 1); } } btPlay.Enabled = false; btStop.Enabled = true; Bass.BASS_ChannelPlay(_stream, false); } else { MessageBox.Show("Can't play file. Probably not a valid music file"); } } else { MessageBox.Show("File specified does not exist"); } }
private bool InitVSTPlugins() { _VSTHandles.Clear(); _VSTDelayMS = 0; bool result = true; if (!CurrentNeedsPassThrough && _Profile.VSTPlugins.Count > 0) { int delaySamples = 0; foreach (KeyValuePair<string, ConfigProfile.VSTPlugin> plugin in _Profile.VSTPlugins) { Log.Info("Loading VST plugin \"{0}\"...", plugin.Value.DllFile); int handle = BassVst.BASS_VST_ChannelSetDSP(_MixerStream, plugin.Value.DllFile, BASSVSTDsp.BASS_VST_DEFAULT, 1); result = (handle > 0); if (!result) { HandleBassError("BassVst.BASS_VST_ChannelSetDSP"); break; } if (result) { BASS_VST_INFO vstInfo = new BASS_VST_INFO(); BassVst.BASS_VST_GetInfo(handle, vstInfo); delaySamples += vstInfo.initialDelay; Log.Debug("VST plugin info: vendorName={0}, vendorVersion={1}, productName={2}, uniqueID={3}, effectName={4}, effectVersion={5}, effectVstVersion={6}, hostVstVersion={7}, chansIn={8}, chansOut={9}, initialDelay={10}", new object[]{ vstInfo.vendorName, vstInfo.vendorVersion, vstInfo.productName, vstInfo.uniqueID, vstInfo.effectName, vstInfo.effectVersion, vstInfo.effectVstVersion, vstInfo.hostVstVersion, vstInfo.chansIn, vstInfo.chansOut, vstInfo.initialDelay }); _VSTHandles[handle] = vstInfo; foreach (KeyValuePair<int, ConfigProfile.VSTParameter> parameter in plugin.Value.Parameters) { //Log.Debug(" VST parameter: index={0}, name={1}, value={2}", parameter.Value.Index, parameter.Value.Name, parameter.Value.Value); BassVst.BASS_VST_SetParam(handle, parameter.Value.Index, parameter.Value.Value); } } } BASS_CHANNELINFO channelInfo = Bass.BASS_ChannelGetInfo(_MixerStream); _VSTDelayMS = (delaySamples * 1000 / channelInfo.freq); Log.Debug("Total calculated VST latency: {0} ms...", _VSTDelayMS); } return result; }
/// <summary> /// Load Effects Settings /// </summary> public override void LoadSettings() { _initialMusicDirectory = Settings.Instance.MusicDirectory; // BASS DSP/FX foreach (BassEffect basseffect in Settings.Instance.BassEffects) { foreach (BassEffectParm parameter in basseffect.Parameter) { setBassDSP(basseffect.EffectName, parameter.Name, parameter.Value); } } DirectoryInfo di = new DirectoryInfo(pluginPath); FileInfo[] fi = di.GetFiles("*.dll", SearchOption.AllDirectories); foreach (FileInfo vstplugin in fi) { try { BASS_VST_INFO vstInfo = new BASS_VST_INFO(); _vstHandle = BassVst.BASS_VST_ChannelSetDSP(0, vstplugin.FullName, BASSVSTDsp.BASS_VST_DEFAULT, 1); // When Handle > 0 this Vst Plugin is a DSP Plugin if (_vstHandle > 0) { DSPPluginInfo pluginInfo = new DSPPluginInfo(DSPPluginInfo.PluginType.VST, vstplugin.FullName, vstplugin.Name); if (pluginInfo.IsBlackListed) { Log.Info("DSP Plugin {0} may not be used, as it is known for causing problems.", vstplugin.Name); } else { listBoxFoundPlugins.Items.Add(pluginInfo); } } BassVst.BASS_VST_ChannelRemoveDSP(0, _vstHandle); } catch (Exception ex) { Log.Error("Error reading VST Plugin Information: {0}", ex.Message); } } // VST Plugins foreach (VSTPlugin plugins in Settings.Instance.VSTPlugins) { // Get the vst handle and enable it string plugin = String.Format(@"{0}\{1}", pluginPath, plugins.PluginDll); _vstHandle = BassVst.BASS_VST_ChannelSetDSP(0, plugin, BASSVSTDsp.BASS_VST_DEFAULT, 1); if (_vstHandle > 0) { DSPPluginInfo pluginInfo = new DSPPluginInfo(DSPPluginInfo.PluginType.VST, plugin, plugins.PluginDll); listBoxSelectedPlugins.Items.Add(pluginInfo); _vstHandles[plugins.PluginDll] = _vstHandle; // Set all parameters for the plugin foreach (VSTPluginParm paramter in plugins.Parameter) { NumberFormatInfo format = new NumberFormatInfo(); format.NumberDecimalSeparator = "."; try { BassVst.BASS_VST_SetParam(_vstHandle, paramter.Index, float.Parse(paramter.Value)); } catch (Exception) {} } } else { Log.Debug("Couldn't load VST Plugin {0}. Error code: {1}", plugin, Bass.BASS_ErrorGetCode()); } } // Now remove those already selected from the found listbox foreach (VSTPlugin plugins in Settings.Instance.VSTPlugins) { for (int i = 0; i < listBoxFoundPlugins.Items.Count; i++) { DSPPluginInfo dsp = (DSPPluginInfo)listBoxFoundPlugins.Items[i]; if (dsp.DSPPluginType == DSPPluginInfo.PluginType.VST && dsp.Name == plugins.PluginDll) { listBoxFoundPlugins.Items.RemoveAt(i); } } } // WinAmp Plugins // Get the available plugins in the directory and fill the found listbox WINAMP_DSP.FindPlugins(pluginPath); foreach (WINAMP_DSP winampPlugin in WINAMP_DSP.PlugIns) { DSPPluginInfo pluginInfo = new DSPPluginInfo(DSPPluginInfo.PluginType.Winamp, winampPlugin.File, winampPlugin.Description); if (pluginInfo.IsBlackListed) { Log.Info("DSP Plugin {0} may not be used, as it is known for causing problems.", pluginInfo.FilePath); } else { listBoxFoundPlugins.Items.Add(pluginInfo); } } // Now remove those already selected from the found listbox foreach (WinAmpPlugin plugins in Settings.Instance.WinAmpPlugins) { for (int i = 0; i < listBoxFoundPlugins.Items.Count; i++) { DSPPluginInfo dsp = (DSPPluginInfo)listBoxFoundPlugins.Items[i]; if (dsp.DSPPluginType == DSPPluginInfo.PluginType.Winamp && dsp.FilePath == plugins.PluginDll) { listBoxFoundPlugins.Items.RemoveAt(i); _waDspPlugin = BassWaDsp.BASS_WADSP_Load(plugins.PluginDll, 5, 5, 100, 100, null); if (_waDspPlugin > 0) { listBoxSelectedPlugins.Items.Add(dsp); _waDspPlugins[plugins.PluginDll] = _waDspPlugin; break; } else { Log.Debug("Couldn't load WinAmp Plugin {0}. Error code: {1}", plugins.PluginDll, Bass.BASS_ErrorGetCode()); } } } } }
private void BASSVSTShowDialog(int towhichstream, int whichvst, BASS_VST_INFO vstInfo) { Form f = new Form(); f.Width = vstInfo.editorWidth + 4; f.Height = vstInfo.editorHeight + 34; f.FormBorderStyle = FormBorderStyle.FixedDialog; f.Text = res_man.GetString("DSPSettings", cul) + vstInfo.effectName; f.StartPosition = FormStartPosition.CenterScreen; f.MaximizeBox = false; f.MinimizeBox = false; BassVst.BASS_VST_EmbedEditor(whichvst, f.Handle); try { f.ShowDialog(); BassVst.BASS_VST_EmbedEditor(whichvst, IntPtr.Zero); } catch (Exception ex) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendLine("==== Start of Keppy's MIDI Converter Error ===="); sb.AppendLine(ex.ToString()); sb.AppendLine("==== End of Keppy's MIDI Converter Error ===="); System.Threading.Thread thread = new System.Threading.Thread(() => Clipboard.SetText(sb.ToString())); thread.SetApartmentState(System.Threading.ApartmentState.STA); thread.Start(); thread.Join(); MessageBox.Show(String.Format(res_man.GetString("VSTInvalidCallError", cul), vstInfo.effectName, ex.Message.ToString()), "Keppy's MIDI Converter - " + res_man.GetString("VSTInvalidCallTitle", cul), MessageBoxButtons.OK, MessageBoxIcon.Error); BassVst.BASS_VST_EmbedEditor(whichvst, IntPtr.Zero); BassVst.BASS_VST_ChannelRemoveDSP(towhichstream, whichvst); } }
private void BASSVSTInit(int towhichstream) { if (Globals.VSTMode == true) { Globals._VSTHandle = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL, BASSVSTDsp.BASS_VST_DEFAULT, 1); Globals._VSTHandle2 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL2, BASSVSTDsp.BASS_VST_DEFAULT, 2); Globals._VSTHandle3 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL3, BASSVSTDsp.BASS_VST_DEFAULT, 3); Globals._VSTHandle4 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL4, BASSVSTDsp.BASS_VST_DEFAULT, 4); Globals._VSTHandle5 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL5, BASSVSTDsp.BASS_VST_DEFAULT, 5); Globals._VSTHandle6 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL6, BASSVSTDsp.BASS_VST_DEFAULT, 6); Globals._VSTHandle7 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL7, BASSVSTDsp.BASS_VST_DEFAULT, 7); Globals._VSTHandle8 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, Globals.VSTDLL8, BASSVSTDsp.BASS_VST_DEFAULT, 8); BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle2, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle2, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle3, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle3, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle4, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle4, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle5, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle5, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle6, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle6, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle7, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle7, vstInfo); } if (BassVst.BASS_VST_GetInfo(Globals._VSTHandle8, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, Globals._VSTHandle8, vstInfo); } } }
private void BASSVSTInit(int towhichstream) { try { if (KMCGlobals.VSTMode == true) { KMCGlobals._VSTHandle = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL, BASSVSTDsp.BASS_VST_DEFAULT, 1); KMCGlobals._VSTHandle2 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL2, BASSVSTDsp.BASS_VST_DEFAULT, 2); KMCGlobals._VSTHandle3 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL3, BASSVSTDsp.BASS_VST_DEFAULT, 3); KMCGlobals._VSTHandle4 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL4, BASSVSTDsp.BASS_VST_DEFAULT, 4); KMCGlobals._VSTHandle5 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL5, BASSVSTDsp.BASS_VST_DEFAULT, 5); KMCGlobals._VSTHandle6 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL6, BASSVSTDsp.BASS_VST_DEFAULT, 6); KMCGlobals._VSTHandle7 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL7, BASSVSTDsp.BASS_VST_DEFAULT, 7); KMCGlobals._VSTHandle8 = BassVst.BASS_VST_ChannelSetDSP(towhichstream, KMCGlobals.VSTDLL8, BASSVSTDsp.BASS_VST_DEFAULT, 8); if (KMCGlobals.VSTSkipSettings != true) { BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle2, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle2, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle3, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle3, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle4, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle4, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle5, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle5, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle6, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle6, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle7, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle7, vstInfo); } if (BassVst.BASS_VST_GetInfo(KMCGlobals._VSTHandle8, vstInfo) && vstInfo.hasEditor) { BASSVSTShowDialog(towhichstream, KMCGlobals._VSTHandle8, vstInfo); } } } } catch (Exception ex) { BASSCloseStreamCrash(ex); } }
private void LoadVST(ref String VSTDLL, ref String VSTDLLDesc, Label Desc, Button Unload, Button Load, Int32 NumVST) { try { int status = 0; if (ModifierKeys == Keys.Shift) { status = 1; } else if (ModifierKeys == Keys.Control) { if (NumVST == 1) { if (Properties.Settings.Default.VSTiDisclaimer) { DialogResult dialogResult = MessageBox.Show("By clicking 'Yes', you agree not to abuse the 'VST instrument' feature to create, disseminate, or make accessible anything exploiting the copyrighted/protected samples or files included within a VST (\"Visual Studio Technology\" plugin).\n\nSuch resultant files could include (but are not limited to):\nSoundFonts, VSTs, or any other usable tool that commits copyright infringement.\n\nSimply put it, you may not use this tool to commit piracy on a copyrighted/trademarked/protected VST, free or paid, unless you have permission from the developer.\nYou may create audio at will from the VST, but DO NOT use this export feature to extract/\"rip\" samples from the VST.\n\nThe author assumes no legal responsibility from the use of this tool.", "Keppy's MIDI Converter - Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { Properties.Settings.Default.VSTiDisclaimer = false; Properties.Settings.Default.Save(); status = 2; MessageBox.Show("VSTi mode activated.", "Keppy's MIDI Converter - Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (dialogResult == DialogResult.No) { Properties.Settings.Default.VSTiDisclaimer = true; Properties.Settings.Default.Save(); return; } } else { status = 2; MessageBox.Show("VSTi mode activated.", "Keppy's MIDI Converter - Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { status = 0; } } InitStartDirectory(); if (VSTImportDialog.ShowDialog() == DialogResult.OK) { BASS_VST_INFO VSTInfo = new BASS_VST_INFO(); if (status == 1) { VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = VSTImportDialog.FileName + " (Not verified)"; Desc.Text = VSTImportDialog.FileName + " (Not verified)"; Bass.BASS_Free(); Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else if (status == 2) { Un4seen.Bass.Bass.BASS_Init(0, 44100, BASSInit.BASS_DEVICE_NOSPEAKER, IntPtr.Zero); int VSTiTester = BassVst.BASS_VST_ChannelCreate(44100, 2, VSTImportDialog.FileName, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT); MainWindow.KMCGlobals.vstIInfo = new BASS_VST_INFO(); bool Success = BassVst.BASS_VST_GetInfo(VSTiTester, MainWindow.KMCGlobals.vstIInfo); if (Success) { String Lab = String.Format("{0} by {1} (Version number: {2}", MainWindow.KMCGlobals.vstIInfo.productName, MainWindow.KMCGlobals.vstIInfo.vendorName, MainWindow.KMCGlobals.vstIInfo.vendorVersion); VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = MainWindow.KMCGlobals.vstIInfo.productName + " by " + MainWindow.KMCGlobals.vstIInfo.vendorName + " (Version: " + MainWindow.KMCGlobals.vstIInfo.vendorVersion + ")"; Desc.Text = MainWindow.KMCGlobals.vstIInfo.productName + " by " + MainWindow.KMCGlobals.vstIInfo.vendorName + " (Version: " + MainWindow.KMCGlobals.vstIInfo.vendorVersion + ")"; Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); BassVst.BASS_VST_ChannelFree(VSTiTester); Bass.BASS_Free(); } else { MessageBox.Show(String.Format(MainWindow.res_man.GetString("InvalidVSTLoaded", MainWindow.cul), Path.GetFileNameWithoutExtension(VSTImportDialog.FileName), bitreq, bitnow), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); BassVst.BASS_VST_ChannelFree(VSTiTester); Bass.BASS_Free(); } } else { Un4seen.Bass.Bass.BASS_Init(0, 44100, BASSInit.BASS_DEVICE_NOSPEAKER, IntPtr.Zero); int Test = Bass.BASS_StreamCreateDummy(44100, 2, BASSFlag.BASS_STREAM_DECODE, IntPtr.Zero); int VSTTester = BassVst.BASS_VST_ChannelSetDSP(Test, VSTImportDialog.FileName, BASSVSTDsp.BASS_VST_DEFAULT, 1); bool Success = BassVst.BASS_VST_GetInfo(VSTTester, VSTInfo); if (Success) { VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = VSTInfo.productName + " by " + VSTInfo.vendorName + " (Version: " + VSTInfo.vendorVersion + ")"; Desc.Text = VSTInfo.productName + " by " + VSTInfo.vendorName + " (Version: " + VSTInfo.vendorVersion + ")"; Bass.BASS_Free(); Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); BassVst.BASS_VST_ChannelRemoveDSP(Test, VSTTester); Bass.BASS_StreamFree(Test); Bass.BASS_Free(); } else { MessageBox.Show(String.Format(MainWindow.res_man.GetString("InvalidVSTLoaded", MainWindow.cul), Path.GetFileNameWithoutExtension(VSTImportDialog.FileName), bitreq, bitnow), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); BassVst.BASS_VST_ChannelRemoveDSP(Test, VSTTester); Bass.BASS_StreamFree(Test); Bass.BASS_Free(); } } } } catch (Exception ex) { KeppyMIDIConverter.ErrorHandler errordialog = new KeppyMIDIConverter.ErrorHandler(MainWindow.res_man.GetString("Error", MainWindow.cul), ex.ToString(), 0, 1); errordialog.ShowDialog(); } }
public void Evaluate(int SpreadMax) { bool reset = false; #region Reset is handle or fconnected change if (FConnected != this.FPinInHandle.IsConnected) { if (this.FPinInHandle.IsConnected) { reset = true; } else { this.ClearUp(); } this.FConnected = this.FPinInHandle.IsConnected; } #endregion #region Reset if (this.FPinInHandle.PinIsChanged || reset || this.FPinInEnabled.PinIsChanged || this.FPinInFilename.PinIsChanged) { this.ClearUp(); if (this.FPinInHandle.IsConnected) { this.FPinInFilename.GetString(0, out this.FFilename); //Just Update the Handle double dhandle; this.FPinInHandle.GetValue(0, out dhandle); int ihandle = Convert.ToInt32(Math.Round(dhandle)); if (File.Exists(this.FFilename) && this.FManager.Exists(ihandle)) { this.FChannel = this.FManager.GetChannel(ihandle); this.FChannel.OnInit += new EventHandler(FChannel_OnInit); if (this.FChannel.BassHandle.HasValue) { this.AddDSP(); } } else { this.FChannel = null; this.FDSPHandle = 0; } } } #endregion double dshow; this.FPinInShowConfig.GetValue(0, out dshow); if (this.FDSPHandle != 0 && dshow >= 0.5) { BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo(this.FDSPHandle, vstInfo) && vstInfo.hasEditor && !this.FConfigVisible) { // create a new System.Windows.Forms.Form this.FEditor = new Form(); this.FEditor.Width = vstInfo.editorWidth + 4; this.FEditor.Height = vstInfo.editorHeight + 34; this.FEditor.Closing += new CancelEventHandler(f_Closing); this.FEditor.Text = vstInfo.effectName; this.FEditor.Show(); BassVst.BASS_VST_EmbedEditor(this.FDSPHandle, this.FEditor.Handle); this.FConfigVisible = true; } //BassWaDsp.BASS_WADSP_Config(this.FDSPHandle, 0); } }
private void Load_Click(object sender, EventArgs e) { InitStartDirectory(); if (VSTImportDialog.ShowDialog() == DialogResult.OK) { Un4seen.Bass.Bass.BASS_Init(0, 44100, BASSInit.BASS_DEVICE_NOSPEAKER, IntPtr.Zero); int Test = Bass.BASS_StreamCreateDummy(44100, 2, BASSFlag.BASS_STREAM_DECODE, IntPtr.Zero); int VSTTester = BassVst.BASS_VST_ChannelSetDSP(Test, VSTImportDialog.FileName, BASSVSTDsp.BASS_VST_DEFAULT, 1); BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (ModifierKeys == Keys.Shift) { KeppyMIDIConverter.MainWindow.KMCGlobals.VSTDLL = VSTImportDialog.FileName; KeppyMIDIConverter.MainWindow.KMCGlobals.VSTDLLDesc = VSTImportDialog.FileName + " (Not verified)"; label1.Text = VSTImportDialog.FileName + " (Not verified)"; Bass.BASS_Free(); Unload.Enabled = true; Load1.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else { if (BassVst.BASS_VST_GetInfo(VSTTester, vstInfo)) { KeppyMIDIConverter.MainWindow.KMCGlobals.VSTDLL = VSTImportDialog.FileName; KeppyMIDIConverter.MainWindow.KMCGlobals.VSTDLLDesc = vstInfo.productName + " by " + vstInfo.vendorName + " (Version: " + vstInfo.vendorVersion + ")"; label1.Text = vstInfo.productName + " by " + vstInfo.vendorName + " (Version: " + vstInfo.vendorVersion + ")"; Bass.BASS_Free(); Unload.Enabled = true; Load1.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else { Bass.BASS_Free(); MessageBox.Show(String.Format(res_man.GetString("InvalidVSTLoaded", cul), Path.GetFileNameWithoutExtension(VSTImportDialog.FileName), bitreq, bitnow), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } } }
public static void BASSVSTShowDialog(bool vsti, int towhichstream, int whichvst, BASS_VST_INFO vstInfo) { try { if (vstInfo.hasEditor && !MainWindow.KMCGlobals.VSTSkipSettings) { Form f = new Form(); f.Width = vstInfo.editorWidth + 4; f.Height = vstInfo.editorHeight + 34; f.ClientSize = new Size(vstInfo.editorWidth, vstInfo.editorHeight); f.FormBorderStyle = FormBorderStyle.FixedToolWindow; f.StartPosition = FormStartPosition.CenterScreen; f.Text = String.Format("{0} {1}", Languages.Parse("DSPSettings"), vstInfo.effectName); BassVst.BASS_VST_EmbedEditor(whichvst, f.Handle); f.ShowDialog(); BassVst.BASS_VST_EmbedEditor(whichvst, IntPtr.Zero); } } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("==== Start of Keppy's MIDI Converter Error ===="); sb.AppendLine(ex.ToString()); sb.AppendLine("==== End of Keppy's MIDI Converter Error ===="); Thread thread = new Thread(() => Clipboard.SetText(sb.ToString())); thread.SetApartmentState(ApartmentState.STA); thread.Start(); thread.Join(); ErrorHandler errordialog = new ErrorHandler(Languages.Parse("VSTInvalidCallTitle"), Languages.Parse("VSTInvalidCallError"), 0, 0); errordialog.ShowDialog(); if (!vsti) { BassVst.BASS_VST_ChannelRemoveDSP(towhichstream, whichvst); } else { BassVst.BASS_VST_ChannelFree(MainWindow.VSTs._VSTiHandle); } } }