Audacity 3.2.0
DoEffect.cpp
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*!********************************************************************
3
4 Audacity: A Digital Audio Editor
5
6 DoEffect.cpp
7
8 Matthieu Hodgkinson
9
10**********************************************************************/
11#include "DoEffect.h"
12#include "AudacityMessageBox.h"
13#include "Effect.h"
15#include "ProjectAudioManager.h"
16#include "ProjectWindows.h"
17#include "SelectUtilities.h"
18#include "effects/EffectUI.h"
20#include <wx/frame.h>
21
22namespace
23{
25{
26 return [&]() { ProjectAudioManager::Get(project).Stop(); };
27}
28} // namespace
29
31 const PluginID& ID, AudacityProject& project, unsigned flags)
32{
33 auto getShowEffectHostInterfaceCb =
34 [window = &GetProjectFrame(project)](
35 Effect& effect, std::shared_ptr<EffectInstance>& pInstance,
37 const auto pServices = dynamic_cast<EffectUIServices*>(&effect);
38 return pServices && pServices->ShowHostInterface(
39 effect, *window, EffectUI::DialogFactory,
40 pInstance, access, true);
41 };
42 auto selectAllIfNoneCb = [&]() {
44 };
46 ID, project, flags, std::move(getShowEffectHostInterfaceCb),
47 StopPlaybackCb(project), std::move(selectAllIfNoneCb));
48}
wxString PluginID
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
accessors for certain important windows associated with each project
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
Base class for many of the effects in Audacity.
Definition: Effect.h:26
virtual int ShowHostInterface(EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
void Stop(bool stopStream=true)
static ProjectAudioManager & Get(AudacityProject &project)
Implementation of EffectSettings for cases where there is only one thread.
AUDACITY_APPLICATION_LOGIC_API bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags, ShowEffectHostInterfaceCb, StopPlaybackCb, SelectAllIfNoneCb)
'Repeat Last Effect'.
bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags)
Definition: DoEffect.cpp:30
AUDACITY_DLL_API DialogFactoryResults DialogFactory(wxWindow &parent, EffectBase &host, EffectUIServices &client, EffectSettingsAccess &access)
Definition: EffectUI.cpp:1112
void SelectAllIfNone(AudacityProject &project)
AudacityApplicationLogic::StopPlaybackCb StopPlaybackCb(AudacityProject &project)
Definition: DoEffect.cpp:24