From de68121d79222012f7dd35e2b14498dc97696ca1 Mon Sep 17 00:00:00 2001 From: lllucius Date: Tue, 5 Aug 2014 05:35:57 +0000 Subject: [PATCH] This fixes bug #740 and another crash. I can't believe two things... I can't believe I didn't test the textual display! I'm really ashamed about that. And I can't believe that we've never had anyone report a crash when attempting to using the textual display with plugins that do not supply textual parameters. Some examples are the ones from BBE Sound. I went back to Audacity 2.0 and they would crash there as well. I'd wager they probably always caused Audacity to crash. Not much can be done except to fall back to the graphical display. --- src/effects/VST/VSTEffect.cpp | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 5f9d52ae2..cfa53b664 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -1352,6 +1352,12 @@ VSTEffectDialog::VSTEffectDialog(wxWindow *parent, mGui = (gPrefs->Read(wxT("/VST/GUI"), (long) true) != 0) && mAEffect->flags & effFlagsHasEditor; + // Must use the GUI editor if parameters aren't provided + if (mAEffect->numParams == 0 && mAEffect->flags & effFlagsHasEditor) + { + mGui = true; + } + #if defined(__WXGTK__) // Let the user know that a GUI interface is not supported in wxGTK if (mGui) { @@ -2801,6 +2807,22 @@ bool VSTEffect::PromptUser() { mProcessLevel = 1; // in GUI thread + // I can't believe we haven't run into this before, but a terrible assumption has + // been made all along...effects do NOT have to provide textual parameters. Examples + // of effects that do not support parameters are some from BBE Sound. These effects + // are NOT broken. They just weren't written to support textual parameters. + long gui = (gPrefs->Read(wxT("/VST/GUI"), (long) true) != 0); + if (!gui && mAEffect->numParams == 0) + { +#if defined(__WXGTK__) + wxMessageBox(_("This effect does not support a textual interface. At this time, you may not use this effect on Linux."), + _("VST Effect")); +#else + wxMessageBox(_("This effect does not support a textual interface. Falling back to graphical display."), + _("VST Effect")); +#endif + } + mDlg = new VSTEffectDialog(mParent, mName, this, mAEffect); mDlg->CentreOnParent(); mDlg->ShowModal(); @@ -3584,12 +3606,11 @@ int VSTEffect::GetString(wxString & outstr, int opcode, int index) memset(buf, 0, sizeof(buf)); - int ret = callDispatcher(opcode, index, 0, buf, 0.0); - if (ret) { - outstr = LAT1CTOWX(buf); - } + callDispatcher(opcode, index, 0, buf, 0.0); - return ret; + outstr = LAT1CTOWX(buf); + + return 0; } wxString VSTEffect::GetString(int opcode, int index)