Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RecordingPrefs Class Referencefinal

A PrefsPanel used to select recording options. More...

#include <RecordingPrefs.h>

Inheritance diagram for RecordingPrefs:
PrefsPanel wxPanelWrapper wxTabTraversalWrapper< wxPanel >

Public Member Functions

 RecordingPrefs (wxWindow *parent, wxWindowID winid)
 
virtual ~RecordingPrefs ()
 
bool Commit () override
 
wxString HelpPageName () override
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const wxString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual void Cancel ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const wxString &name=_("Panel"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&...args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void Populate ()
 
void OnToggleCustomName (wxCommandEvent &)
 

Private Attributes

wxTextCtrl * mToggleCustomName
 
bool mUseCustomTrackName
 
bool mOldNameChoice
 

Detailed Description

A PrefsPanel used to select recording options.

Presents interface for user to update the various recording options like playthrough, latency correction, and others.

Definition at line 24 of file RecordingPrefs.h.

Constructor & Destructor Documentation

RecordingPrefs::RecordingPrefs ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 49 of file RecordingPrefs.cpp.

References gPrefs.

50 : PrefsPanel(parent, winid, _("Recording"))
51 {
52  gPrefs->Read(wxT("/GUI/TrackNames/RecordingNameCustom"), &mUseCustomTrackName, false);
54  Populate();
55 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
PrefsPanel(wxWindow *parent, wxWindowID winid, const wxString &title)
Definition: PrefsPanel.h:48
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
bool mUseCustomTrackName
RecordingPrefs::~RecordingPrefs ( )
virtual

Definition at line 57 of file RecordingPrefs.cpp.

58 {
59 }

Member Function Documentation

bool RecordingPrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 255 of file RecordingPrefs.cpp.

References DEFAULT_LATENCY_DURATION, eIsSavingToPrefs, gPrefs, min(), and PopulateOrExchange().

256 {
257  ShuttleGui S(this, eIsSavingToPrefs);
259 
260  double latencyDuration = DEFAULT_LATENCY_DURATION;
261  gPrefs->Read(wxT("/AudioIO/LatencyDuration"), &latencyDuration);
262  if (latencyDuration < 0) {
263  gPrefs->Write(wxT("/AudioIO/LatencyDuration"), DEFAULT_LATENCY_DURATION);
264  }
265 
266  #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
267  double targetpeak, deltapeak;
268  gPrefs->Read(wxT("/AudioIO/TargetPeak"), &targetpeak);
269  gPrefs->Read(wxT("/AudioIO/DeltaPeakVolume"), &deltapeak);
270  if (targetpeak + deltapeak > 100.0 || targetpeak - deltapeak < 0.0)
271  {
272  gPrefs->Write(wxT("/AudioIO/DeltaPeakVolume"), min(100.0 - targetpeak, targetpeak));
273  }
274 
275  int value;
276  gPrefs->Read(wxT("/AudioIO/AnalysisTime"), &value);
277  if (value <= 0)
278  gPrefs->Write(wxT("/AudioIO/AnalysisTime"), AILA_DEF_ANALYSIS_TIME);
279 
280  gPrefs->Read(wxT("/AudioIO/NumberAnalysis"), &value);
281  if (value < 0)
282  gPrefs->Write(wxT("/AudioIO/NumberAnalysis"), AILA_DEF_NUMBER_ANALYSIS);
283  #endif
284  return true;
285 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
int min(int a, int b)
void PopulateOrExchange(ShuttleGui &S) override
#define DEFAULT_LATENCY_DURATION
Definition: AudioIO.h:85
wxString RecordingPrefs::HelpPageName ( )
overridevirtual

Reimplemented from PrefsPanel.

Definition at line 293 of file RecordingPrefs.cpp.

294 {
295  return "Recording_Preferences";
296 }
void RecordingPrefs::OnToggleCustomName ( wxCommandEvent &  )
private

Definition at line 287 of file RecordingPrefs.cpp.

References mToggleCustomName, and mUseCustomTrackName.

288 {
291 }
wxTextCtrl * mToggleCustomName
bool mUseCustomTrackName
void RecordingPrefs::Populate ( )
private

Definition at line 61 of file RecordingPrefs.cpp.

References eIsCreatingFromPrefs, and PopulateOrExchange().

62 {
63  //------------------------- Main section --------------------
64  // Now construct the GUI itself.
65  // Use 'eIsCreatingFromPrefs' so that the GUI is
66  // initialised with values from gPrefs.
69  // ----------------------- End of main section --------------
70 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
void PopulateOrExchange(ShuttleGui &S) override
void RecordingPrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 72 of file RecordingPrefs.cpp.

References _(), ShuttleGuiBase::AddFixedText(), ShuttleGuiBase::AddUnits(), AUDIO_PRE_ROLL_KEY, AUDIO_ROLL_CROSSFADE_KEY, DEFAULT_PRE_ROLL_SECONDS, DEFAULT_ROLL_CROSSFADE_MS, ShuttleGuiBase::EndMultiColumn(), ShuttleGuiBase::EndScroller(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndThreeColumn(), ENV_DB_KEY, ENV_DB_RANGE, gPrefs, ShuttleGui::Id(), mToggleCustomName, mUseCustomTrackName, ShuttleGuiBase::SetBorder(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartMultiColumn(), ShuttleGuiBase::StartScroller(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::StartThreeColumn(), ShuttleGuiBase::TieCheckBox(), ShuttleGuiBase::TieNumericTextBox(), ShuttleGuiBase::TieSlider(), ShuttleGuiBase::TieTextBox(), UseCustomTrackNameID, and WarningDialogKey().

Referenced by Commit(), and Populate().

73 {
74  S.SetBorder(2);
75  S.StartScroller();
76 
77  S.StartStatic(_("Options"));
78  {
79  // Start wording of options with a verb, if possible.
80  S.TieCheckBox(_("Play &other tracks while recording (overdub)"),
81  wxT("/AudioIO/Duplex"),
82 #ifdef EXPERIMENTAL_DA
83  false);
84 #else
85  true);
86 #endif
87 
88 //#if defined(__WXMAC__)
89 // Bug 388. Feature not supported on any Mac Hardware.
90 #if 0
91  S.TieCheckBox(_("Use &hardware to play other tracks"),
92  wxT("/AudioIO/Playthrough"),
93  false);
94 #endif
95  S.TieCheckBox(_("&Software playthrough of input"),
96  wxT("/AudioIO/SWPlaythrough"),
97  false);
98 #if !defined(__WXMAC__)
99  //S.AddUnits(wxString(wxT(" ")) + _("(uncheck when recording computer playback)"));
100 #endif
101 
102  S.TieCheckBox(_("Record on a new track"),
103  wxT("/GUI/PreferNewTrackRecord"),
104  false);
105 
106 /* i18n-hint: Dropout is a loss of a short sequence audio sample data from the recording */
107  S.TieCheckBox(_("Detect dropouts"),
108  WarningDialogKey(wxT("DropoutDetected")),
109  true);
110 
111 
112  }
113  S.EndStatic();
114 
115  S.StartStatic(_("Sound Activated Recording"));
116  {
117  S.TieCheckBox(_("&Enable"),
118  wxT("/AudioIO/SoundActivatedRecord"),
119  false);
120 
121  S.StartMultiColumn(2, wxEXPAND);
122  {
123  S.SetStretchyCol(1);
124 
125  int dBRange = gPrefs->Read(ENV_DB_KEY, ENV_DB_RANGE);
126  S.TieSlider(_("Le&vel (dB):"),
127  wxT("/AudioIO/SilenceLevel"),
128  -50,
129  0,
130  -dBRange);
131  }
132  S.EndMultiColumn();
133  }
134  S.EndStatic();
135 
136  S.StartStatic(_("Name newly recorded tracks"));
137  {
138  // Nested multicolumns to indent by 'With:' width, in a way that works if
139  // translated.
140  // This extra step is worth doing to get the check boxes lined up nicely.
141  S.StartMultiColumn( 2 );
142  {
143  S.AddFixedText(_("With:")) ;
144  S.StartMultiColumn(3);
145  {
146  S.Id(UseCustomTrackNameID).TieCheckBox(_("Custom Track &Name"),
147  wxT("/GUI/TrackNames/RecordingNameCustom"),
148  mUseCustomTrackName ? true : false);
149 
151  wxT("/GUI/TrackNames/RecodingTrackName"),
152  _("Recorded_Audio"),
153  30);
154  if( mToggleCustomName ) {
155  mToggleCustomName->SetName(_("Custom name text"));
157  }
158  }
159  S.EndMultiColumn();
160 
161  S.AddFixedText( {} );
162  S.StartMultiColumn(3);
163  {
164  S.TieCheckBox(_("&Track Number"),
165  wxT("/GUI/TrackNames/TrackNumber"),
166  false);
167 
168  S.TieCheckBox(_("System &Date"),
169  wxT("/GUI/TrackNames/DateStamp"),
170  false);
171 
172  S.TieCheckBox(_("System T&ime"),
173  wxT("/GUI/TrackNames/TimeStamp"),
174  false);
175  }
176  S.EndMultiColumn();
177  }
178  S.EndMultiColumn();
179  }
180  S.EndStatic();
181 
182  #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
183  S.StartStatic(_("Automated Recording Level Adjustment"));
184  {
185  S.TieCheckBox(_("Enable Automated Recording Level Adjustment."),
186  wxT("/AudioIO/AutomatedInputLevelAdjustment"),
187  false);
188 
189  S.StartMultiColumn(2, wxEXPAND);
190  {
191  S.SetStretchyCol(1);
192 
193  /* i18n-hint: Desired maximum (peak) volume for sound */
194  S.TieSlider(_("Target Peak:"),
195  wxT("/AudioIO/TargetPeak"),
196  AILA_DEF_TARGET_PEAK,
197  100,
198  0);
199 
200  S.TieSlider(_("Within:"),
201  wxT("/AudioIO/DeltaPeakVolume"),
202  AILA_DEF_DELTA_PEAK,
203  100,
204  0);
205  }
206  S.EndMultiColumn();
207 
208  S.StartThreeColumn();
209  {
210  S.TieNumericTextBox(_("Analysis Time:"),
211  wxT("/AudioIO/AnalysisTime"),
212  AILA_DEF_ANALYSIS_TIME,
213  9);
214  S.AddUnits(_("milliseconds (time of one analysis)"));
215 
216  S.TieNumericTextBox(_("Number of consecutive analysis:"),
217  wxT("/AudioIO/NumberAnalysis"),
218  AILA_DEF_NUMBER_ANALYSIS,
219  2);
220  S.AddUnits(_("0 means endless"));
221  }
222  S.EndThreeColumn();
223  }
224  S.EndStatic();
225  #endif
226 
227 #ifdef EXPERIMENTAL_PUNCH_AND_ROLL
228  S.StartStatic(_("Punch and Roll Recording"));
229  {
230  S.StartThreeColumn();
231  {
232  auto w = S.TieNumericTextBox(_("Pre-ro&ll:"),
235  9);
236  S.AddUnits(_("seconds"));
237  w->SetName(w->GetName() + wxT(" ") + _("seconds"));
238  }
239  {
240  auto w = S.TieNumericTextBox(_("Cross&fade:"),
243  9);
244  S.AddUnits(_("milliseconds"));
245  w->SetName(w->GetName() + wxT(" ") + _("milliseconds"));
246  }
247  S.EndThreeColumn();
248  }
249  S.EndStatic();
250 #endif
251 
252  S.EndScroller();
253 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
void EndThreeColumn()
Definition: ShuttleGui.h:139
#define ENV_DB_KEY
Definition: GUISettings.h:15
wxSlider * TieSlider(const wxString &Prompt, WrappedType &WrappedRef, const int max, const int min=0)
#define DEFAULT_PRE_ROLL_SECONDS
Definition: AudioIO.h:89
wxString WarningDialogKey(const wxString &internalDialogName)
Definition: Warning.cpp:115
#define AUDIO_PRE_ROLL_KEY
Definition: AudioIO.h:88
void EndMultiColumn()
void EndScroller()
Definition: ShuttleGui.cpp:828
void AddUnits(const wxString &Prompt)
Left aligned text string.
Definition: ShuttleGui.cpp:260
#define ENV_DB_RANGE
Definition: GUISettings.h:16
wxTextCtrl * mToggleCustomName
wxScrolledWindow * StartScroller(int iStyle=0)
Definition: ShuttleGui.cpp:795
void StartMultiColumn(int nCols, int PositionFlags=wxALIGN_LEFT)
ShuttleGui & Id(int id)
#define AUDIO_ROLL_CROSSFADE_KEY
Definition: AudioIO.h:91
wxTextCtrl * TieNumericTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)
void AddFixedText(const wxString &Str, bool bCenter=false)
Definition: ShuttleGui.cpp:397
void StartThreeColumn()
Definition: ShuttleGui.h:138
#define DEFAULT_ROLL_CROSSFADE_MS
Definition: AudioIO.h:92
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxCheckBox * TieCheckBox(const wxString &Prompt, WrappedType &WrappedRef)
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:763
void SetBorder(int Border)
Definition: ShuttleGui.h:286
bool mUseCustomTrackName
void SetStretchyCol(int i)
Used to modify an already placed FlexGridSizer to make a column stretchy.
Definition: ShuttleGui.cpp:203
wxTextCtrl * TieTextBox(const wxString &Prompt, WrappedType &WrappedRef, const int nChars)

Member Data Documentation

bool RecordingPrefs::mOldNameChoice
private

Definition at line 39 of file RecordingPrefs.h.

wxTextCtrl* RecordingPrefs::mToggleCustomName
private

Definition at line 37 of file RecordingPrefs.h.

Referenced by OnToggleCustomName(), and PopulateOrExchange().

bool RecordingPrefs::mUseCustomTrackName
private

Definition at line 38 of file RecordingPrefs.h.

Referenced by OnToggleCustomName(), and PopulateOrExchange().


The documentation for this class was generated from the following files: