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; } }
/// <summary> /// Loads a VST plug-in and applies it to the mixer /// </summary> /// <param name="location">The file location of the VST DLL</param> /// <param name="priority">The priority.</param> /// <returns>The VST plug-in</returns> private VstPlugin LoadAndApplyVstPlugin(string location, int priority) { if (location == "") { return(null); } if (!File.Exists(location)) { return(null); } var plugin = new VstPlugin { Id = BassVst.BASS_VST_ChannelSetDSP(ChannelId, location, BASSVSTDsp.BASS_VST_DEFAULT, priority) }; if (plugin.Id == 0) { throw new Exception("Cannot load plug-in " + Path.GetFileNameWithoutExtension(location)); } var info = BassVst.BASS_VST_GetInfo(plugin.Id); if (info != null) { plugin.Name = info.effectName; plugin.EditorWidth = info.editorWidth; plugin.EditorHeight = info.editorHeight; } else { var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(location); if (fileNameWithoutExtension != null) { plugin.Name = StringHelper.TitleCase(fileNameWithoutExtension.Replace("_", " ")); } } if (plugin.EditorWidth == 0) { plugin.EditorWidth = 400; } if (plugin.EditorHeight == 0) { plugin.EditorHeight = 600; } plugin.Location = location; LoadPluginParameters(plugin); SetPluginBpm(plugin); return(plugin); }
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> /// 设置VST信道,启动VST插件 /// </summary> /// <param name="stream">音频流句柄</param> public void StartVST(int stream) { this.stream = stream; //先释放原来的VST BassVst.BASS_VST_ChannelFree(vstHandle); BassVst.BASS_VST_ChannelFree(vstDummy); vstHandle = BassVst.BASS_VST_ChannelSetDSP(stream, fileName, BASSVSTDsp.BASS_VST_DEFAULT, 1); vstDummy = BassVst.BASS_VST_ChannelSetDSP(0, fileName, BASSVSTDsp.BASS_VST_DEFAULT, 1); //设置回调函数 myVstProc = new VSTPROC(VSTEditorCallback); BassVst.BASS_VST_SetCallback(vstDummy, myVstProc, IntPtr.Zero); BassVst.BASS_VST_GetInfo(vstDummy, vstInfo); Text = vstInfo.effectName; isActive = true; BassVst.BASS_VST_EmbedEditor(vstDummy, this.Handle); Width = vstInfo.editorWidth + 10; Height = vstInfo.editorHeight + 35; }
public static void BASSInitVSTiIfNeeded(Boolean PreviewMode) { try { if (MainWindow.VSTs.VSTInfo[0].isInstrument) { MainWindow.VSTs._VSTiHandle = BassVst.BASS_VST_ChannelCreate((MainWindow.KMCStatus.RenderingMode ? Properties.Settings.Default.AudioFreq : MainWindow.KMCGlobals.RealTimeFreq), 2, MainWindow.VSTs.VSTDLLs[0], BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | (PreviewMode ? 0 : BASSFlag.BASS_MIDI_SINCINTER)); BASSCheckError(); MainWindow.KMCGlobals._plm = new Un4seen.Bass.Misc.DSP_PeakLevelMeter(MainWindow.VSTs._VSTiHandle, 0); MainWindow.KMCGlobals._plm.CalcRMS = true; if (BassVst.BASS_VST_GetInfo(MainWindow.VSTs._VSTiHandle, MainWindow.VSTs.VSTInfo[0]) && MainWindow.VSTs.VSTInfo[0].hasEditor) { BASSVSTShowDialog(true, MainWindow.KMCGlobals._recHandle, MainWindow.VSTs._VSTiHandle, MainWindow.VSTs.VSTInfo[0]); BASSCheckError(); } } } 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 LoadVST(ref String VSTDLL, ref String VSTDLLDesc, ref Label Desc, ref Button Unload, ref 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(Languages.Parse("LegalWarningVSTi"), String.Format("{0} {1} - {2}", Program.Who, Program.Title, Languages.Parse("Warning")), MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dialogResult == DialogResult.Yes) { Properties.Settings.Default.VSTiDisclaimer = false; Properties.Settings.Default.Save(); status = 2; MessageBox.Show(Languages.Parse("VSTiModeOnLegal"), String.Format("{0} {1} - {2}", Program.Who, Program.Title, Languages.Parse("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(Languages.Parse("VSTiModeOn"), String.Format("{0} {1} - {2}", Program.Who, Program.Title, Languages.Parse("Warning")), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { status = 0; } } InitStartDirectory(); if (VSTImportDialog.ShowDialog() == DialogResult.OK) { if (status == 1) { VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = String.Format("{0} - ({1})", VSTImportDialog.FileName, Languages.Parse("NotVerified")); Desc.Text = String.Format("{0} - ({1})", VSTImportDialog.FileName, Languages.Parse("NotVerified")); Bass.BASS_Free(); Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else if (status == 2) { 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); MainWindow.VSTs.VSTInfo[NumVST - 1] = new BASS_VST_INFO(); bool Success = BassVst.BASS_VST_GetInfo(VSTiTester, MainWindow.VSTs.VSTInfo[NumVST - 1]); Bass.BASS_Free(); if (Success) { String Lab = String.Format(Languages.Parse("VSTNameAndVersion"), MainWindow.VSTs.VSTInfo[NumVST - 1].productName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorVersion); VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = Lab; Desc.Text = Lab; Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else { MessageBox.Show(String.Format(Languages.Parse("InvalidVSTLoaded"), Path.GetFileNameWithoutExtension(VSTImportDialog.FileName), bitreq, bitnow), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } } 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, MainWindow.VSTs.VSTInfo[NumVST - 1]); if (Success) { VSTDLL = VSTImportDialog.FileName; VSTDLLDesc = String.Format(Languages.Parse("VSTNameAndVersion"), MainWindow.VSTs.VSTInfo[NumVST - 1].productName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorVersion); Desc.Text = String.Format(Languages.Parse("VSTNameAndVersion"), MainWindow.VSTs.VSTInfo[NumVST - 1].productName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorName, MainWindow.VSTs.VSTInfo[NumVST - 1].vendorVersion); Bass.BASS_Free(); Unload.Enabled = true; Load.Enabled = false; SaveDirectory(VSTImportDialog.FileName); } else { MessageBox.Show(String.Format(Languages.Parse("InvalidVSTLoaded"), 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(Languages.Parse("Error"), ex.ToString(), 0, 1); errordialog.ShowDialog(); } }
/// <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"); } }