diff --git a/include/audacity/EffectInterface.h b/include/audacity/EffectInterface.h index fc37883bf..5dca96dfc 100755 --- a/include/audacity/EffectInterface.h +++ b/include/audacity/EffectInterface.h @@ -55,7 +55,8 @@ typedef enum EffectType EffectTypeHidden, EffectTypeGenerate, EffectTypeProcess, - EffectTypeAnalyze + EffectTypeAnalyze, + EffectTypeTool, } EffectType; class ShuttleParams; diff --git a/src/Menus.cpp b/src/Menus.cpp index b0d267914..86f35f0c1 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -396,15 +396,6 @@ void AudacityProject::CreateMenusAndCommands() ///////////////////////////////////////////////////////////////////////////// - c->BeginSubMenu(_("C&hains")); - c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain), - AudioIONotBusyFlag, - AudioIONotBusyFlag); - c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains)); - c->EndSubMenu(); - - c->AddSeparator(); - c->AddItem(wxT("PageSetup"), _("Pa&ge Setup..."), FN(OnPageSetup), AudioIONotBusyFlag | TracksExistFlag, AudioIONotBusyFlag | TracksExistFlag); @@ -1186,6 +1177,32 @@ void AudacityProject::CreateMenusAndCommands() c->EndMenu(); + ////////////////////////////////////////////////////////////////////////// + // Tools Menu + ////////////////////////////////////////////////////////////////////////// + + c->BeginMenu(_("&Tools")); + +#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT + c->AddItem(wxT("ManageTools"), _("Add / Remove Plug-ins..."), FN(OnManageTools)); + c->AddSeparator(); +#endif + + c->AddItem(wxT("ApplyChain"), _("Appl&y Chain..."), FN(OnApplyChain), + AudioIONotBusyFlag, + AudioIONotBusyFlag); + c->AddItem(wxT("EditChains"), _("Edit C&hains..."), FN(OnEditChains)); + + c->AddSeparator(); + + PopulateEffectsMenu(c, + EffectTypeTool, + AudioIONotBusyFlag, + AudioIONotBusyFlag); + + c->EndMenu(); + + #ifdef __WXMAC__ ///////////////////////////////////////////////////////////////////////////// // poor imitation of the Mac Windows Menu @@ -4596,6 +4613,10 @@ void AudacityProject::OnManageAnalyzers(const CommandContext &WXUNUSED(context) OnManagePluginsMenu(EffectTypeAnalyze); } +void AudacityProject::OnManageTools(const CommandContext &WXUNUSED(context) ) +{ + OnManagePluginsMenu(EffectTypeTool); +} void AudacityProject::OnStereoToMono(const CommandContext &context) diff --git a/src/Menus.h b/src/Menus.h index f84eefcb3..ee97b6d26 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -502,6 +502,7 @@ static void RebuildAllMenuBars(); void OnManageGenerators(const CommandContext &context ); void OnManageEffects(const CommandContext &context ); void OnManageAnalyzers(const CommandContext &context ); +void OnManageTools(const CommandContext &context ); diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index d109b739f..cd7fe7b25 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1364,6 +1364,7 @@ void PluginDescriptor::SetImporterExtensions(const wxArrayString & extensions) #define KEY_EFFECTTYPE_ANALYZE wxT("Analyze") #define KEY_EFFECTTYPE_GENERATE wxT("Generate") #define KEY_EFFECTTYPE_PROCESS wxT("Process") +#define KEY_EFFECTTYPE_TOOL wxT("Tool") #define KEY_EFFECTTYPE_HIDDEN wxT("Hidden") #define KEY_IMPORTERIDENT wxT("ImporterIdent") #define KEY_IMPORTERFILTER wxT("ImporterFilter") @@ -2071,34 +2072,22 @@ void PluginManager::LoadGroup(wxFileConfig *pRegistry, PluginType type) { // Get the effect type and bypass group if not found if (!pRegistry->Read(KEY_EFFECTTYPE, &strVal)) - { continue; - } if (strVal.IsSameAs(KEY_EFFECTTYPE_NONE)) - { plug.SetEffectType(EffectTypeNone); - } else if (strVal.IsSameAs(KEY_EFFECTTYPE_ANALYZE)) - { plug.SetEffectType(EffectTypeAnalyze); - } else if (strVal.IsSameAs(KEY_EFFECTTYPE_GENERATE)) - { plug.SetEffectType(EffectTypeGenerate); - } else if (strVal.IsSameAs(KEY_EFFECTTYPE_PROCESS)) - { plug.SetEffectType(EffectTypeProcess); - } + else if (strVal.IsSameAs(KEY_EFFECTTYPE_TOOL)) + plug.SetEffectType(EffectTypeTool); else if (strVal.IsSameAs(KEY_EFFECTTYPE_HIDDEN)) - { plug.SetEffectType(EffectTypeHidden); - } else - { continue; - } // Get the effect family and bypass group if not found if (!pRegistry->Read(KEY_EFFECTFAMILY, &strVal)) @@ -2258,25 +2247,18 @@ void PluginManager::SaveGroup(wxFileConfig *pRegistry, PluginType type) EffectType etype = plug.GetEffectType(); wxString stype; if (etype == EffectTypeNone) - { stype = KEY_EFFECTTYPE_NONE; - } else if (etype == EffectTypeAnalyze) - { stype = KEY_EFFECTTYPE_ANALYZE; - } else if (etype == EffectTypeGenerate) - { stype = KEY_EFFECTTYPE_GENERATE; - } else if (etype == EffectTypeProcess) - { stype = KEY_EFFECTTYPE_PROCESS; - } + else if (etype == EffectTypeTool) + stype = KEY_EFFECTTYPE_TOOL; else if (etype == EffectTypeHidden) - { stype = KEY_EFFECTTYPE_HIDDEN; - } + pRegistry->Write(KEY_EFFECTTYPE, stype); pRegistry->Write(KEY_EFFECTFAMILY, plug.GetEffectFamilyId()); pRegistry->Write(KEY_EFFECTDEFAULT, plug.IsEffectDefault()); diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 7e4b55165..dc5afc0aa 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -2720,7 +2720,7 @@ void EffectDialog::Init() PopulateOrExchange(S); long buttons = eOkButton; - if (mType != EffectTypeAnalyze) + if ((mType != EffectTypeAnalyze) && (mType != EffectTypeTool)) { buttons |= eCancelButton; if (mType == EffectTypeProcess) @@ -3087,7 +3087,10 @@ bool EffectUIHost::Initialize() mPlayToggleBtn->SetToolTip(_("Start and stop playback")); bs->Add(mPlayToggleBtn, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, margin); } - else if (mEffect && mEffect->GetType() != EffectTypeAnalyze) + else if (mEffect && + (mEffect->GetType() != EffectTypeAnalyze) && + (mEffect->GetType() != EffectTypeTool) + ) { wxASSERT(bar); // To justify safenew mPlayToggleBtn = safenew wxButton(bar, kPlayID, _("&Preview")); @@ -3835,7 +3838,7 @@ void EffectUIHost::UpdateControls() } mApplyBtn->Enable(!mCapturing); - if (mEffect && mEffect->GetType() != EffectTypeAnalyze) + if (mEffect && (mEffect->GetType() != EffectTypeAnalyze) && (mEffect->GetType() != EffectTypeTool) ) { (!mIsGUI ? mPlayToggleBtn : mPlayBtn)->Enable(!(mCapturing || mDisableTransport)); } diff --git a/src/effects/VST/VSTEffect.cpp b/src/effects/VST/VSTEffect.cpp index 052c765ff..3cd95bd1c 100644 --- a/src/effects/VST/VSTEffect.cpp +++ b/src/effects/VST/VSTEffect.cpp @@ -1234,7 +1234,7 @@ EffectType VSTEffect::GetType() { if (mAudioIns == 0 && mAudioOuts == 0 && mMidiIns == 0 && mMidiOuts == 0) { - return EffectTypeNone; + return EffectTypeTool; } if (mAudioIns == 0 && mMidiIns == 0) diff --git a/src/effects/ladspa/LadspaEffect.cpp b/src/effects/ladspa/LadspaEffect.cpp index 936d08b56..b6d2ed50d 100644 --- a/src/effects/ladspa/LadspaEffect.cpp +++ b/src/effects/ladspa/LadspaEffect.cpp @@ -652,7 +652,7 @@ EffectType LadspaEffect::GetType() { if (mAudioIns == 0 && mAudioOuts == 0) { - return EffectTypeNone; + return EffectTypeTool; } if (mAudioIns == 0) diff --git a/src/effects/lv2/LV2Effect.cpp b/src/effects/lv2/LV2Effect.cpp index b125d82d9..a6d03f22b 100644 --- a/src/effects/lv2/LV2Effect.cpp +++ b/src/effects/lv2/LV2Effect.cpp @@ -370,7 +370,7 @@ EffectType LV2Effect::GetType() { if (GetAudioInCount() == 0 && GetAudioOutCount() == 0) { - return EffectTypeNone; + return EffectTypeTool; } if (GetAudioInCount() == 0) diff --git a/src/effects/nyquist/LoadNyquist.cpp b/src/effects/nyquist/LoadNyquist.cpp index df5d8e526..b2a218e0c 100644 --- a/src/effects/nyquist/LoadNyquist.cpp +++ b/src/effects/nyquist/LoadNyquist.cpp @@ -186,6 +186,12 @@ bool NyquistEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm) DiscoverPluginsAtPath(NYQUIST_PROMPT_ID, ignoredErrMsg, PluginManagerInterface::DefaultRegistrationCallback); } + if (!pm.IsPluginRegistered(NYQUIST_TOOLS_PROMPT_ID)) + { + // No checking of error ? + DiscoverPluginsAtPath(NYQUIST_TOOLS_PROMPT_ID, ignoredErrMsg, + PluginManagerInterface::DefaultRegistrationCallback); + } for (size_t i = 0; i < WXSIZEOF(kShippedEffects); i++) { @@ -213,6 +219,7 @@ wxArrayString NyquistEffectsModule::FindPluginPaths(PluginManagerInterface & pm) // Add the Nyquist prompt effect files.Add(NYQUIST_PROMPT_ID); + files.Add(NYQUIST_TOOLS_PROMPT_ID); // Load .ny plug-ins pm.FindFilesInPathList(wxT("*.ny"), pathList, files); @@ -244,10 +251,8 @@ bool NyquistEffectsModule::IsPluginValid(const wxString & path, bool bFast) // Ignores bFast parameter, since checking file exists is fast enough for // the small number of Nyquist plug-ins that we have. bFast; - if (path == NYQUIST_PROMPT_ID) - { + if((path == NYQUIST_PROMPT_ID) || (path == NYQUIST_TOOLS_PROMPT_ID)) return true; - } return wxFileName::FileExists(path); } diff --git a/src/effects/nyquist/Nyquist.cpp b/src/effects/nyquist/Nyquist.cpp index 3842b0c7b..b31de81c7 100644 --- a/src/effects/nyquist/Nyquist.cpp +++ b/src/effects/nyquist/Nyquist.cpp @@ -152,7 +152,15 @@ NyquistEffect::NyquistEffect(const wxString &fName) mType = EffectTypeProcess; mOK = true; mIsPrompt = true; + return; + } + // Interactive Nyquist + if (fName == NYQUIST_TOOLS_PROMPT_ID) { + mName = XO("Nyquist Tools Prompt"); + mType = EffectTypeTool; + mOK = true; + mIsPrompt = true; return; } @@ -181,9 +189,9 @@ NyquistEffect::~NyquistEffect() wxString NyquistEffect::GetPath() { if (mIsPrompt) - { - return NYQUIST_PROMPT_ID; - } + return (mType == EffectTypeTool) ? + NYQUIST_TOOLS_PROMPT_ID : + NYQUIST_PROMPT_ID; return mFileName.GetFullPath(); } @@ -191,9 +199,9 @@ wxString NyquistEffect::GetPath() wxString NyquistEffect::GetSymbol() { if (mIsPrompt) - { - return XO("Nyquist Prompt"); - } + return (mType == EffectTypeTool) ? + XO("Nyquist Tools Prompt") : + XO("Nyquist Prompt"); return mName; } @@ -1664,6 +1672,9 @@ bool NyquistEffect::Parse( else if (tokens[1] == wxT("analyze")) { mType = EffectTypeAnalyze; } + else if (tokens[1] == wxT("tool")) { + mType = EffectTypeTool; + } if (len >= 3 && tokens[2] == wxT("spectral")) {; mIsSpectral = true; } diff --git a/src/effects/nyquist/Nyquist.h b/src/effects/nyquist/Nyquist.h index 6e43fa99c..2e4d9909e 100644 --- a/src/effects/nyquist/Nyquist.h +++ b/src/effects/nyquist/Nyquist.h @@ -31,6 +31,7 @@ #define NYQUISTEFFECTS_FAMILY wxT("Nyquist") #define NYQUIST_PROMPT_ID wxT("Nyquist Prompt") +#define NYQUIST_TOOLS_PROMPT_ID wxT("Nyquist Tools Prompt") #define NYQUIST_WORKER_ID wxT("Nyquist Worker") enum NyqControlType @@ -206,7 +207,7 @@ private: bool mExternal; bool mIsSpectral; /** True if the code to execute is obtained interactively from the user via - * the "Nyquist Prompt", false for all other effects (lisp code read from + * the "Nyquist Prompt", or "Nyquist Tools Prompt", false for all other effects (lisp code read from * files) */ bool mIsPrompt;