Audacity 3.2.0
EffectsPrefs.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 EffectsPrefs.cpp
6
7 Brian Gunlogson
8 Joshua Haberman
9 Dominic Mazzoni
10 James Crook
11
12
13*******************************************************************//*******************************************************************/
19
20
21#include "EffectsPrefs.h"
22
23#include <wx/choice.h>
24#include <wx/defs.h>
25
26#include "Languages.h"
27#include "PluginManager.h"
28#include "Prefs.h"
29#include "../ShuttleGui.h"
30
31EffectsPrefs::EffectsPrefs(wxWindow * parent, wxWindowID winid)
32: PrefsPanel(parent, winid, XO("Effects"))
33{
34 Populate();
35}
36
38{
39}
40
42{
44}
45
47{
48 return XO("Preferences for Effects");
49}
50
52{
53 return "Effects_Preferences";
54}
55
57{
58 //------------------------- Main section --------------------
59 // Now construct the GUI itself.
60 // Use 'eIsCreatingFromPrefs' so that the GUI is
61 // initialised with values from gPrefs.
64 // ----------------------- End of main section --------------
65}
66
68 wxT("/Effects/GroupBy"),
69 {
71 {
72 XO("Sorted by Effect Name") ,
73 XO("Sorted by Publisher and Effect Name") ,
74 XO("Sorted by Type and Effect Name") ,
75 XO("Grouped by Publisher") ,
76 XO("Grouped by Type") ,
77 XO("Default")
78 },
79 {
80 wxT("sortby:name") ,
81 wxT("sortby:publisher:name") ,
82 wxT("sortby:type:name") ,
83 wxT("groupby:publisher") ,
84 wxT("groupby:type") ,
85 wxT("default")
86 }
87 },
88 5 // "default"
89};
90
91namespace {
92
93// Rather than hard-code an exhaustive list of effect families in this file,
94// pretend we don't know, but discover them instead by querying the module and
95// effect managers.
96
97// But then we would like to have prompts with accelerator characters that are
98// distinct. We collect some prompts in the following map.
99
100// It is not required that each module be found here, nor that each module
101// mentioned here be found.
102const std::map< wxString, TranslatableString > SuggestedPrompts{
103
104/* i18n-hint: Audio Unit is the name of an Apple audio software protocol */
105 { wxT("AudioUnit"), XXO("Audio Unit") },
106
107/* i18n-hint: abbreviates "Linux Audio Developer's Simple Plugin API"
108 (Application programming interface)
109 */
110 { wxT("LADSPA"), XXO("&LADSPA") },
111
112/* i18n-hint: abbreviates
113 "Linux Audio Developer's Simple Plugin API (LADSPA) version 2" */
114 { wxT("LV2"), XXO("LV&2") },
115
116/* i18n-hint: "Nyquist" is an embedded interpreted programming language in
117 Audacity, named in honor of the Swedish-American Harry Nyquist (or Nyqvist).
118 In the translations of this and other strings, you may transliterate the
119 name into another alphabet. */
120 { wxT("Nyquist"), XXO("N&yquist") },
121
122/* i18n-hint: Vamp is the proper name of a software protocol for sound analysis.
123 It is not an abbreviation for anything. See http://vamp-plugins.org */
124 { wxT("Vamp"), XXO("&Vamp") },
125
126/* i18n-hint: Abbreviates Virtual Studio Technology, an audio software protocol
127 developed by Steinberg GmbH */
128 { wxT("VST"), XXO("V&ST") },
129
130};
131
132// Collect needed prompts and settings paths, at most once, on demand
133struct Entry {
135 wxString setting;
136};
137static const std::vector< Entry > &GetModuleData()
138{
139 struct ModuleData : public std::vector< Entry > {
140 ModuleData() {
141 auto &pm = PluginManager::Get();
142 for (auto &plug : pm.PluginsOfType(PluginTypeModule)) {
143 auto internal = plug.GetEffectFamily();
144 if ( internal.empty() )
145 continue;
146
147 TranslatableString prompt;
148 auto iter = SuggestedPrompts.find( internal );
149 if ( iter == SuggestedPrompts.end() )
150 // For the built-in modules this Msgid includes " Effects",
151 // but those strings were never shown to the user,
152 // and the prompts in the table above do not include it.
153 // If there should be new modules, it is not important for them
154 // to follow the " Effects" convention, but instead they can
155 // have shorter msgids.
156 prompt = plug.GetSymbol().Msgid();
157 else
158 prompt = iter->second;
159
160 auto setting = pm.GetPluginEnabledSetting( plug );
161
162 push_back( { prompt, setting } );
163 }
164 // Guarantee some determinate ordering
165 std::sort( begin(), end(),
166 []( const Entry &a, const Entry &b ){
167 return a.setting < b.setting;
168 }
169 );
170 }
171 };
172 static ModuleData theData;
173 return theData;
174}
175
176}
177
179{
180 S.SetBorder(2);
181 S.StartScroller();
182
183 S.StartStatic(XO("Enable Effects"));
184 {
185 for ( const auto &entry : GetModuleData() )
186 {
187 S.TieCheckBox(
188 entry.prompt,
189 {entry.setting,
190 true}
191 );
192 }
193 }
194 S.EndStatic();
195
196 S.StartStatic(XO("Effect Options"));
197 {
198 S.StartMultiColumn(2);
199 {
200 wxChoice *c = S
201 .MinSize()
202 .TieChoice( XXO("S&ort or Group:"), EffectsGroupBy);
203
204 S.TieIntegerTextBox(XXO("&Maximum effects per group (0 to disable):"),
205 {wxT("/Effects/MaxPerGroup"),
206#if defined(__WXGTK__)
207 15
208#else
209 0
210#endif
211 },
212 5);
213 }
214 S.EndMultiColumn();
215 }
216 S.EndStatic();
217
218#ifdef EXPERIMENTAL_EQ_SSE_THREADED
219 S.StartStatic(XO("Instruction Set"));
220 {
221 S.TieCheckBox(XXO("&Use SSE/SSE2/.../AVX"),
222 {wxT("/SSE/GUI"),
223 true});
224 }
225 S.EndStatic();
226#endif
227 S.EndScroller();
228}
229
231{
234
235 return true;
236}
237
238namespace{
240 [](wxWindow *parent, wxWindowID winid, AudacityProject *)
241 {
242 wxASSERT(parent); // to justify safenew
243 return safenew EffectsPrefs(parent, winid);
244 }
245};
246}
ChoiceSetting EffectsGroupBy
#define EFFECTS_PREFS_PLUGIN_SYMBOL
Definition: EffectsPrefs.h:23
#define XXO(s)
Definition: Internat.h:44
#define XO(s)
Definition: Internat.h:31
#define safenew
Definition: MemoryX.h:10
@ PluginTypeModule
ByColumns_t ByColumns
Definition: Prefs.cpp:474
static ProjectFileIORegistry::AttributeWriterEntry entry
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:48
@ eIsSavingToPrefs
Definition: ShuttleGui.h:49
#define S(N)
Definition: ToChars.cpp:64
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
A PrefsPanel for general GUI preferences.
Definition: EffectsPrefs.h:26
void PopulateOrExchange(ShuttleGui &S) override
EffectsPrefs(wxWindow *parent, wxWindowID winid)
bool Commit() override
ComponentInterfaceSymbol GetSymbol() const override
TranslatableString GetDescription() const override
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
static PluginManager & Get()
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628
Holds a msgid for the translation catalog; may also bind format arguments.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
auto begin(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:150
const std::map< wxString, TranslatableString > SuggestedPrompts
PrefsPanel::Registration sAttachment
static const std::vector< Entry > & GetModuleData()
TranslatableString prompt
wxString setting