From 9ce427f283a9e63040b73cba9cee068154a20974 Mon Sep 17 00:00:00 2001 From: lllucius Date: Sun, 7 Dec 2014 19:27:06 +0000 Subject: [PATCH] Fixes StereoToMono effect The problem is that lookup of effects is based on their ID and legacy effects didn't play well in this scheme, so I've added a workaround for now. This will go away when I get all of the effects converted. And removes some debugging. --- src/effects/Effect.cpp | 25 ++++++++++++++++++++++++- src/effects/EffectManager.cpp | 2 -- src/effects/StereoToMono.h | 5 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 9a5c35fb5..4c3eb9d88 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -175,7 +175,30 @@ wxString Effect::GetName() return mClient->GetName(); } - return GetEffectIdentifier(); + // Break up identifier into words based on caps + // + // EffectManager::GetEffectIdentifier() CamelCases identifiers based on + // blank delimited words. But not all legacy effects have blank delimted + // words and were manually CamelCased. So use that to break up the ident + // into words + // + // This is only temporary and will go away when the legacy effects + // get converted. + // + wxString ident = GetEffectIdentifier(); + wxString name; + + for (size_t i = 0, cnt = ident.Len(); i < cnt; i++) + { + wxChar c = ident.GetChar(i); + if (wxIsupper(c) && i != 0) + { + name += wxT(' '); + } + name += c; + } + + return name; } wxString Effect::GetVendor() diff --git a/src/effects/EffectManager.cpp b/src/effects/EffectManager.cpp index 9e650dd7f..3e113fc3e 100644 --- a/src/effects/EffectManager.cpp +++ b/src/effects/EffectManager.cpp @@ -11,7 +11,6 @@ #include "../Audacity.h" -#include #include #include #include @@ -730,7 +729,6 @@ const PluginID & EffectManager::GetEffectByIdentifier(const wxString & strTarget const PluginDescriptor *plug = pm.GetFirstPlugin(PluginTypeEffect); while (plug) { -wxLogDebug(wxT("id %s --- %s"), plug->GetID(), strTarget); if (GetEffectIdentifier(plug->GetID()).IsSameAs(strTarget)) { return plug->GetID(); diff --git a/src/effects/StereoToMono.h b/src/effects/StereoToMono.h index bb72151dc..907e0586d 100644 --- a/src/effects/StereoToMono.h +++ b/src/effects/StereoToMono.h @@ -40,6 +40,11 @@ public: virtual bool Init(); virtual void End(); virtual bool CheckWhetherSkipEffect(); + + virtual bool PromptUser() { + return true; + } + protected: virtual bool Process();