mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-09 17:03:24 +02:00
Break a dependency cycle of 3 source files involving Effect.cpp ...
... EffectUI (renamed from EffectRack) includes the experimental rack and other non-experimental dialog handling. It has a one-way dependency on EffectManager, which uses Effect. This is also preliminary to removing other calls to GetActiveProject.
This commit is contained in:
commit
b7ddd7dc53
@ -42,6 +42,8 @@
|
||||
#ifndef __AUDACITY_EFFECTINTERFACE_H__
|
||||
#define __AUDACITY_EFFECTINTERFACE_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "audacity/Types.h"
|
||||
#include "audacity/ComponentInterface.h"
|
||||
#include "audacity/ConfigInterface.h"
|
||||
@ -121,12 +123,8 @@ public:
|
||||
virtual NumericFormatSymbol GetDurationFormat() = 0;
|
||||
virtual void SetDuration(double seconds) = 0;
|
||||
|
||||
virtual bool Apply() = 0;
|
||||
virtual void Preview() = 0;
|
||||
|
||||
//
|
||||
virtual wxDialog *CreateUI(wxWindow *parent, EffectUIClientInterface *client) = 0;
|
||||
|
||||
// Preset handling
|
||||
virtual RegistryPath GetUserPresetsGroup(const RegistryPath & name) = 0;
|
||||
virtual RegistryPath GetCurrentSettingsGroup() = 0;
|
||||
@ -145,6 +143,10 @@ AudacityCommand.
|
||||
class AUDACITY_DLL_API EffectClientInterface /* not final */ : public EffectDefinitionInterface
|
||||
{
|
||||
public:
|
||||
using EffectDialogFactory = std::function<
|
||||
wxDialog* ( wxWindow*, EffectHostInterface*, EffectUIClientInterface* )
|
||||
>;
|
||||
|
||||
virtual ~EffectClientInterface() {};
|
||||
|
||||
virtual bool SetHost(EffectHostInterface *host) = 0;
|
||||
@ -178,7 +180,10 @@ public:
|
||||
virtual size_t RealtimeProcess(int group, float **inBuf, float **outBuf, size_t numSamples) = 0;
|
||||
virtual bool RealtimeProcessEnd() = 0;
|
||||
|
||||
virtual bool ShowInterface(wxWindow *parent, bool forceModal = false) = 0;
|
||||
virtual bool ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory,
|
||||
bool forceModal = false
|
||||
) = 0;
|
||||
// Some effects will use define params to define what parameters they take.
|
||||
// If they do, they won't need to implement Get or SetAutomation parameters.
|
||||
// since the Effect class can do it. Or at least that is how things happen
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "Project.h"
|
||||
#include "ShuttleGui.h"
|
||||
#include "effects/EffectManager.h"
|
||||
#include "effects/EffectUI.h"
|
||||
#include "effects/nyquist/Nyquist.h"
|
||||
#include "../images/AudacityLogo.xpm"
|
||||
#include "../../src/commands/CommandContext.h"
|
||||
@ -1403,7 +1404,7 @@ void NyqBench::OnGo(wxCommandEvent & e)
|
||||
mRunning = true;
|
||||
UpdateWindowUI();
|
||||
|
||||
EffectManager::DoEffect(ID, CommandContext(*p), 0);
|
||||
EffectUI::DoEffect(ID, CommandContext(*p), 0);
|
||||
|
||||
mRunning = false;
|
||||
UpdateWindowUI();
|
||||
|
@ -406,8 +406,8 @@ src/effects/Effect.cpp
|
||||
src/effects/Effect.h
|
||||
src/effects/EffectManager.cpp
|
||||
src/effects/EffectManager.h
|
||||
src/effects/EffectRack.cpp
|
||||
src/effects/EffectRack.h
|
||||
src/effects/EffectUI.cpp
|
||||
src/effects/EffectUI.h
|
||||
src/effects/Equalization.cpp
|
||||
src/effects/Equalization.h
|
||||
src/effects/Equalization48x.cpp
|
||||
|
@ -433,7 +433,6 @@
|
||||
2808285A0A75E0EA000002EF /* Grid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 280828580A75E0EA000002EF /* Grid.cpp */; };
|
||||
2809C4B80BCB7E560006010F /* FileIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2809C4B60BCB7E560006010F /* FileIO.cpp */; };
|
||||
280A8B4719F4403B0091DE70 /* ModuleManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 280A8B4519F4403B0091DE70 /* ModuleManager.cpp */; };
|
||||
280A8B4A19F440880091DE70 /* EffectRack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 280A8B4819F440880091DE70 /* EffectRack.cpp */; };
|
||||
28105D9C0AD09FB200BB4269 /* portmixer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28105D9B0AD09FB200BB4269 /* portmixer.h */; };
|
||||
28105DAA0AD09FC500BB4269 /* px_mac_coreaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 28105DA00AD09FC500BB4269 /* px_mac_coreaudio.c */; };
|
||||
28105DAB0AD09FC500BB4269 /* px_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 28105DA10AD09FC500BB4269 /* px_mixer.c */; };
|
||||
@ -1319,6 +1318,7 @@
|
||||
5EBD1C9522D11DAF00299FD4 /* WaveformVZoomHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBD1C9222D11DAF00299FD4 /* WaveformVZoomHandle.cpp */; };
|
||||
5EBD243D1F74C50800132E0A /* eu_ES.po in Sources */ = {isa = PBXBuildFile; fileRef = 5EBD243C1F74C50800132E0A /* eu_ES.po */; };
|
||||
5EBD35861F78D37A0084D13F /* pt_PT.po in Sources */ = {isa = PBXBuildFile; fileRef = 5EBD35851F78D37A0084D13F /* pt_PT.po */; };
|
||||
5EBDF98522E49CE700DD697E /* EffectUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBDF98322E49CE700DD697E /* EffectUI.cpp */; };
|
||||
5EBE711C22D0EA82004ABABB /* SpectrumView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBE711422D0EA82004ABABB /* SpectrumView.cpp */; };
|
||||
5EBE711D22D0EA82004ABABB /* SpectrumVRulerControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBE711622D0EA82004ABABB /* SpectrumVRulerControls.cpp */; };
|
||||
5EBE711E22D0EA82004ABABB /* WaveformView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5EBE711822D0EA82004ABABB /* WaveformView.cpp */; };
|
||||
@ -2014,7 +2014,7 @@
|
||||
1790B01619883BFD008A330A /* EBUR128.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = EBUR128.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01709883BFD008A330A /* Echo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = Echo.cpp; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01809883BFD008A330A /* Echo.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = Echo.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01909883BFD008A330A /* Effect.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; indentWidth = 3; path = Effect.cpp; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01909883BFD008A330A /* Effect.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 30; indentWidth = 3; path = Effect.cpp; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01A09883BFD008A330A /* Effect.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = Effect.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01B09883BFD008A330A /* Equalization.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.cpp.cpp; path = Equalization.cpp; sourceTree = "<group>"; tabWidth = 3; };
|
||||
1790B01C09883BFD008A330A /* Equalization.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = Equalization.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
@ -2321,8 +2321,6 @@
|
||||
280A8B4419F440160091DE70 /* Types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Types.h; path = ../include/audacity/Types.h; sourceTree = SOURCE_ROOT; };
|
||||
280A8B4519F4403B0091DE70 /* ModuleManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModuleManager.cpp; sourceTree = "<group>"; };
|
||||
280A8B4619F4403B0091DE70 /* ModuleManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleManager.h; sourceTree = "<group>"; };
|
||||
280A8B4819F440880091DE70 /* EffectRack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EffectRack.cpp; sourceTree = "<group>"; };
|
||||
280A8B4919F440880091DE70 /* EffectRack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EffectRack.h; sourceTree = "<group>"; };
|
||||
280F5C8B1B676699003022C5 /* NumberScale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NumberScale.h; sourceTree = "<group>"; };
|
||||
28105D9B0AD09FB200BB4269 /* portmixer.h */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.h; path = portmixer.h; sourceTree = "<group>"; tabWidth = 3; };
|
||||
28105DA00AD09FC500BB4269 /* px_mac_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 5; indentWidth = 3; lastKnownFileType = sourcecode.c.c; path = px_mac_coreaudio.c; sourceTree = "<group>"; tabWidth = 3; };
|
||||
@ -3404,6 +3402,8 @@
|
||||
5EBD1C9322D11DAF00299FD4 /* WaveformVZoomHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaveformVZoomHandle.h; sourceTree = "<group>"; };
|
||||
5EBD243C1F74C50800132E0A /* eu_ES.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = eu_ES.po; path = ../locale/eu_ES.po; sourceTree = "<group>"; };
|
||||
5EBD35851F78D37A0084D13F /* pt_PT.po */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pt_PT.po; path = ../locale/pt_PT.po; sourceTree = "<group>"; };
|
||||
5EBDF98322E49CE700DD697E /* EffectUI.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = EffectUI.cpp; sourceTree = "<group>"; };
|
||||
5EBDF98422E49CE700DD697E /* EffectUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EffectUI.h; sourceTree = "<group>"; };
|
||||
5EBE711422D0EA82004ABABB /* SpectrumView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpectrumView.cpp; sourceTree = "<group>"; };
|
||||
5EBE711522D0EA82004ABABB /* SpectrumView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpectrumView.h; sourceTree = "<group>"; };
|
||||
5EBE711622D0EA82004ABABB /* SpectrumVRulerControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpectrumVRulerControls.cpp; sourceTree = "<group>"; };
|
||||
@ -4770,8 +4770,8 @@
|
||||
1790B01A09883BFD008A330A /* Effect.h */,
|
||||
ED3D7FEE0DF73889000F43E3 /* EffectManager.cpp */,
|
||||
ED3D7FEF0DF73889000F43E3 /* EffectManager.h */,
|
||||
280A8B4819F440880091DE70 /* EffectRack.cpp */,
|
||||
280A8B4919F440880091DE70 /* EffectRack.h */,
|
||||
5EBDF98322E49CE700DD697E /* EffectUI.cpp */,
|
||||
5EBDF98422E49CE700DD697E /* EffectUI.h */,
|
||||
1790B01B09883BFD008A330A /* Equalization.cpp */,
|
||||
1790B01C09883BFD008A330A /* Equalization.h */,
|
||||
EDFCEBB318894B9E00C98E51 /* Equalization48x.cpp */,
|
||||
@ -8871,6 +8871,7 @@
|
||||
5E19F59922A9665500E3F88E /* AutoRecoveryDialog.cpp in Sources */,
|
||||
2860BA280E0F0DD800A13878 /* ExportFFmpeg.cpp in Sources */,
|
||||
5E36A0AB217FA2430068E082 /* NavigationMenus.cpp in Sources */,
|
||||
5EBDF98522E49CE700DD697E /* EffectUI.cpp in Sources */,
|
||||
28D587CB0E264CF4009C7DEA /* LoadLV2.cpp in Sources */,
|
||||
5E02BFF21D1164DF00EB7578 /* Distortion.cpp in Sources */,
|
||||
5E18CFF322931D3D00E75250 /* AudacityMessageBox.cpp in Sources */,
|
||||
@ -9053,7 +9054,6 @@
|
||||
28F6717A197DFA1C00075C32 /* MultiFormatReader.cpp in Sources */,
|
||||
28F6717B197DFA1C00075C32 /* SpecPowerMeter.cpp in Sources */,
|
||||
280A8B4719F4403B0091DE70 /* ModuleManager.cpp in Sources */,
|
||||
280A8B4A19F440880091DE70 /* EffectRack.cpp in Sources */,
|
||||
5E7396471DAFD8F200BA0A4D /* EnvelopeHandle.cpp in Sources */,
|
||||
5E135A4E22A62B7E0076E983 /* MeterPanelBase.cpp in Sources */,
|
||||
28001B3E1A0F0E5D007DD161 /* NumericTextCtrl.cpp in Sources */,
|
||||
|
@ -31,6 +31,7 @@ processing. See also MacrosWindow and ApplyMacroDialog.
|
||||
#include "ProjectWindow.h"
|
||||
#include "commands/CommandManager.h"
|
||||
#include "effects/EffectManager.h"
|
||||
#include "effects/EffectUI.h"
|
||||
#include "FileNames.h"
|
||||
#include "Menus.h"
|
||||
#include "PluginManager.h"
|
||||
@ -452,7 +453,7 @@ wxString MacroCommands::PromptForParamsFor(const CommandID & command, const wxSt
|
||||
|
||||
if (EffectManager::Get().SetEffectParameters(ID, params))
|
||||
{
|
||||
if (EffectManager::Get().PromptUser(ID, parent))
|
||||
if (EffectManager::Get().PromptUser(ID, EffectUI::DialogFactory, parent))
|
||||
{
|
||||
res = EffectManager::Get().GetEffectParameters(ID);
|
||||
}
|
||||
@ -795,7 +796,7 @@ bool MacroCommands::ApplyEffectCommand(
|
||||
EffectManager::kDontRepeatLast);
|
||||
else
|
||||
// and apply the effect...
|
||||
res = EffectManager::DoEffect(ID,
|
||||
res = EffectUI::DoEffect(ID,
|
||||
Context,
|
||||
EffectManager::kConfigured |
|
||||
EffectManager::kSkipState |
|
||||
@ -830,7 +831,7 @@ bool MacroCommands::HandleTextualCommand( CommandManager &commandManager,
|
||||
{
|
||||
if (em.GetCommandIdentifier(plug->GetID()) == Str)
|
||||
{
|
||||
return EffectManager::DoEffect(
|
||||
return EffectUI::DoEffect(
|
||||
plug->GetID(), context,
|
||||
EffectManager::kConfigured);
|
||||
}
|
||||
|
@ -437,8 +437,8 @@ audacity_SOURCES = \
|
||||
effects/Effect.h \
|
||||
effects/EffectManager.cpp \
|
||||
effects/EffectManager.h \
|
||||
effects/EffectRack.cpp \
|
||||
effects/EffectRack.h \
|
||||
effects/EffectUI.cpp \
|
||||
effects/EffectUI.h \
|
||||
effects/Equalization.cpp \
|
||||
effects/Equalization.h \
|
||||
effects/Equalization48x.cpp \
|
||||
|
@ -407,8 +407,8 @@ am__audacity_SOURCES_DIST = BlockFile.cpp BlockFile.h DirManager.cpp \
|
||||
effects/DtmfGen.cpp effects/DtmfGen.h effects/EBUR128.cpp \
|
||||
effects/EBUR128.h effects/Echo.cpp effects/Echo.h \
|
||||
effects/Effect.cpp effects/Effect.h effects/EffectManager.cpp \
|
||||
effects/EffectManager.h effects/EffectRack.cpp \
|
||||
effects/EffectRack.h effects/Equalization.cpp \
|
||||
effects/EffectManager.h effects/EffectUI.cpp \
|
||||
effects/EffectUI.h effects/Equalization.cpp \
|
||||
effects/Equalization.h effects/Equalization48x.cpp \
|
||||
effects/Equalization48x.h effects/Fade.cpp effects/Fade.h \
|
||||
effects/FindClipping.cpp effects/FindClipping.h \
|
||||
@ -791,7 +791,7 @@ am_audacity_OBJECTS = $(am__objects_1) audacity-AboutDialog.$(OBJEXT) \
|
||||
effects/audacity-Echo.$(OBJEXT) \
|
||||
effects/audacity-Effect.$(OBJEXT) \
|
||||
effects/audacity-EffectManager.$(OBJEXT) \
|
||||
effects/audacity-EffectRack.$(OBJEXT) \
|
||||
effects/audacity-EffectUI.$(OBJEXT) \
|
||||
effects/audacity-Equalization.$(OBJEXT) \
|
||||
effects/audacity-Equalization48x.$(OBJEXT) \
|
||||
effects/audacity-Fade.$(OBJEXT) \
|
||||
@ -1217,7 +1217,7 @@ am__depfiles_remade = ./$(DEPDIR)/audacity-AColor.Po \
|
||||
effects/$(DEPDIR)/audacity-Echo.Po \
|
||||
effects/$(DEPDIR)/audacity-Effect.Po \
|
||||
effects/$(DEPDIR)/audacity-EffectManager.Po \
|
||||
effects/$(DEPDIR)/audacity-EffectRack.Po \
|
||||
effects/$(DEPDIR)/audacity-EffectUI.Po \
|
||||
effects/$(DEPDIR)/audacity-Equalization.Po \
|
||||
effects/$(DEPDIR)/audacity-Equalization48x.Po \
|
||||
effects/$(DEPDIR)/audacity-Fade.Po \
|
||||
@ -1933,8 +1933,8 @@ audacity_SOURCES = $(libaudacity_la_SOURCES) AboutDialog.cpp \
|
||||
effects/DtmfGen.cpp effects/DtmfGen.h effects/EBUR128.cpp \
|
||||
effects/EBUR128.h effects/Echo.cpp effects/Echo.h \
|
||||
effects/Effect.cpp effects/Effect.h effects/EffectManager.cpp \
|
||||
effects/EffectManager.h effects/EffectRack.cpp \
|
||||
effects/EffectRack.h effects/Equalization.cpp \
|
||||
effects/EffectManager.h effects/EffectUI.cpp \
|
||||
effects/EffectUI.h effects/Equalization.cpp \
|
||||
effects/Equalization.h effects/Equalization48x.cpp \
|
||||
effects/Equalization48x.h effects/Fade.cpp effects/Fade.h \
|
||||
effects/FindClipping.cpp effects/FindClipping.h \
|
||||
@ -2432,7 +2432,7 @@ effects/audacity-Effect.$(OBJEXT): effects/$(am__dirstamp) \
|
||||
effects/$(DEPDIR)/$(am__dirstamp)
|
||||
effects/audacity-EffectManager.$(OBJEXT): effects/$(am__dirstamp) \
|
||||
effects/$(DEPDIR)/$(am__dirstamp)
|
||||
effects/audacity-EffectRack.$(OBJEXT): effects/$(am__dirstamp) \
|
||||
effects/audacity-EffectUI.$(OBJEXT): effects/$(am__dirstamp) \
|
||||
effects/$(DEPDIR)/$(am__dirstamp)
|
||||
effects/audacity-Equalization.$(OBJEXT): effects/$(am__dirstamp) \
|
||||
effects/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -3236,7 +3236,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Echo.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Effect.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-EffectManager.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-EffectRack.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-EffectUI.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Equalization.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Equalization48x.Po@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@effects/$(DEPDIR)/audacity-Fade.Po@am__quote@ # am--include-marker
|
||||
@ -6019,19 +6019,19 @@ effects/audacity-EffectManager.obj: effects/EffectManager.cpp
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o effects/audacity-EffectManager.obj `if test -f 'effects/EffectManager.cpp'; then $(CYGPATH_W) 'effects/EffectManager.cpp'; else $(CYGPATH_W) '$(srcdir)/effects/EffectManager.cpp'; fi`
|
||||
|
||||
effects/audacity-EffectRack.o: effects/EffectRack.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT effects/audacity-EffectRack.o -MD -MP -MF effects/$(DEPDIR)/audacity-EffectRack.Tpo -c -o effects/audacity-EffectRack.o `test -f 'effects/EffectRack.cpp' || echo '$(srcdir)/'`effects/EffectRack.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) effects/$(DEPDIR)/audacity-EffectRack.Tpo effects/$(DEPDIR)/audacity-EffectRack.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='effects/EffectRack.cpp' object='effects/audacity-EffectRack.o' libtool=no @AMDEPBACKSLASH@
|
||||
effects/audacity-EffectUI.o: effects/EffectUI.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT effects/audacity-EffectUI.o -MD -MP -MF effects/$(DEPDIR)/audacity-EffectUI.Tpo -c -o effects/audacity-EffectUI.o `test -f 'effects/EffectUI.cpp' || echo '$(srcdir)/'`effects/EffectUI.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) effects/$(DEPDIR)/audacity-EffectUI.Tpo effects/$(DEPDIR)/audacity-EffectUI.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='effects/EffectUI.cpp' object='effects/audacity-EffectUI.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o effects/audacity-EffectRack.o `test -f 'effects/EffectRack.cpp' || echo '$(srcdir)/'`effects/EffectRack.cpp
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o effects/audacity-EffectUI.o `test -f 'effects/EffectUI.cpp' || echo '$(srcdir)/'`effects/EffectUI.cpp
|
||||
|
||||
effects/audacity-EffectRack.obj: effects/EffectRack.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT effects/audacity-EffectRack.obj -MD -MP -MF effects/$(DEPDIR)/audacity-EffectRack.Tpo -c -o effects/audacity-EffectRack.obj `if test -f 'effects/EffectRack.cpp'; then $(CYGPATH_W) 'effects/EffectRack.cpp'; else $(CYGPATH_W) '$(srcdir)/effects/EffectRack.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) effects/$(DEPDIR)/audacity-EffectRack.Tpo effects/$(DEPDIR)/audacity-EffectRack.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='effects/EffectRack.cpp' object='effects/audacity-EffectRack.obj' libtool=no @AMDEPBACKSLASH@
|
||||
effects/audacity-EffectUI.obj: effects/EffectUI.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT effects/audacity-EffectUI.obj -MD -MP -MF effects/$(DEPDIR)/audacity-EffectUI.Tpo -c -o effects/audacity-EffectUI.obj `if test -f 'effects/EffectUI.cpp'; then $(CYGPATH_W) 'effects/EffectUI.cpp'; else $(CYGPATH_W) '$(srcdir)/effects/EffectUI.cpp'; fi`
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) effects/$(DEPDIR)/audacity-EffectUI.Tpo effects/$(DEPDIR)/audacity-EffectUI.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='effects/EffectUI.cpp' object='effects/audacity-EffectUI.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o effects/audacity-EffectRack.obj `if test -f 'effects/EffectRack.cpp'; then $(CYGPATH_W) 'effects/EffectRack.cpp'; else $(CYGPATH_W) '$(srcdir)/effects/EffectRack.cpp'; fi`
|
||||
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -c -o effects/audacity-EffectUI.obj `if test -f 'effects/EffectUI.cpp'; then $(CYGPATH_W) 'effects/EffectUI.cpp'; else $(CYGPATH_W) '$(srcdir)/effects/EffectUI.cpp'; fi`
|
||||
|
||||
effects/audacity-Equalization.o: effects/Equalization.cpp
|
||||
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(audacity_CPPFLAGS) $(CPPFLAGS) $(audacity_CXXFLAGS) $(CXXFLAGS) -MT effects/audacity-Equalization.o -MD -MP -MF effects/$(DEPDIR)/audacity-Equalization.Tpo -c -o effects/audacity-Equalization.o `test -f 'effects/Equalization.cpp' || echo '$(srcdir)/'`effects/Equalization.cpp
|
||||
@ -9375,7 +9375,7 @@ distclean: distclean-am
|
||||
-rm -f effects/$(DEPDIR)/audacity-Echo.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Effect.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectManager.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectRack.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectUI.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Equalization.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Equalization48x.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Fade.Po
|
||||
@ -9820,7 +9820,7 @@ maintainer-clean: maintainer-clean-am
|
||||
-rm -f effects/$(DEPDIR)/audacity-Echo.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Effect.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectManager.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectRack.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-EffectUI.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Equalization.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Equalization48x.Po
|
||||
-rm -f effects/$(DEPDIR)/audacity-Fade.Po
|
||||
|
@ -215,7 +215,7 @@ bool EffectChangePitch::Process()
|
||||
proxy.mProxyEffectName = XO("High Quality Pitch Change");
|
||||
proxy.setParameters(1.0, pitchRatio);
|
||||
|
||||
return Delegate(proxy, mUIParent, false);
|
||||
return Delegate(proxy, mUIParent, nullptr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -200,7 +200,7 @@ bool EffectChangeTempo::Process()
|
||||
EffectSBSMS proxy;
|
||||
proxy.mProxyEffectName = XO("High Quality Tempo Change");
|
||||
proxy.setParameters(tempoRatio, 1.0);
|
||||
success = Delegate(proxy, mUIParent, false);
|
||||
success = Delegate(proxy, mUIParent, nullptr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include <functional>
|
||||
#include <set>
|
||||
|
||||
#include <wx/defs.h>
|
||||
@ -141,7 +142,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
size_t numSamples) override;
|
||||
bool RealtimeProcessEnd() override;
|
||||
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool GetAutomationParameters(CommandParameters & parms) override;
|
||||
bool SetAutomationParameters(CommandParameters & parms) override;
|
||||
@ -177,11 +179,8 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
virtual NumericFormatSymbol GetSelectionFormat() /* not override? */; // time format in Selection toolbar
|
||||
void SetDuration(double duration) override;
|
||||
|
||||
bool Apply() override;
|
||||
void Preview() override;
|
||||
|
||||
wxDialog *CreateUI(wxWindow *parent, EffectUIClientInterface *client) override;
|
||||
|
||||
RegistryPath GetUserPresetsGroup(const RegistryPath & name) override;
|
||||
RegistryPath GetCurrentSettingsGroup() override;
|
||||
RegistryPath GetFactoryDefaultsGroup() override;
|
||||
@ -257,11 +256,13 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
|
||||
// Returns true on success. Will only operate on tracks that
|
||||
// have the "selected" flag set to true, which is consistent with
|
||||
// Audacity's standard UI.
|
||||
// Create a user interface only if the supplied function is not null.
|
||||
/* not virtual */ bool DoEffect(wxWindow *parent, double projectRate, TrackList *list,
|
||||
TrackFactory *factory, NotifyingSelectedRegion &selectedRegion,
|
||||
bool shouldPrompt = true);
|
||||
TrackFactory *factory, NotifyingSelectedRegion &selectedRegion,
|
||||
const EffectDialogFactory &dialogFactory );
|
||||
|
||||
bool Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt);
|
||||
bool Delegate( Effect &delegate,
|
||||
wxWindow *parent, const EffectDialogFactory &factory );
|
||||
|
||||
virtual bool IsHidden();
|
||||
|
||||
@ -288,12 +289,6 @@ protected:
|
||||
// return false otherwise
|
||||
virtual bool Init();
|
||||
|
||||
// If necessary, open a dialog to get parameters from the user.
|
||||
// This method will not always be called (for example if a user
|
||||
// repeats an effect) but if it is called, it will be called
|
||||
// after Init.
|
||||
virtual bool PromptUser(wxWindow *parent);
|
||||
|
||||
// Check whether effect should be skipped
|
||||
// Typically this is only useful in automation, for example
|
||||
// detecting that zero noise reduction is to be done,
|
||||
@ -583,105 +578,6 @@ private:
|
||||
wxDECLARE_NO_COPY_CLASS(EffectDialog);
|
||||
};
|
||||
|
||||
//
|
||||
class EffectUIHost final : public wxDialogWrapper,
|
||||
public EffectUIHostInterface
|
||||
{
|
||||
public:
|
||||
// constructors and destructors
|
||||
EffectUIHost(wxWindow *parent,
|
||||
Effect *effect,
|
||||
EffectUIClientInterface *client);
|
||||
EffectUIHost(wxWindow *parent,
|
||||
AudacityCommand *command,
|
||||
EffectUIClientInterface *client);
|
||||
virtual ~EffectUIHost();
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
int ShowModal() override;
|
||||
|
||||
bool Initialize();
|
||||
|
||||
private:
|
||||
void OnInitDialog(wxInitDialogEvent & evt);
|
||||
void OnErase(wxEraseEvent & evt);
|
||||
void OnPaint(wxPaintEvent & evt);
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void DoCancel();
|
||||
void OnCancel(wxCommandEvent & evt);
|
||||
void OnHelp(wxCommandEvent & evt);
|
||||
void OnDebug(wxCommandEvent & evt);
|
||||
void OnMenu(wxCommandEvent & evt);
|
||||
void OnEnable(wxCommandEvent & evt);
|
||||
void OnPlay(wxCommandEvent & evt);
|
||||
void OnRewind(wxCommandEvent & evt);
|
||||
void OnFFwd(wxCommandEvent & evt);
|
||||
void OnPlayback(wxCommandEvent & evt);
|
||||
void OnCapture(wxCommandEvent & evt);
|
||||
void OnUserPreset(wxCommandEvent & evt);
|
||||
void OnFactoryPreset(wxCommandEvent & evt);
|
||||
void OnDeletePreset(wxCommandEvent & evt);
|
||||
void OnSaveAs(wxCommandEvent & evt);
|
||||
void OnImport(wxCommandEvent & evt);
|
||||
void OnExport(wxCommandEvent & evt);
|
||||
void OnOptions(wxCommandEvent & evt);
|
||||
void OnDefaults(wxCommandEvent & evt);
|
||||
|
||||
void UpdateControls();
|
||||
wxBitmap CreateBitmap(const char * const xpm[], bool up, bool pusher);
|
||||
void LoadUserPresets();
|
||||
|
||||
void InitializeRealtime();
|
||||
void CleanupRealtime();
|
||||
void Resume();
|
||||
|
||||
private:
|
||||
AudacityProject *mProject;
|
||||
wxWindow *mParent;
|
||||
Effect *mEffect;
|
||||
AudacityCommand * mCommand;
|
||||
EffectUIClientInterface *mClient;
|
||||
|
||||
RegistryPaths mUserPresets;
|
||||
bool mInitialized;
|
||||
bool mSupportsRealtime;
|
||||
bool mIsGUI;
|
||||
bool mIsBatch;
|
||||
|
||||
wxButton *mApplyBtn;
|
||||
wxButton *mCloseBtn;
|
||||
wxButton *mMenuBtn;
|
||||
wxButton *mPlayBtn;
|
||||
wxButton *mRewindBtn;
|
||||
wxButton *mFFwdBtn;
|
||||
wxCheckBox *mEnableCb;
|
||||
|
||||
wxButton *mEnableToggleBtn;
|
||||
wxButton *mPlayToggleBtn;
|
||||
|
||||
wxBitmap mPlayBM;
|
||||
wxBitmap mPlayDisabledBM;
|
||||
wxBitmap mStopBM;
|
||||
wxBitmap mStopDisabledBM;
|
||||
|
||||
bool mEnabled;
|
||||
|
||||
bool mDisableTransport;
|
||||
bool mPlaying;
|
||||
bool mCapturing;
|
||||
|
||||
SelectedRegion mRegion;
|
||||
double mPlayPos;
|
||||
|
||||
bool mDismissed{};
|
||||
bool mNeedsResume{};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class EffectPresetsDialog final : public wxDialogWrapper
|
||||
{
|
||||
public:
|
||||
|
@ -21,36 +21,17 @@ effects.
|
||||
#include "../Audacity.h"
|
||||
#include "EffectManager.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include "Effect.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <wx/stopwatch.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
#include "EffectRack.h"
|
||||
#endif
|
||||
|
||||
#include "../ShuttleGetDefinition.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
#include "../commands/Command.h"
|
||||
#include "../Menus.h"
|
||||
#include "../MissingAliasFileDialog.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "../ProjectHistory.h"
|
||||
#include "../ProjectAudioManager.h"
|
||||
#include "../ProjectSettings.h"
|
||||
#include "../ProjectWindow.h"
|
||||
#include "../SelectUtilities.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../TrackPanelAx.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -93,179 +74,6 @@ void EffectManager::UnregisterEffect(const PluginID & ID)
|
||||
mEffects.erase(id);
|
||||
}
|
||||
|
||||
/// DoEffect() takes a PluginID and has the EffectManager execute the associated
|
||||
/// effect.
|
||||
///
|
||||
/// At the moment flags are used only to indicate whether to prompt for
|
||||
// parameters, whether to save the state to history and whether to allow
|
||||
/// 'Repeat Last Effect'.
|
||||
|
||||
/* static */ bool EffectManager::DoEffect(
|
||||
const PluginID & ID, const CommandContext &context, unsigned flags )
|
||||
{
|
||||
AudacityProject &project = context.project;
|
||||
const auto &settings = ProjectSettings::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &trackPanel = TrackPanel::Get( project );
|
||||
auto &trackFactory = TrackFactory::Get( project );
|
||||
auto rate = settings.GetRate();
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto &commandManager = CommandManager::Get( project );
|
||||
auto &window = ProjectWindow::Get( project );
|
||||
|
||||
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
|
||||
if (!plug)
|
||||
return false;
|
||||
|
||||
EffectType type = plug->GetEffectType();
|
||||
|
||||
// Make sure there's no activity since the effect is about to be applied
|
||||
// to the project's tracks. Mainly for Apply during RTP, but also used
|
||||
// for batch commands
|
||||
if (flags & EffectManager::kConfigured)
|
||||
{
|
||||
ProjectAudioManager::Get( project ).Stop();
|
||||
SelectUtilities::SelectAllIfNone( project );
|
||||
}
|
||||
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
|
||||
auto nTracksOriginally = tracks.size();
|
||||
wxWindow *focus = wxWindow::FindFocus();
|
||||
wxWindow *parent = nullptr;
|
||||
if (focus != nullptr) {
|
||||
parent = focus->GetParent();
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
auto cleanup = finally( [&] {
|
||||
|
||||
if (!success) {
|
||||
// For now, we're limiting realtime preview to a single effect, so
|
||||
// make sure the menus reflect that fact that one may have just been
|
||||
// opened.
|
||||
MenuManager::Get(project).UpdateMenus( false );
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
int count = 0;
|
||||
bool clean = true;
|
||||
for (auto t : tracks.Selected< const WaveTrack >()) {
|
||||
if (t->GetEndTime() != 0.0)
|
||||
clean = false;
|
||||
count++;
|
||||
}
|
||||
|
||||
EffectManager & em = EffectManager::Get();
|
||||
|
||||
success = em.DoEffect(ID, &window, context.project, rate,
|
||||
&tracks, &trackFactory, selectedRegion,
|
||||
(flags & EffectManager::kConfigured) == 0);
|
||||
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
if (em.GetSkipStateFlag())
|
||||
flags = flags | EffectManager::kSkipState;
|
||||
|
||||
if (!(flags & EffectManager::kSkipState))
|
||||
{
|
||||
auto shortDesc = em.GetCommandName(ID);
|
||||
auto longDesc = em.GetCommandDescription(ID);
|
||||
ProjectHistory::Get( project ).PushState(longDesc, shortDesc);
|
||||
}
|
||||
|
||||
if (!(flags & EffectManager::kDontRepeatLast))
|
||||
{
|
||||
// Only remember a successful effect, don't remember insert,
|
||||
// or analyze effects.
|
||||
if (type == EffectTypeProcess) {
|
||||
auto shortDesc = em.GetCommandName(ID);
|
||||
MenuManager::Get(project).mLastEffect = ID;
|
||||
/* i18n-hint: %s will be the name of the effect which will be
|
||||
* repeated if this menu item is chosen */
|
||||
auto lastEffectDesc = XO("Repeat %s").Format( shortDesc );
|
||||
commandManager.Modify(wxT("RepeatLastEffect"), lastEffectDesc);
|
||||
}
|
||||
}
|
||||
|
||||
//STM:
|
||||
//The following automatically re-zooms after sound was generated.
|
||||
// IMO, it was disorienting, removing to try out without re-fitting
|
||||
//mchinen:12/14/08 reapplying for generate effects
|
||||
if (type == EffectTypeGenerate)
|
||||
{
|
||||
if (count == 0 || (clean && selectedRegion.t0() == 0.0))
|
||||
window.DoZoomFit();
|
||||
// trackPanel->Refresh(false);
|
||||
}
|
||||
|
||||
// PRL: RedrawProject explicitly because sometimes history push is skipped
|
||||
window.RedrawProject();
|
||||
|
||||
if (focus != nullptr && focus->GetParent()==parent) {
|
||||
focus->SetFocus();
|
||||
}
|
||||
|
||||
// A fix for Bug 63
|
||||
// New tracks added? Scroll them into view so that user sees them.
|
||||
// Don't care what track type. An analyser might just have added a
|
||||
// Label track and we want to see it.
|
||||
if( tracks.size() > nTracksOriginally ){
|
||||
// 0.0 is min scroll position, 1.0 is max scroll position.
|
||||
trackPanel.VerticalScroll( 1.0 );
|
||||
}
|
||||
else {
|
||||
auto pTrack = *tracks.Selected().begin();
|
||||
if (!pTrack)
|
||||
pTrack = *tracks.Any().begin();
|
||||
if (pTrack) {
|
||||
TrackFocus::Get(project).Set(pTrack);
|
||||
pTrack->EnsureVisible();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EffectManager::DoEffect(const PluginID & ID,
|
||||
wxWindow *parent,
|
||||
AudacityProject &project,
|
||||
double projectRate,
|
||||
TrackList *list,
|
||||
TrackFactory *factory,
|
||||
NotifyingSelectedRegion &selectedRegion,
|
||||
bool shouldPrompt /* = true */)
|
||||
|
||||
{
|
||||
this->SetSkipStateFlag(false);
|
||||
Effect *effect = GetEffect(ID);
|
||||
|
||||
if (!effect)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
if (effect->SupportsRealtime())
|
||||
{
|
||||
EffectRack::Get( project ).Add(effect);
|
||||
}
|
||||
#else
|
||||
(void)project;
|
||||
#endif
|
||||
|
||||
bool res = effect->DoEffect(parent,
|
||||
projectRate,
|
||||
list,
|
||||
factory,
|
||||
selectedRegion,
|
||||
shouldPrompt);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool EffectManager::DoAudacityCommand(const PluginID & ID,
|
||||
const CommandContext &context,
|
||||
wxWindow *parent,
|
||||
@ -516,14 +324,17 @@ bool EffectManager::SetEffectParameters(const PluginID & ID, const wxString & pa
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EffectManager::PromptUser(const PluginID & ID, wxWindow *parent)
|
||||
bool EffectManager::PromptUser(
|
||||
const PluginID & ID,
|
||||
const EffectClientInterface::EffectDialogFactory &factory, wxWindow *parent)
|
||||
{
|
||||
bool result = false;
|
||||
Effect *effect = GetEffect(ID);
|
||||
|
||||
if (effect)
|
||||
{
|
||||
result = effect->PromptUser(parent);
|
||||
result = effect->ShowInterface(
|
||||
parent, factory, effect->IsBatchProcessing() );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <unordered_map>
|
||||
#include "audacity/EffectInterface.h"
|
||||
#include "audacity/Types.h"
|
||||
|
||||
class AudacityCommand;
|
||||
@ -70,9 +71,6 @@ public:
|
||||
// them by index number, usually when the user selects one from a menu.
|
||||
//
|
||||
public:
|
||||
static bool DoEffect(
|
||||
const PluginID & ID, const CommandContext &context, unsigned flags );
|
||||
|
||||
EffectManager();
|
||||
virtual ~EffectManager();
|
||||
|
||||
@ -82,19 +80,6 @@ public:
|
||||
const PluginID & RegisterEffect(Effect *f);
|
||||
void UnregisterEffect(const PluginID & ID);
|
||||
|
||||
/** Run an effect given the plugin ID */
|
||||
// Returns true on success. Will only operate on tracks that
|
||||
// have the "selected" flag set to true, which is consistent with
|
||||
// Audacity's standard UI.
|
||||
bool DoEffect(const PluginID & ID,
|
||||
wxWindow *parent,
|
||||
AudacityProject &project,
|
||||
double projectRate,
|
||||
TrackList *list,
|
||||
TrackFactory *factory,
|
||||
NotifyingSelectedRegion &selectedRegion,
|
||||
bool shouldPrompt = true);
|
||||
|
||||
TranslatableString GetEffectFamilyName(const PluginID & ID);
|
||||
TranslatableString GetVendorName(const PluginID & ID);
|
||||
|
||||
@ -120,7 +105,9 @@ public:
|
||||
bool SupportsAutomation(const PluginID & ID);
|
||||
wxString GetEffectParameters(const PluginID & ID);
|
||||
bool SetEffectParameters(const PluginID & ID, const wxString & params);
|
||||
bool PromptUser(const PluginID & ID, wxWindow *parent);
|
||||
bool PromptUser( const PluginID & ID,
|
||||
const EffectClientInterface::EffectDialogFactory &factory,
|
||||
wxWindow *parent );
|
||||
bool HasPresets(const PluginID & ID);
|
||||
wxString GetPreset(const PluginID & ID, const wxString & params, wxWindow * parent);
|
||||
wxString GetDefaultPreset(const PluginID & ID);
|
||||
@ -147,12 +134,12 @@ public:
|
||||
|
||||
const PluginID & GetEffectByIdentifier(const CommandID & strTarget);
|
||||
|
||||
private:
|
||||
/** Return an effect by its ID. */
|
||||
Effect *GetEffect(const PluginID & ID);
|
||||
AudacityCommand *GetAudacityCommand(const PluginID & ID);
|
||||
|
||||
private:
|
||||
AudacityCommand *GetAudacityCommand(const PluginID & ID);
|
||||
|
||||
EffectMap mEffects;
|
||||
AudacityCommandMap mCommands;
|
||||
EffectOwnerMap mHostEffects;
|
||||
|
@ -1,588 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
EffectRack.cpp
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "EffectRack.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include "Effect.h"
|
||||
#include "EffectManager.h"
|
||||
#include "RealtimeEffectManager.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
|
||||
#include "../UndoManager.h"
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/frame.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/tglbtn.h>
|
||||
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ProjectHistory.h"
|
||||
#include "../widgets/wxPanelWrapper.h"
|
||||
|
||||
#include "../../images/EffectRack/EffectRack.h"
|
||||
|
||||
#define COL_POWER 0
|
||||
#define COL_EDITOR 1
|
||||
#define COL_UP 2
|
||||
#define COL_DOWN 3
|
||||
#define COL_FAV 4
|
||||
#define COL_REMOVE 5
|
||||
#define COL_NAME 6
|
||||
#define NUMCOLS 7
|
||||
|
||||
#define ID_BASE 20000
|
||||
#define ID_RANGE 100
|
||||
#define ID_POWER (ID_BASE + (COL_POWER * ID_RANGE))
|
||||
#define ID_EDITOR (ID_BASE + (COL_EDITOR * ID_RANGE))
|
||||
#define ID_UP (ID_BASE + (COL_UP * ID_RANGE))
|
||||
#define ID_DOWN (ID_BASE + (COL_DOWN * ID_RANGE))
|
||||
#define ID_FAV (ID_BASE + (COL_FAV * ID_RANGE))
|
||||
#define ID_REMOVE (ID_BASE + (COL_REMOVE * ID_RANGE))
|
||||
#define ID_NAME (ID_BASE + (COL_NAME * ID_RANGE))
|
||||
|
||||
BEGIN_EVENT_TABLE(EffectRack, wxFrame)
|
||||
EVT_CLOSE(EffectRack::OnClose)
|
||||
EVT_TIMER(wxID_ANY, EffectRack::OnTimer)
|
||||
|
||||
EVT_BUTTON(wxID_APPLY, EffectRack::OnApply)
|
||||
EVT_TOGGLEBUTTON(wxID_CLEAR, EffectRack::OnBypass)
|
||||
|
||||
EVT_COMMAND_RANGE(ID_REMOVE, ID_REMOVE + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnRemove)
|
||||
EVT_COMMAND_RANGE(ID_POWER, ID_POWER + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnPower)
|
||||
EVT_COMMAND_RANGE(ID_EDITOR, ID_EDITOR + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnEditor)
|
||||
EVT_COMMAND_RANGE(ID_UP, ID_UP + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnUp)
|
||||
EVT_COMMAND_RANGE(ID_DOWN, ID_DOWN + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnDown)
|
||||
EVT_COMMAND_RANGE(ID_FAV, ID_FAV + 99, wxEVT_COMMAND_BUTTON_CLICKED, EffectRack::OnFav)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
EffectRack::EffectRack( AudacityProject &project )
|
||||
: wxFrame( &GetProjectFrame( project ),
|
||||
wxID_ANY,
|
||||
_("Effects Rack"),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxSYSTEM_MENU |
|
||||
wxCLOSE_BOX |
|
||||
wxCAPTION |
|
||||
wxFRAME_NO_TASKBAR |
|
||||
wxFRAME_FLOAT_ON_PARENT)
|
||||
, mProject{ project }
|
||||
{
|
||||
mBypassing = false;
|
||||
mNumEffects = 0;
|
||||
mLastLatency = 0;
|
||||
mTimer.SetOwner(this);
|
||||
|
||||
mPowerPushed = CreateBitmap(power_on_16x16_xpm, false, false);
|
||||
mPowerRaised = CreateBitmap(power_off_16x16_xpm, true, false);
|
||||
mSettingsPushed = CreateBitmap(settings_up_16x16_xpm, false, true);
|
||||
mSettingsRaised = CreateBitmap(settings_down_16x16_xpm, true, true);
|
||||
mUpDisabled = CreateBitmap(up_9x16_xpm, true, true);
|
||||
mUpPushed = CreateBitmap(up_9x16_xpm, false, true);
|
||||
mUpRaised = CreateBitmap(up_9x16_xpm, true, true);
|
||||
mDownDisabled = CreateBitmap(down_9x16_xpm, true, true);
|
||||
mDownPushed = CreateBitmap(down_9x16_xpm, false, true);
|
||||
mDownRaised = CreateBitmap(down_9x16_xpm, true, true);
|
||||
mFavPushed = CreateBitmap(fav_down_16x16_xpm, false, false);
|
||||
mFavRaised = CreateBitmap(fav_up_16x16_xpm, true, false);
|
||||
mRemovePushed = CreateBitmap(remove_16x16_xpm, false, true);
|
||||
mRemoveRaised = CreateBitmap(remove_16x16_xpm, true, true);
|
||||
|
||||
{
|
||||
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
mPanel = safenew wxPanelWrapper(this, wxID_ANY);
|
||||
bs->Add(mPanel, 1, wxEXPAND);
|
||||
SetSizer(bs.release());
|
||||
}
|
||||
|
||||
{
|
||||
auto bs = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
||||
{
|
||||
auto hs = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||
wxASSERT(mPanel); // To justify safenew
|
||||
hs->Add(safenew wxButton(mPanel, wxID_APPLY, _("&Apply")), 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
hs->AddStretchSpacer();
|
||||
mLatency = safenew wxStaticText(mPanel, wxID_ANY, _("Latency: 0"));
|
||||
hs->Add(mLatency, 0, wxALIGN_CENTER);
|
||||
hs->AddStretchSpacer();
|
||||
hs->Add(safenew wxToggleButton(mPanel, wxID_CLEAR, _("&Bypass")), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
|
||||
bs->Add(hs.release(), 0, wxEXPAND);
|
||||
}
|
||||
bs->Add(safenew wxStaticLine(mPanel, wxID_ANY), 0, wxEXPAND);
|
||||
|
||||
{
|
||||
auto uMainSizer = std::make_unique<wxFlexGridSizer>(7);
|
||||
uMainSizer->AddGrowableCol(6);
|
||||
uMainSizer->SetHGap(0);
|
||||
uMainSizer->SetVGap(0);
|
||||
bs->Add((mMainSizer = uMainSizer.release()), 1, wxEXPAND);
|
||||
}
|
||||
|
||||
mPanel->SetSizer(bs.release());
|
||||
}
|
||||
|
||||
wxString oldPath = gPrefs->GetPath();
|
||||
gPrefs->SetPath(wxT("/EffectsRack"));
|
||||
size_t cnt = gPrefs->GetNumberOfEntries();
|
||||
gPrefs->SetPath(oldPath);
|
||||
|
||||
EffectManager & em = EffectManager::Get();
|
||||
for (size_t i = 0; i < cnt; i++)
|
||||
{
|
||||
wxString slot;
|
||||
gPrefs->Read(wxString::Format(wxT("/EffectsRack/Slot%02d"), i), &slot);
|
||||
|
||||
Effect *effect = em.GetEffect(slot.AfterFirst(wxT(',')));
|
||||
if (effect)
|
||||
{
|
||||
Add(effect, slot.BeforeFirst(wxT(',')) == wxT("1"), true);
|
||||
}
|
||||
}
|
||||
|
||||
Fit();
|
||||
}
|
||||
|
||||
EffectRack::~EffectRack()
|
||||
{
|
||||
gPrefs->DeleteGroup(wxT("/EffectsRack"));
|
||||
|
||||
for (size_t i = 0, cnt = mEffects.size(); i < cnt; i++)
|
||||
{
|
||||
if (mFavState[i])
|
||||
{
|
||||
Effect *effect = mEffects[i];
|
||||
gPrefs->Write(wxString::Format(wxT("/EffectsRack/Slot%02d"), i),
|
||||
wxString::Format(wxT("%d,%s"),
|
||||
mPowerState[i],
|
||||
effect->GetID()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectRack::Add(Effect *effect, bool active, bool favorite)
|
||||
{
|
||||
if (mEffects.end() != std::find(mEffects.begin(), mEffects.end(), effect))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wxBitmapButton *bb;
|
||||
|
||||
wxASSERT(mPanel); // To justify safenew
|
||||
bb = safenew wxBitmapButton(mPanel, ID_POWER + mNumEffects, mPowerRaised);
|
||||
bb->SetBitmapSelected(mPowerRaised);
|
||||
bb->SetName(_("Active State"));
|
||||
bb->SetToolTip(_("Set effect active state"));
|
||||
mPowerState.push_back(active);
|
||||
if (active)
|
||||
{
|
||||
bb->SetBitmapLabel(mPowerPushed);
|
||||
bb->SetBitmapSelected(mPowerPushed);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb->SetBitmapLabel(mPowerRaised);
|
||||
bb->SetBitmapSelected(mPowerRaised);
|
||||
}
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
bb = safenew wxBitmapButton(mPanel, ID_EDITOR + mNumEffects, mSettingsRaised);
|
||||
bb->SetBitmapSelected(mSettingsPushed);
|
||||
bb->SetName(_("Show/Hide Editor"));
|
||||
bb->SetToolTip(_("Open/close effect editor"));
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
bb = safenew wxBitmapButton(mPanel, ID_UP + mNumEffects, mUpRaised);
|
||||
bb->SetBitmapSelected(mUpPushed);
|
||||
bb->SetBitmapDisabled(mUpDisabled);
|
||||
bb->SetName(_("Move Up"));
|
||||
bb->SetToolTip(_("Move effect up in the rack"));
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
bb = safenew wxBitmapButton(mPanel, ID_DOWN + mNumEffects, mDownRaised);
|
||||
bb->SetBitmapSelected(mDownPushed);
|
||||
bb->SetBitmapDisabled(mDownDisabled);
|
||||
bb->SetName(_("Move Down"));
|
||||
bb->SetToolTip(_("Move effect down in the rack"));
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
bb = safenew wxBitmapButton(mPanel, ID_FAV + mNumEffects, mFavRaised);
|
||||
bb->SetBitmapSelected(mFavPushed);
|
||||
bb->SetName(_("Favorite"));
|
||||
bb->SetToolTip(_("Mark effect as a favorite"));
|
||||
mFavState.push_back(favorite);
|
||||
if (favorite)
|
||||
{
|
||||
bb->SetBitmapLabel(mFavPushed);
|
||||
bb->SetBitmapSelected(mFavPushed);
|
||||
}
|
||||
else
|
||||
{
|
||||
bb->SetBitmapLabel(mFavRaised);
|
||||
bb->SetBitmapSelected(mFavRaised);
|
||||
}
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
bb = safenew wxBitmapButton(mPanel, ID_REMOVE + mNumEffects, mRemoveRaised);
|
||||
bb->SetBitmapSelected(mRemovePushed);
|
||||
bb->SetName(_("Remove"));
|
||||
bb->SetToolTip(_("Remove effect from the rack"));
|
||||
mMainSizer->Add(bb, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
|
||||
|
||||
wxStaticText *text = safenew wxStaticText(mPanel, ID_NAME + mNumEffects,
|
||||
effect->GetName().Translation() );
|
||||
text->SetToolTip(_("Name of the effect"));
|
||||
mMainSizer->Add(text, 0, wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||
|
||||
mMainSizer->Layout();
|
||||
SetSize(GetMinSize());
|
||||
Fit();
|
||||
Update();
|
||||
|
||||
mEffects.push_back(effect);
|
||||
mNumEffects++;
|
||||
|
||||
if (!mTimer.IsRunning())
|
||||
{
|
||||
mTimer.Start(1000);
|
||||
}
|
||||
|
||||
if (active)
|
||||
{
|
||||
UpdateActive();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectRack::OnClose(wxCloseEvent & evt)
|
||||
{
|
||||
Show(false);
|
||||
evt.Veto();
|
||||
}
|
||||
|
||||
void EffectRack::OnTimer(wxTimerEvent & WXUNUSED(evt))
|
||||
{
|
||||
int latency = RealtimeEffectManager::Get().GetRealtimeLatency();
|
||||
if (latency != mLastLatency)
|
||||
{
|
||||
mLatency->SetLabel(wxString::Format(_("Latency: %4d"), latency));
|
||||
mLatency->Refresh();
|
||||
mLastLatency = latency;
|
||||
}
|
||||
}
|
||||
|
||||
void EffectRack::OnApply(wxCommandEvent & WXUNUSED(evt))
|
||||
{
|
||||
AudacityProject *project = &mProject;
|
||||
|
||||
bool success = false;
|
||||
auto state = UndoManager::Get( *project ).GetCurrentState();
|
||||
auto cleanup = finally( [&] {
|
||||
if(!success)
|
||||
ProjectHistory::Get( *project ).SetStateTo( state );
|
||||
} );
|
||||
|
||||
for (size_t i = 0, cnt = mEffects.size(); i < cnt; i++)
|
||||
{
|
||||
if (mPowerState[i])
|
||||
{
|
||||
if (!EffectManager::DoEffect(mEffects[i]->GetID(),
|
||||
*project,
|
||||
EffectManager::kConfigured))
|
||||
// If any effect fails (or throws), then stop.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
success = true;
|
||||
|
||||
// Only after all succeed, do the following.
|
||||
for (size_t i = 0, cnt = mEffects.size(); i < cnt; i++)
|
||||
{
|
||||
if (mPowerState[i])
|
||||
{
|
||||
mPowerState[i] = false;
|
||||
|
||||
wxBitmapButton *btn =
|
||||
static_cast<wxBitmapButton *>(FindWindowById(ID_POWER + i));
|
||||
btn->SetBitmapLabel(mPowerRaised);
|
||||
btn->SetBitmapSelected(mPowerRaised);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateActive();
|
||||
}
|
||||
|
||||
void EffectRack::OnBypass(wxCommandEvent & evt)
|
||||
{
|
||||
mBypassing = evt.GetInt() != 0;
|
||||
UpdateActive();
|
||||
}
|
||||
|
||||
void EffectRack::OnPower(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
mPowerState[index] = !mPowerState[index];
|
||||
if (mPowerState[index])
|
||||
{
|
||||
btn->SetBitmapLabel(mPowerPushed);
|
||||
btn->SetBitmapSelected(mPowerPushed);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn->SetBitmapLabel(mPowerRaised);
|
||||
btn->SetBitmapSelected(mPowerRaised);
|
||||
}
|
||||
|
||||
UpdateActive();
|
||||
}
|
||||
|
||||
void EffectRack::OnEditor(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
evt.Skip();
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mEffects[index]->PromptUser(GetParent());
|
||||
}
|
||||
|
||||
void EffectRack::OnUp(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
evt.Skip();
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
if (index <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MoveRowUp(index);
|
||||
}
|
||||
|
||||
void EffectRack::OnDown(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
evt.Skip();
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
if (index < 0 || index == (mMainSizer->GetChildren().GetCount() / NUMCOLS) - 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MoveRowUp(index + 1);
|
||||
}
|
||||
|
||||
void EffectRack::OnFav(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
mFavState[index] = !mFavState[index];
|
||||
if (mFavState[index])
|
||||
{
|
||||
btn->SetBitmapLabel(mFavPushed);
|
||||
btn->SetBitmapSelected(mFavPushed);
|
||||
}
|
||||
else
|
||||
{
|
||||
btn->SetBitmapLabel(mFavRaised);
|
||||
btn->SetBitmapSelected(mFavRaised);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectRack::OnRemove(wxCommandEvent & evt)
|
||||
{
|
||||
wxBitmapButton *btn = static_cast<wxBitmapButton *>(evt.GetEventObject());
|
||||
|
||||
evt.Skip();
|
||||
|
||||
int index = GetEffectIndex(btn);
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mEffects.erase(mEffects.begin() + index);
|
||||
mPowerState.erase(mPowerState.begin() + index);
|
||||
mFavState.erase(mFavState.begin() + index);
|
||||
|
||||
if (mEffects.size() == 0)
|
||||
{
|
||||
if (mTimer.IsRunning())
|
||||
{
|
||||
mTimer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
index *= NUMCOLS;
|
||||
|
||||
for (int i = 0; i < NUMCOLS; i++)
|
||||
{
|
||||
std::unique_ptr<wxWindow> w {mMainSizer->GetItem(index)->GetWindow()};
|
||||
mMainSizer->Detach(index);
|
||||
}
|
||||
|
||||
mMainSizer->Layout();
|
||||
Fit();
|
||||
|
||||
UpdateActive();
|
||||
}
|
||||
|
||||
wxBitmap EffectRack::CreateBitmap(const char *const xpm[], bool up, bool pusher)
|
||||
{
|
||||
wxMemoryDC dc;
|
||||
wxBitmap pic(xpm);
|
||||
|
||||
wxBitmap mod(pic.GetWidth() + 6, pic.GetHeight() + 6);
|
||||
dc.SelectObject(mod);
|
||||
#if defined( __WXGTK__ )
|
||||
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND );
|
||||
#else
|
||||
wxColour newColour = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE );
|
||||
#endif
|
||||
dc.SetBackground(wxBrush(newColour));
|
||||
dc.Clear();
|
||||
|
||||
int offset = 3;
|
||||
if (pusher)
|
||||
{
|
||||
if (!up)
|
||||
{
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
dc.DrawBitmap(pic, offset, offset, true);
|
||||
|
||||
dc.SelectObject(wxNullBitmap);
|
||||
|
||||
return mod;
|
||||
}
|
||||
|
||||
int EffectRack::GetEffectIndex(wxWindow *win)
|
||||
{
|
||||
int col = (win->GetId() - ID_BASE) / ID_RANGE;
|
||||
int row;
|
||||
int cnt = mMainSizer->GetChildren().GetCount() / NUMCOLS;
|
||||
for (row = 0; row < cnt; row++)
|
||||
{
|
||||
wxSizerItem *si = mMainSizer->GetItem((row * NUMCOLS) + col);
|
||||
if (si->GetWindow() == win)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (row == cnt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
void EffectRack::MoveRowUp(int row)
|
||||
{
|
||||
Effect *effect = mEffects[row];
|
||||
mEffects.erase(mEffects.begin() + row);
|
||||
mEffects.insert(mEffects.begin() + row - 1, effect);
|
||||
|
||||
int state = mPowerState[row];
|
||||
mPowerState.erase(mPowerState.begin() + row);
|
||||
mPowerState.insert(mPowerState.begin() + row - 1, state);
|
||||
|
||||
state = mFavState[row];
|
||||
mFavState.erase(mFavState.begin() + row);
|
||||
mFavState.insert(mFavState.begin() + row - 1, state);
|
||||
|
||||
row *= NUMCOLS;
|
||||
|
||||
for (int i = 0; i < NUMCOLS; i++)
|
||||
{
|
||||
wxSizerItem *si = mMainSizer->GetItem(row + NUMCOLS - 1);
|
||||
wxWindow *w = si->GetWindow();
|
||||
int flags = si->GetFlag();
|
||||
int border = si->GetBorder();
|
||||
int prop = si->GetProportion();
|
||||
mMainSizer->Detach(row + NUMCOLS - 1);
|
||||
mMainSizer->Insert(row - NUMCOLS, w, prop, flags, border);
|
||||
}
|
||||
|
||||
mMainSizer->Layout();
|
||||
Refresh();
|
||||
|
||||
UpdateActive();
|
||||
}
|
||||
|
||||
void EffectRack::UpdateActive()
|
||||
{
|
||||
mActive.clear();
|
||||
|
||||
if (!mBypassing)
|
||||
{
|
||||
for (size_t i = 0, cnt = mEffects.size(); i < cnt; i++)
|
||||
{
|
||||
if (mPowerState[i])
|
||||
{
|
||||
mActive.push_back(mEffects[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RealtimeEffectManager::Get().RealtimeSetEffects(
|
||||
{ mActive.begin(), mActive.end() }
|
||||
);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
AudacityProject::AttachedWindows::RegisteredFactory sKey{
|
||||
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
|
||||
auto result = safenew EffectRack( parent );
|
||||
result->CenterOnParent();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
EffectRack &EffectRack::Get( AudacityProject &project )
|
||||
{
|
||||
return project.AttachedWindows::Get< EffectRack >( sKey );
|
||||
}
|
||||
|
||||
#endif
|
@ -1,105 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
EffectRack.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_EFFECTRACK_H__
|
||||
#define __AUDACITY_EFFECTRACK_H__
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/frame.h> // to inherit
|
||||
#include <wx/timer.h> // member variable
|
||||
|
||||
class wxFlexGridSizer;
|
||||
class wxPanel;
|
||||
class wxStaticText;
|
||||
|
||||
class AudacityProject;
|
||||
|
||||
class Effect;
|
||||
using EffectArray = std::vector<Effect*>;
|
||||
|
||||
class EffectRack final : public wxFrame
|
||||
{
|
||||
public:
|
||||
EffectRack( AudacityProject &project );
|
||||
virtual ~EffectRack();
|
||||
|
||||
void Add(Effect *effect, bool active = false, bool favorite = false);
|
||||
|
||||
static EffectRack &Get( AudacityProject &project );
|
||||
|
||||
private:
|
||||
|
||||
wxBitmap CreateBitmap(const char *const xpm[], bool up, bool pusher);
|
||||
int GetEffectIndex(wxWindow *win);
|
||||
void MoveRowUp(int row);
|
||||
void UpdateActive();
|
||||
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnTimer(wxTimerEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void OnBypass(wxCommandEvent & evt);
|
||||
|
||||
void OnPower(wxCommandEvent & evt);
|
||||
void OnEditor(wxCommandEvent & evt);
|
||||
void OnUp(wxCommandEvent & evt);
|
||||
void OnDown(wxCommandEvent & evt);
|
||||
void OnFav(wxCommandEvent & evt);
|
||||
void OnRemove(wxCommandEvent & evt);
|
||||
|
||||
private:
|
||||
AudacityProject &mProject;
|
||||
|
||||
wxStaticText *mLatency;
|
||||
int mLastLatency;
|
||||
|
||||
wxBitmap mPowerPushed;
|
||||
wxBitmap mPowerRaised;
|
||||
wxBitmap mSettingsPushed;
|
||||
wxBitmap mSettingsRaised;
|
||||
wxBitmap mUpPushed;
|
||||
wxBitmap mUpRaised;
|
||||
wxBitmap mUpDisabled;
|
||||
wxBitmap mDownPushed;
|
||||
wxBitmap mDownRaised;
|
||||
wxBitmap mDownDisabled;
|
||||
wxBitmap mFavPushed;
|
||||
wxBitmap mFavRaised;
|
||||
wxBitmap mRemovePushed;
|
||||
wxBitmap mRemoveRaised;
|
||||
|
||||
std::vector<int> mPowerState;
|
||||
std::vector<int> mFavState;
|
||||
|
||||
int mNumEffects;
|
||||
|
||||
wxTimer mTimer;
|
||||
|
||||
wxPanel *mPanel;
|
||||
wxFlexGridSizer *mMainSizer;
|
||||
|
||||
EffectArray mEffects;
|
||||
EffectArray mActive;
|
||||
bool mBypassing;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __AUDACITY_EFFECTRACK_H__
|
1993
src/effects/EffectUI.cpp
Normal file
1993
src/effects/EffectUI.cpp
Normal file
File diff suppressed because it is too large
Load Diff
231
src/effects/EffectUI.h
Normal file
231
src/effects/EffectUI.h
Normal file
@ -0,0 +1,231 @@
|
||||
/**********************************************************************
|
||||
|
||||
Audacity: A Digital Audio Editor
|
||||
|
||||
EffectUI.h
|
||||
|
||||
Leland Lucius
|
||||
|
||||
Audacity(R) is copyright (c) 1999-2008 Audacity Team.
|
||||
License: GPL v2. See License.txt.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __AUDACITY_EFFECTUI_H__
|
||||
#define __AUDACITY_EFFECTUI_H__
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/frame.h> // to inherit
|
||||
#include <wx/timer.h> // member variable
|
||||
|
||||
class wxFlexGridSizer;
|
||||
class wxPanel;
|
||||
class wxStaticText;
|
||||
|
||||
class AudacityProject;
|
||||
|
||||
class Effect;
|
||||
using EffectArray = std::vector<Effect*>;
|
||||
|
||||
class EffectRack final : public wxFrame
|
||||
{
|
||||
public:
|
||||
EffectRack( AudacityProject &project );
|
||||
virtual ~EffectRack();
|
||||
|
||||
void Add(Effect *effect, bool active = false, bool favorite = false);
|
||||
|
||||
static EffectRack &Get( AudacityProject &project );
|
||||
|
||||
private:
|
||||
|
||||
wxBitmap CreateBitmap(const char *const xpm[], bool up, bool pusher);
|
||||
int GetEffectIndex(wxWindow *win);
|
||||
void MoveRowUp(int row);
|
||||
void UpdateActive();
|
||||
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnTimer(wxTimerEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void OnBypass(wxCommandEvent & evt);
|
||||
|
||||
void OnPower(wxCommandEvent & evt);
|
||||
void OnEditor(wxCommandEvent & evt);
|
||||
void OnUp(wxCommandEvent & evt);
|
||||
void OnDown(wxCommandEvent & evt);
|
||||
void OnFav(wxCommandEvent & evt);
|
||||
void OnRemove(wxCommandEvent & evt);
|
||||
|
||||
private:
|
||||
AudacityProject &mProject;
|
||||
|
||||
wxStaticText *mLatency;
|
||||
int mLastLatency;
|
||||
|
||||
wxBitmap mPowerPushed;
|
||||
wxBitmap mPowerRaised;
|
||||
wxBitmap mSettingsPushed;
|
||||
wxBitmap mSettingsRaised;
|
||||
wxBitmap mUpPushed;
|
||||
wxBitmap mUpRaised;
|
||||
wxBitmap mUpDisabled;
|
||||
wxBitmap mDownPushed;
|
||||
wxBitmap mDownRaised;
|
||||
wxBitmap mDownDisabled;
|
||||
wxBitmap mFavPushed;
|
||||
wxBitmap mFavRaised;
|
||||
wxBitmap mRemovePushed;
|
||||
wxBitmap mRemoveRaised;
|
||||
|
||||
std::vector<int> mPowerState;
|
||||
std::vector<int> mFavState;
|
||||
|
||||
int mNumEffects;
|
||||
|
||||
wxTimer mTimer;
|
||||
|
||||
wxPanel *mPanel;
|
||||
wxFlexGridSizer *mMainSizer;
|
||||
|
||||
EffectArray mEffects;
|
||||
EffectArray mActive;
|
||||
bool mBypassing;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#include "audacity/EffectInterface.h"
|
||||
#include "../widgets/wxPanelWrapper.h" // to inherit
|
||||
|
||||
#include "../SelectedRegion.h"
|
||||
|
||||
class AudacityCommand;
|
||||
class AudacityProject;
|
||||
class Effect;
|
||||
|
||||
class wxCheckBox;
|
||||
|
||||
//
|
||||
class EffectUIHost final : public wxDialogWrapper,
|
||||
public EffectUIHostInterface
|
||||
{
|
||||
public:
|
||||
// constructors and destructors
|
||||
EffectUIHost(wxWindow *parent,
|
||||
Effect *effect,
|
||||
EffectUIClientInterface *client);
|
||||
EffectUIHost(wxWindow *parent,
|
||||
AudacityCommand *command,
|
||||
EffectUIClientInterface *client);
|
||||
virtual ~EffectUIHost();
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
int ShowModal() override;
|
||||
|
||||
bool Initialize();
|
||||
|
||||
private:
|
||||
void OnInitDialog(wxInitDialogEvent & evt);
|
||||
void OnErase(wxEraseEvent & evt);
|
||||
void OnPaint(wxPaintEvent & evt);
|
||||
void OnClose(wxCloseEvent & evt);
|
||||
void OnApply(wxCommandEvent & evt);
|
||||
void DoCancel();
|
||||
void OnCancel(wxCommandEvent & evt);
|
||||
void OnHelp(wxCommandEvent & evt);
|
||||
void OnDebug(wxCommandEvent & evt);
|
||||
void OnMenu(wxCommandEvent & evt);
|
||||
void OnEnable(wxCommandEvent & evt);
|
||||
void OnPlay(wxCommandEvent & evt);
|
||||
void OnRewind(wxCommandEvent & evt);
|
||||
void OnFFwd(wxCommandEvent & evt);
|
||||
void OnPlayback(wxCommandEvent & evt);
|
||||
void OnCapture(wxCommandEvent & evt);
|
||||
void OnUserPreset(wxCommandEvent & evt);
|
||||
void OnFactoryPreset(wxCommandEvent & evt);
|
||||
void OnDeletePreset(wxCommandEvent & evt);
|
||||
void OnSaveAs(wxCommandEvent & evt);
|
||||
void OnImport(wxCommandEvent & evt);
|
||||
void OnExport(wxCommandEvent & evt);
|
||||
void OnOptions(wxCommandEvent & evt);
|
||||
void OnDefaults(wxCommandEvent & evt);
|
||||
|
||||
void UpdateControls();
|
||||
wxBitmap CreateBitmap(const char * const xpm[], bool up, bool pusher);
|
||||
void LoadUserPresets();
|
||||
|
||||
void InitializeRealtime();
|
||||
void CleanupRealtime();
|
||||
void Resume();
|
||||
|
||||
private:
|
||||
AudacityProject *mProject;
|
||||
wxWindow *mParent;
|
||||
Effect *mEffect;
|
||||
AudacityCommand * mCommand;
|
||||
EffectUIClientInterface *mClient;
|
||||
|
||||
RegistryPaths mUserPresets;
|
||||
bool mInitialized;
|
||||
bool mSupportsRealtime;
|
||||
bool mIsGUI;
|
||||
bool mIsBatch;
|
||||
|
||||
wxButton *mApplyBtn;
|
||||
wxButton *mCloseBtn;
|
||||
wxButton *mMenuBtn;
|
||||
wxButton *mPlayBtn;
|
||||
wxButton *mRewindBtn;
|
||||
wxButton *mFFwdBtn;
|
||||
wxCheckBox *mEnableCb;
|
||||
|
||||
wxButton *mEnableToggleBtn;
|
||||
wxButton *mPlayToggleBtn;
|
||||
|
||||
wxBitmap mPlayBM;
|
||||
wxBitmap mPlayDisabledBM;
|
||||
wxBitmap mStopBM;
|
||||
wxBitmap mStopDisabledBM;
|
||||
|
||||
bool mEnabled;
|
||||
|
||||
bool mDisableTransport;
|
||||
bool mPlaying;
|
||||
bool mCapturing;
|
||||
|
||||
SelectedRegion mRegion;
|
||||
double mPlayPos;
|
||||
|
||||
bool mDismissed{};
|
||||
bool mNeedsResume{};
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
struct CommandContext;
|
||||
|
||||
namespace EffectUI {
|
||||
|
||||
wxDialog *DialogFactory( wxWindow *parent, EffectHostInterface *pHost,
|
||||
EffectUIClientInterface *client);
|
||||
|
||||
/** Run an effect given the plugin ID */
|
||||
// Returns true on success. Will only operate on tracks that
|
||||
// have the "selected" flag set to true, which is consistent with
|
||||
// Audacity's standard UI.
|
||||
bool DoEffect(
|
||||
const PluginID & ID, const CommandContext &context, unsigned flags );
|
||||
|
||||
}
|
||||
|
||||
#endif // __AUDACITY_EFFECTUI_H__
|
@ -459,8 +459,13 @@ bool EffectNoiseReduction::CheckWhetherSkipEffect()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EffectNoiseReduction::PromptUser(wxWindow *parent)
|
||||
bool EffectNoiseReduction::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &, bool forceModal)
|
||||
{
|
||||
// to do: use forceModal correctly
|
||||
|
||||
// Doesn't use the factory but substitutes its own dialog
|
||||
|
||||
// We may want to twiddle the levels if we are setting
|
||||
// from an automation dialog, the only case in which we can
|
||||
// get here without any wavetracks.
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
|
||||
// using Effect::TrackProgress;
|
||||
|
||||
bool PromptUser(wxWindow *parent) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool Init() override;
|
||||
bool CheckWhetherSkipEffect() override;
|
||||
|
@ -149,8 +149,10 @@ bool EffectNoiseRemoval::CheckWhetherSkipEffect()
|
||||
return (mLevel == 0);
|
||||
}
|
||||
|
||||
bool EffectNoiseRemoval::PromptUser(wxWindow *parent)
|
||||
bool EffectNoiseRemoval::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &, bool forceModal /* forceModal */ )
|
||||
{
|
||||
// to do: use forceModal correctly
|
||||
NoiseRemovalDialog dlog(this, parent);
|
||||
dlog.mSensitivity = mSensitivity;
|
||||
dlog.mGain = -mNoiseGain;
|
||||
|
@ -53,7 +53,8 @@ public:
|
||||
|
||||
// Effect implementation
|
||||
|
||||
bool PromptUser(wxWindow *parent) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
bool Init() override;
|
||||
bool CheckWhetherSkipEffect() override;
|
||||
bool Process() override;
|
||||
|
@ -1601,7 +1601,8 @@ bool VSTEffect::RealtimeProcessEnd()
|
||||
/// provided by the effect, so it will not work with all effects since they don't
|
||||
/// all provide the information (kn0ck0ut is one).
|
||||
///
|
||||
bool VSTEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
bool VSTEffect::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
{
|
||||
if (mDialog)
|
||||
{
|
||||
@ -1624,7 +1625,8 @@ bool VSTEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
ProcessInitialize(0, NULL);
|
||||
}
|
||||
|
||||
mDialog = mHost->CreateUI(parent, this);
|
||||
if ( factory )
|
||||
mDialog = factory(parent, mHost, this);
|
||||
if (!mDialog)
|
||||
{
|
||||
return false;
|
||||
|
@ -151,7 +151,8 @@ class VSTEffect final : public wxEvtHandler,
|
||||
size_t numSamples) override;
|
||||
bool RealtimeProcessEnd() override;
|
||||
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool GetAutomationParameters(CommandParameters & parms) override;
|
||||
bool SetAutomationParameters(CommandParameters & parms) override;
|
||||
|
@ -1428,7 +1428,8 @@ bool AudioUnitEffect::RealtimeProcessEnd()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioUnitEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
bool AudioUnitEffect::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
{
|
||||
if (mDialog)
|
||||
{
|
||||
@ -1440,7 +1441,8 @@ bool AudioUnitEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
// mDialog is null
|
||||
auto cleanup = valueRestorer( mDialog );
|
||||
|
||||
mDialog = mHost->CreateUI(parent, this);
|
||||
if ( factory )
|
||||
mDialog = factory(parent, mHost, this);
|
||||
if (!mDialog)
|
||||
{
|
||||
return false;
|
||||
|
@ -101,7 +101,8 @@ public:
|
||||
size_t numSamples) override;
|
||||
bool RealtimeProcessEnd() override;
|
||||
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool GetAutomationParameters(CommandParameters & parms) override;
|
||||
bool SetAutomationParameters(CommandParameters & parms) override;
|
||||
|
@ -1070,7 +1070,8 @@ bool LadspaEffect::RealtimeProcessEnd()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LadspaEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
bool LadspaEffect::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
{
|
||||
if (mDialog)
|
||||
{
|
||||
@ -1082,7 +1083,8 @@ bool LadspaEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
// mDialog is null
|
||||
auto cleanup = valueRestorer( mDialog );
|
||||
|
||||
mDialog = mHost->CreateUI(parent, this);
|
||||
if ( factory )
|
||||
mDialog = factory(parent, mHost, this);
|
||||
if (!mDialog)
|
||||
{
|
||||
return false;
|
||||
|
@ -99,7 +99,8 @@ public:
|
||||
size_t numSamples) override;
|
||||
bool RealtimeProcessEnd() override;
|
||||
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool GetAutomationParameters(CommandParameters & parms) override;
|
||||
bool SetAutomationParameters(CommandParameters & parms) override;
|
||||
|
@ -1439,7 +1439,8 @@ bool LV2Effect::RealtimeProcessEnd()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LV2Effect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
bool LV2Effect::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
{
|
||||
if (mDialog)
|
||||
{
|
||||
@ -1453,7 +1454,8 @@ bool LV2Effect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
// mDialog is null
|
||||
auto cleanup = valueRestorer(mDialog);
|
||||
|
||||
mDialog = mHost->CreateUI(parent, this);
|
||||
if ( factory )
|
||||
mDialog = factory(parent, mHost, this);
|
||||
if (!mDialog)
|
||||
{
|
||||
return false;
|
||||
|
@ -305,7 +305,8 @@ public:
|
||||
size_t RealtimeProcess(int group, float **inbuf, float **outbuf, size_t numSamples) override;
|
||||
bool RealtimeProcessEnd() override;
|
||||
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
|
||||
bool GetAutomationParameters(CommandParameters & parms) override;
|
||||
bool SetAutomationParameters(CommandParameters & parms) override;
|
||||
|
@ -34,7 +34,6 @@ Functions that find and load all LV2 plugins on the system.
|
||||
#include <wx/log.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include "../EffectManager.h"
|
||||
#include "../../Internat.h"
|
||||
|
||||
#include "LV2Effect.h"
|
||||
|
@ -976,10 +976,11 @@ finish:
|
||||
return success;
|
||||
}
|
||||
|
||||
bool NyquistEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
bool NyquistEffect::ShowInterface(
|
||||
wxWindow *parent, const EffectDialogFactory &factory, bool forceModal)
|
||||
{
|
||||
// Show the normal (prompt or effect) interface
|
||||
bool res = Effect::ShowInterface(parent, forceModal);
|
||||
bool res = Effect::ShowInterface(parent, factory, forceModal);
|
||||
|
||||
// Remember if the user clicked debug
|
||||
mDebug = (mUIResultID == eDebugID);
|
||||
@ -995,7 +996,7 @@ bool NyquistEffect::ShowInterface(wxWindow *parent, bool forceModal)
|
||||
|
||||
effect.SetCommand(mInputCmd);
|
||||
effect.mDebug = (mUIResultID == eDebugID);
|
||||
bool result = Delegate(effect, parent, true);
|
||||
bool result = Delegate(effect, parent, factory);
|
||||
mT0 = effect.mT0;
|
||||
mT1 = effect.mT1;
|
||||
return result;
|
||||
|
@ -99,7 +99,8 @@ public:
|
||||
bool Init() override;
|
||||
bool CheckWhetherSkipEffect() override;
|
||||
bool Process() override;
|
||||
bool ShowInterface(wxWindow *parent, bool forceModal = false) override;
|
||||
bool ShowInterface( wxWindow *parent,
|
||||
const EffectDialogFactory &factory, bool forceModal = false) override;
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "../commands/ScreenshotCommand.h"
|
||||
#include "../effects/Contrast.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "../effects/EffectUI.h"
|
||||
#include "../effects/RealtimeEffectManager.h"
|
||||
#include "../prefs/EffectsPrefs.h"
|
||||
|
||||
@ -423,7 +424,7 @@ void OnManageGenerators(const CommandContext &context)
|
||||
void OnEffect(const CommandContext &context)
|
||||
{
|
||||
// using GET to interpret parameter as a PluginID
|
||||
EffectManager::DoEffect(context.parameter.GET(), context, 0);
|
||||
EffectUI::DoEffect(context.parameter.GET(), context, 0);
|
||||
}
|
||||
|
||||
void OnManageEffects(const CommandContext &context)
|
||||
@ -437,7 +438,7 @@ void OnRepeatLastEffect(const CommandContext &context)
|
||||
auto lastEffect = MenuManager::Get(context.project).mLastEffect;
|
||||
if (!lastEffect.empty())
|
||||
{
|
||||
EffectManager::DoEffect(
|
||||
EffectUI::DoEffect(
|
||||
lastEffect, context, EffectManager::kConfigured );
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
#include "../effects/EffectManager.h"
|
||||
#include "../effects/EffectUI.h"
|
||||
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackControls.h"
|
||||
#include "../widgets/ASlider.h"
|
||||
#include "../widgets/AudacityMessageBox.h"
|
||||
@ -688,7 +689,7 @@ void OnNewTimeTrack(const CommandContext &context)
|
||||
|
||||
void OnStereoToMono(const CommandContext &context)
|
||||
{
|
||||
EffectManager::DoEffect(
|
||||
EffectUI::DoEffect(
|
||||
EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")),
|
||||
context,
|
||||
EffectManager::kConfigured);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "../tracks/ui/TrackView.h"
|
||||
|
||||
#ifdef EXPERIMENTAL_EFFECTS_RACK
|
||||
#include "../effects/EffectRack.h"
|
||||
#include "../effects/EffectUI.h"
|
||||
#endif
|
||||
|
||||
#include <wx/scrolbar.h>
|
||||
|
@ -160,7 +160,7 @@
|
||||
<ClCompile Include="..\..\..\src\DirManager.cpp" />
|
||||
<ClCompile Include="..\..\..\src\Dither.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\Distortion.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\EffectRack.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\EffectUI.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\Equalization48x.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\lv2\zix\ring.cpp" />
|
||||
<ClCompile Include="..\..\..\src\effects\NoiseReduction.cpp" />
|
||||
@ -562,7 +562,7 @@
|
||||
<ClInclude Include="..\..\..\src\DeviceChange.h" />
|
||||
<ClInclude Include="..\..\..\src\Diags.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\Distortion.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\EffectRack.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\EffectUI.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\Equalization48x.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\lv2\zix\common.h" />
|
||||
<ClInclude Include="..\..\..\src\effects\lv2\zix\ring.h" />
|
||||
|
@ -884,7 +884,7 @@
|
||||
<ClCompile Include="..\..\..\src\ModuleManager.cpp">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\effects\EffectRack.cpp">
|
||||
<ClCompile Include="..\..\..\src\effects\EffectUI.cpp">
|
||||
<Filter>src\effects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\toolbars\SpectralSelectionBar.cpp">
|
||||
@ -2053,7 +2053,7 @@
|
||||
<ClInclude Include="..\..\..\src\ModuleManager.h">
|
||||
<Filter>src</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\effects\EffectRack.h">
|
||||
<ClInclude Include="..\..\..\src\effects\EffectUI.h">
|
||||
<Filter>src\effects</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\toolbars\SpectralSelectionBar.h">
|
||||
|
Loading…
x
Reference in New Issue
Block a user