Audacity 3.2.0
RecordingPrefs.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 RecordingPrefs.cpp
6
7 Joshua Haberman
8 Dominic Mazzoni
9 James Crook
10
11*******************************************************************//********************************************************************/
20
21
22#include "RecordingPrefs.h"
23#include "AudioIO.h"
24
25#include <wx/defs.h>
26#include <wx/textctrl.h>
27#include <algorithm>
28
29#include "Decibels.h"
30#include "Prefs.h"
31#include "ShuttleGui.h"
32
33using std::min;
34
35enum {
37};
38
39BEGIN_EVENT_TABLE(RecordingPrefs, PrefsPanel)
42
43RecordingPrefs::RecordingPrefs(wxWindow * parent, wxWindowID winid)
44// i18n-hint: modifier as in "Recording preferences", not progressive verb
45: PrefsPanel(parent, winid, XC("Recording", "preference"))
46{
47 gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &mUseCustomTrackName, false);
48 mOldNameChoice = mUseCustomTrackName;
49 Populate();
50}
51
53{
54}
55
57{
59}
60
62{
63 return XO("Preferences for Recording");
64}
65
67{
68 return "Recording_Preferences";
69}
70
72{
73 //------------------------- Main section --------------------
74 // Now construct the GUI itself.
75 // Use 'eIsCreatingFromPrefs' so that the GUI is
76 // initialised with values from gPrefs.
79 // ----------------------- End of main section --------------
80}
81
83{
84 S.SetBorder(2);
85 S.StartScroller();
86
87 S.StartStatic(XO("Options"));
88 {
89 // Start wording of options with a verb, if possible.
90 S.TieCheckBox(XXO("Hear &other tracks while recording (overdub)"),
91 {wxT("/AudioIO/Duplex"),
92 true});
93
94//#if defined(__WXMAC__)
95// Bug 388. Feature not supported on any Mac Hardware.
96#if 0
97 S.TieCheckBox(XO("Use &hardware to play other tracks"),
98 {wxT("/AudioIO/Playthrough"),
99 false});
100#endif
101 S.TieCheckBox(XXO("Audible input &monitoring"),
102 {wxT("/AudioIO/SWPlaythrough"),
103 false});
104#if !defined(__WXMAC__)
105 //S.AddUnits(XO(" (uncheck when recording computer playback)"));
106#endif
107
108 S.TieCheckBox(XXO("Record on a new track"),
109 {wxT("/GUI/PreferNewTrackRecord"),
110 false});
111
112/* i18n-hint: Dropout is a loss of a short sequence audio sample data from the recording */
113 S.TieCheckBox(XXO("Detect dropouts"),
114 {WarningDialogKey(wxT("DropoutDetected")),
115 true});
116
117
118 }
119 S.EndStatic();
120
121 S.StartStatic(XO("Sound Activated Recording"));
122 {
123 S.TieCheckBox(XXO("&Enable"), SoundActivatedRecord);
124
125 S.StartMultiColumn(2, wxEXPAND);
126 {
127 S.SetStretchyCol(1);
128
129 S.TieSlider(XXO("Le&vel (dB):"),
130 {wxT("/AudioIO/SilenceLevel"),
131 -50},
132 0,
134 }
135 S.EndMultiColumn();
136 }
137 S.EndStatic();
138
139 /* i18n-hint: start of two-part phrase, "Name newly recorded tracks with:" */
140 S.StartStatic(XO("Name newly recorded tracks"));
141 {
142 // Nested multicolumns to indent by 'With:' width, in a way that works if
143 // translated.
144 // This extra step is worth doing to get the check boxes lined up nicely.
145 S.StartMultiColumn( 2 );
146 {
147 /* i18n-hint: end of two-part phrase, "Name newly recorded tracks with:" */
148 S.AddFixedText(XO("With:")) ;
149 S.StartMultiColumn(3);
150 {
151 S.Id(UseCustomTrackNameID).TieCheckBox(XXO("Custom Track &Name"),
152 {wxT("/GUI/TrackNames/RecordingNameCustom"),
154
156 .Name(XO("Custom name text"))
157 .Disable(!mUseCustomTrackName)
158 .TieTextBox( {},
159 {wxT("/GUI/TrackNames/RecodingTrackName"),
160 _("Recorded_Audio")},
161 30);
162 }
163
164 S.EndMultiColumn();
165
166 S.AddFixedText( {} );
167 S.StartMultiColumn(3);
168 {
169 S.TieCheckBox(XXO("&Track Number"),
170 {wxT("/GUI/TrackNames/TrackNumber"),
171 false});
172
173 S.TieCheckBox(XXO("System &Date"),
174 {wxT("/GUI/TrackNames/DateStamp"),
175 false});
176
177 S.TieCheckBox(XXO("System T&ime"),
178 {wxT("/GUI/TrackNames/TimeStamp"),
179 false});
180 }
181 S.EndMultiColumn();
182 }
183 S.EndMultiColumn();
184 }
185 S.EndStatic();
186
187 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
188 S.StartStatic(XO("Automated Recording Level Adjustment"));
189 {
190 S.TieCheckBox(XXO("Enable Automated Recording Level Adjustment."),
191 {wxT("/AudioIO/AutomatedInputLevelAdjustment"),
192 false});
193
194 S.StartMultiColumn(2, wxEXPAND);
195 {
196 S.SetStretchyCol(1);
197
198 /* i18n-hint: Desired maximum (peak) volume for sound */
199 S.TieSlider(XXO("Target Peak:"),
200 {wxT("/AudioIO/TargetPeak"),
201 AILA_DEF_TARGET_PEAK},
202 100,
203 0);
204
205 S.TieSlider(XXO("Within:"),
206 {wxT("/AudioIO/DeltaPeakVolume"),
207 AILA_DEF_DELTA_PEAK},
208 100,
209 0);
210 }
211 S.EndMultiColumn();
212
213 S.StartThreeColumn();
214 {
215 S.TieIntegerTextBox(XXO("Analysis Time:"),
216 {wxT("/AudioIO/AnalysisTime"),
217 AILA_DEF_ANALYSIS_TIME},
218 9);
219 S.AddUnits(XO("milliseconds (time of one analysis)"));
220
221 S.TieIntegerTextBox(XXO("Number of consecutive analysis:"),
222 {wxT("/AudioIO/NumberAnalysis"),
223 AILA_DEF_NUMBER_ANALYSIS},
224 2);
225 S.AddUnits(XO("0 means endless"));
226 }
227 S.EndThreeColumn();
228 }
229 S.EndStatic();
230 #endif
231
232 S.StartStatic(XO("Punch and Roll Recording"));
233 {
234 S.StartThreeColumn();
235 {
236 auto w = S
237 .NameSuffix(XO("seconds"))
238 .TieNumericTextBox(XXO("Pre-ro&ll:"),
241 9);
242 S.AddUnits(XO("seconds"));
243 }
244 {
245 auto w = S
246 .NameSuffix(XO("milliseconds"))
247 .TieNumericTextBox(XXO("Cross&fade:"),
250 9);
251 S.AddUnits(XO("milliseconds"));
252 }
253 S.EndThreeColumn();
254 }
255 S.EndStatic();
256
257 S.EndScroller();
258}
259
261{
264
266
269
270 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
271 double targetpeak, deltapeak;
272 gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak);
273 gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak);
274 if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0)
275 {
276 gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak));
277 }
278
279 int value;
280 gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &value);
281 if (value <= 0)
282 gPrefs->Write(wxT("/AudioIO/AnalysisTime"), AILA_DEF_ANALYSIS_TIME);
283
284 gPrefs->Read(wxT("/AudioIO/NumberAnalysis"), &value);
285 if (value < 0)
286 gPrefs->Write(wxT("/AudioIO/NumberAnalysis"), AILA_DEF_NUMBER_ANALYSIS);
287 #endif
288 return true;
289}
290
291void RecordingPrefs::OnToggleCustomName(wxCommandEvent & /* Evt */)
292{
295}
296
297namespace{
299 [](wxWindow *parent, wxWindowID winid, AudacityProject *)
300 {
301 wxASSERT(parent); // to justify safenew
302 return safenew RecordingPrefs(parent, winid);
303 }
304};
305}
wxT("CloseDown"))
BoolSetting SoundActivatedRecord
Definition: AudioIO.cpp:3354
DoubleSetting AudioIOLatencyDuration
END_EVENT_TABLE()
int min(int a, int b)
IntSetting DecibelScaleCutoff
Negation of this value is the lowest dB level that should be shown in dB scales.
Definition: Decibels.cpp:12
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define XC(s, c)
Definition: Internat.h:37
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:9
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Prefs.cpp:510
@ UseCustomTrackNameID
#define AUDIO_PRE_ROLL_KEY
#define DEFAULT_PRE_ROLL_SECONDS
#define DEFAULT_ROLL_CROSSFADE_MS
#define RECORDING_PREFS_PLUGIN_SYMBOL
#define AUDIO_ROLL_CROSSFADE_KEY
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#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:90
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
Definition: PrefsPanel.h:51
A PrefsPanel used to select recording options.
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
TranslatableString GetDescription() const override
bool Commit() override
wxTextCtrl * mToggleCustomName
void PopulateOrExchange(ShuttleGui &S) override
ComponentInterfaceSymbol GetSymbol() const override
bool mUseCustomTrackName
void OnToggleCustomName(wxCommandEvent &)
virtual ~RecordingPrefs()
void Invalidate() override
Definition: Prefs.h:289
bool Reset()
Reset to the default value.
Definition: Prefs.h:284
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Holds a msgid for the translation catalog; may also bind format arguments.
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0