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;
            }
        }
 private void f_Closing(object sender, CancelEventArgs e)
 {
     // unembed the VST editor
     BassVst.BASS_VST_EmbedEditor(VstEffectHandle, IntPtr.Zero);
     VstEffectHandle  = 0;
     _vstEffectHandle = 0;
 }
示例#3
0
        private void Initialize(VstPlugin plugin)
        {
            _plugin = plugin;

            CanClose     = false;
            FormClosing += VSTPluginConfigForm_FormClosing;

            MinimizeBox     = true;
            ShowInTaskbar   = true;
            FormBorderStyle = FormBorderStyle.SizableToolWindow;
            TopMost         = true;

            var borderSize = SystemInformation.BorderSize;

            Width  = plugin.EditorWidth + (borderSize.Width * 2) + 15;
            Height = plugin.EditorHeight + _menuStrip.Height + (borderSize.Height * 2) + 35;

            var icon = ApplicationHelper.GetIcon();

            if (icon != null)
            {
                Icon = icon;
            }

            Text = plugin.Name;


            BassVst.BASS_VST_EmbedEditor(plugin.Id, EditorPanelHandle);
            plugin.Form = this;

            LoadPresets(plugin);
        }
示例#4
0
 private void f_Closing(object sender, CancelEventArgs e)
 {
     BassVst.BASS_VST_EmbedEditor(this.FDSPHandle, IntPtr.Zero);
     this.FConfigVisible = false;
     if (this.FEditor != null)
     {
         this.FEditor.Dispose();
         this.FEditor = null;
     }
 }
        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;
            }
        }
示例#6
0
        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);
            }
        }
示例#7
0
文件: BASSControl.cs 项目: walney/KMC
 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);
         }
     }
 }
示例#8
0
        /// <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);
            }
        }
示例#9
0
        /// <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;
        }
示例#10
0
        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);
            }
        }