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;
            }
        }
示例#2
0
        private static void LoadPluginParameters(VstPlugin plugin)
        {
            plugin.Parameters = new List <VstPlugin.VstPluginParameter>();

            if (plugin.Name.Contains("mania"))
            {
                Console.WriteLine("mani");
            }

            var parameterCount = BassVst.BASS_VST_GetParamCount(plugin.Id);

            for (var i = 0; i < parameterCount; i++)
            {
                var parameterInfo = BassVst.BASS_VST_GetParamInfo(plugin.Id, i);

                var name = parameterInfo.name.Trim();
                if (string.IsNullOrWhiteSpace(name) || name.ToLower().StartsWith("unused"))
                {
                    continue;
                }

                var parameter = new VstPlugin.VstPluginParameter
                {
                    Id   = i,
                    Name = parameterInfo.name
                };

                LoadPresetParameterValues(plugin, parameter);

                plugin.Parameters.Add(parameter);
            }
        }
        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;
            }
        }
示例#4
0
        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);
        }
示例#5
0
        private void mnuParameters_Click(object sender, EventArgs e)
        {
            var builder = new StringBuilder();

            builder.AppendLine(_plugin.Name);

            foreach (var parameter in _plugin.Parameters)
            {
                var info  = BassVst.BASS_VST_GetParamInfo(_plugin.Id, parameter.Id);
                var value = BassVst.BASS_VST_GetParam(_plugin.Id, parameter.Id);

                if (info == null)
                {
                    continue;
                }

                var line = $"{info.name}  {info.display}  {value}  {info.unit}";
                builder.AppendLine(line);
            }

            MessageBoxHelper.Show(builder.ToString());
        }
示例#6
0
        /// <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);
        }
示例#7
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();
        }