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; } }
List <float> VST_GET_PARAM(int vstHandle) { List <float> rezparam = new List <float>(); try { int vstParams = Un4seen.Bass.AddOn.Vst.BassVst.BASS_VST_GetParamCount(vstHandle); //int vstParams = ManagedBass.Vst.BassVst.GetParamCount(vstHandle); // create a paramInfo object BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); // BassVstParamInfo paramInfo = new BassVstParamInfo(); for (int i = 0; i < vstParams; i++) { // get the info about the parameter float paramValue = Un4seen.Bass.AddOn.Vst.BassVst.BASS_VST_GetParam(vstHandle, i); // float paramValue = ManagedBass.Vst.BassVst.GetParam(vstHandle, i); // and get further info about the parameter Un4seen.Bass.AddOn.Vst.BassVst.BASS_VST_GetParamInfo(vstHandle, i, paramInfo); // ManagedBass.Vst.BassVst.GetParamInfo(vstHandle, i, out paramInfo); rezparam.Add(paramValue); // Trace.WriteLine("GETparam: " + paramInfo.ToString() + " = " + paramValue.ToString()); } } catch (Exception ex) { System.Windows.MessageBox.Show("vst get " + ex.Message); } return(rezparam); }
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; } }
List <float> VST_GET_PARAM(int vstHandle) { List <float> rez = new List <float>(); try { int vstParams = BassVst.BASS_VST_GetParamCount(vstHandle); // create a paramInfo object BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); for (int i = 0; i < vstParams; i++) { // get the info about the parameter float paramValue = BassVst.BASS_VST_GetParam(vstHandle, i); // and get further info about the parameter BassVst.BASS_VST_GetParamInfo(vstHandle, i, paramInfo); rez.Add(paramValue); Trace.WriteLine("GETparam: " + paramInfo.ToString() + " = " + paramValue.ToString()); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } return(rez); }
/// <summary> /// This routine is called, whenever a change is done in the VST Editor /// </summary> /// <param name="vstEditor"></param> /// <param name="action"></param> /// <param name="param1"></param> /// <param name="param2"></param> /// <param name="user"></param> /// <returns></returns> private int vstEditorCallBack(int vstEditor, BASSVSTAction action, int param1, int param2, IntPtr user) { switch (action) { case BASSVSTAction.BASS_VST_PARAM_CHANGED: // Some slider has been changed in the editor BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); for (int i = BassVst.BASS_VST_GetParamCount(vstEditor) - 1; i >= 0; i--) { BassVst.BASS_VST_SetParam(_vstHandle, i, BassVst.BASS_VST_GetParam(vstEditor, i)); BassVst.BASS_VST_GetParamInfo(_vstHandle, i, paramInfo); } break; case BASSVSTAction.BASS_VST_EDITOR_RESIZED: // the editor window requests a new size, break; case BASSVSTAction.BASS_VST_AUDIO_MASTER: break; } return(0); }
/// <summary> /// Save Effects Settings /// </summary> public override void SaveSettings() { Settings.Instance.MusicDirectory = _initialMusicDirectory; // Settings for BASS DSP/FX Settings.Instance.BassEffects.Clear(); BassEffect basseffect; // Gain if (textBoxGainDBValue.Text != "0") { basseffect = new BassEffect(); basseffect.EffectName = "Gain"; basseffect.Parameter.Add(new BassEffectParm("Gain_dbV", textBoxGainDBValue.Text)); Settings.Instance.BassEffects.Add(basseffect); } // Dynamic Amplification if (checkBoxDAmp.Checked) { basseffect = new BassEffect(); basseffect.EffectName = "DynAmp"; basseffect.Parameter.Add(new BassEffectParm("Preset", comboBoxDynamicAmplification.SelectedIndex.ToString())); Settings.Instance.BassEffects.Add(basseffect); } // Compressor if (checkBoxCompressor.Checked) { basseffect = new BassEffect(); basseffect.EffectName = "Compressor"; basseffect.Parameter.Add(new BassEffectParm("Threshold", trackBarCompressor.Value.ToString())); Settings.Instance.BassEffects.Add(basseffect); } // Settings for VST Plugings Settings.Instance.VSTPlugins.Clear(); VSTPlugin vstplugin; foreach (string plugindll in _vstHandles.Keys) { vstplugin = new VSTPlugin(); vstplugin.PluginDll = plugindll; _vstHandle = _vstHandles[plugindll]; BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); for (int i = BassVst.BASS_VST_GetParamCount(_vstHandle) - 1; i >= 0; i--) { BassVst.BASS_VST_GetParamInfo(_vstHandle, i, paramInfo); float value = BassVst.BASS_VST_GetParam(_vstHandle, i); vstplugin.Parameter.Add(new VSTPluginParm(paramInfo.name, i, value.ToString())); } Settings.Instance.VSTPlugins.Add(vstplugin); } // Settings for WinAmpPlugins WinAmpPlugin winampplugin; // Clear all settings first Settings.Instance.WinAmpPlugins.Clear(); foreach (DSPPluginInfo pluginInfo in listBoxSelectedPlugins.Items) { if (pluginInfo.DSPPluginType == DSPPluginInfo.PluginType.Winamp) { winampplugin = new WinAmpPlugin(); winampplugin.PluginDll = pluginInfo.FilePath; Settings.Instance.WinAmpPlugins.Add(winampplugin); } } Settings.SaveSettings(); }
/// <summary> /// This routine is called, whenever a change is done in the VST Editor /// </summary> /// <param name="vstEditor"></param> /// <param name="action"></param> /// <param name="param1"></param> /// <param name="param2"></param> /// <param name="user"></param> /// <returns></returns> private int vstEditorCallBack(int vstEditor, BASSVSTAction action, int param1, int param2, IntPtr user) { switch (action) { case BASSVSTAction.BASS_VST_PARAM_CHANGED: // Some slider has been changed in the editor BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); for (int i = BassVst.BASS_VST_GetParamCount(vstEditor) - 1; i >= 0; i--) { BassVst.BASS_VST_SetParam(_vstHandle, i, BassVst.BASS_VST_GetParam(vstEditor, i)); BassVst.BASS_VST_GetParamInfo(_vstHandle, i, paramInfo); } break; case BASSVSTAction.BASS_VST_EDITOR_RESIZED: // the editor window requests a new size, break; case BASSVSTAction.BASS_VST_AUDIO_MASTER: break; } return 0; }
private StreamHandle LoadVstPlugin(string dllName) { StreamHandle vstStream = (StreamHandle)BassVst.BASS_VST_ChannelSetDSP( 0, Path.Combine(System.Environment.CurrentDirectory.ToString(), dllName), BASSVSTDsp.BASS_VST_DEFAULT, 0); CheckError(Bass.BASS_ErrorGetCode() == BASSError.BASS_OK); int paramCount = BassVst.BASS_VST_GetParamCount((int)vstStream); BASS_VST_PARAM_INFO[] paramInfos = new BASS_VST_PARAM_INFO[paramCount]; for (int paramIndex = 0; paramIndex < paramCount; paramIndex++) { paramInfos[paramIndex] = BassVst.BASS_VST_GetParamInfo((int)vstStream, paramIndex); } /* BASS_VST_INFO vstInfo = new BASS_VST_INFO(); if (BassVst.BASS_VST_GetInfo((int)vstStream, vstInfo) && vstInfo.hasEditor) { // create a new System.Windows.Forms.Form Form f = new Form(); f.Width = vstInfo.editorWidth + 4; f.Height = vstInfo.editorHeight + 34; f.Closing += (sender, e) => f_Closing(sender, e, vstStream); f.Text = vstInfo.effectName; f.Show(); BassVst.BASS_VST_EmbedEditor((int)vstStream, f.Handle); } */ return vstStream; }
/// <summary> /// Save Effects Settings /// </summary> public override void SaveSettings() { Settings.Instance.MusicDirectory = _initialMusicDirectory; // Settings for BASS DSP/FX Settings.Instance.BassEffects.Clear(); BassEffect basseffect; // Gain if (textBoxGainDBValue.Text != "0") { basseffect = new BassEffect(); basseffect.EffectName = "Gain"; basseffect.Parameter.Add(new BassEffectParm("Gain_dbV", textBoxGainDBValue.Text)); Settings.Instance.BassEffects.Add(basseffect); } // Dynamic Amplification if (checkBoxDAmp.Checked) { basseffect = new BassEffect(); basseffect.EffectName = "DynAmp"; basseffect.Parameter.Add(new BassEffectParm("Preset", comboBoxDynamicAmplification.SelectedIndex.ToString())); Settings.Instance.BassEffects.Add(basseffect); } // Compressor if (checkBoxCompressor.Checked) { basseffect = new BassEffect(); basseffect.EffectName = "Compressor"; basseffect.Parameter.Add(new BassEffectParm("Threshold", trackBarCompressor.Value.ToString())); Settings.Instance.BassEffects.Add(basseffect); } // Settings for VST Plugings Settings.Instance.VSTPlugins.Clear(); VSTPlugin vstplugin; foreach (string plugindll in _vstHandles.Keys) { vstplugin = new VSTPlugin(); vstplugin.PluginDll = plugindll; _vstHandle = _vstHandles[plugindll]; BASS_VST_PARAM_INFO paramInfo = new BASS_VST_PARAM_INFO(); for (int i = BassVst.BASS_VST_GetParamCount(_vstHandle) - 1; i >= 0; i--) { BassVst.BASS_VST_GetParamInfo(_vstHandle, i, paramInfo); float value = BassVst.BASS_VST_GetParam(_vstHandle, i); vstplugin.Parameter.Add(new VSTPluginParm(paramInfo.name, i, value.ToString())); } Settings.Instance.VSTPlugins.Add(vstplugin); } // Settings for WinAmpPlugins WinAmpPlugin winampplugin; // Clear all settings first Settings.Instance.WinAmpPlugins.Clear(); foreach (DSPPluginInfo pluginInfo in listBoxSelectedPlugins.Items) { if (pluginInfo.DSPPluginType == DSPPluginInfo.PluginType.Winamp) { winampplugin = new WinAmpPlugin(); winampplugin.PluginDll = pluginInfo.FilePath; Settings.Instance.WinAmpPlugins.Add(winampplugin); } } Settings.SaveSettings(); }