Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DevicePrefs Class Referencefinal

A PrefsPanel used to select recording and playback devices and other settings. More...

#include <DevicePrefs.h>

Inheritance diagram for DevicePrefs:
[legend]
Collaboration diagram for DevicePrefs:
[legend]

Public Member Functions

 DevicePrefs (wxWindow *parent, wxWindowID winid, AudacityProject *project)
 
virtual ~DevicePrefs ()
 
ComponentInterfaceSymbol GetSymbol () const override
 
TranslatableString GetDescription () const override
 
bool Commit () override
 
ManualPageID HelpPageName () override
 If not empty string, the Help button is added below the panel. More...
 
void PopulateOrExchange (ShuttleGui &S) override
 
- Public Member Functions inherited from PrefsPanel
 PrefsPanel (wxWindow *parent, wxWindowID winid, const TranslatableString &title)
 
virtual ~PrefsPanel ()
 
virtual void Preview ()
 
virtual bool Commit ()=0
 
virtual PluginPath GetPath () const override
 
virtual VendorSymbol GetVendor () const override
 
virtual wxString GetVersion () const override
 
virtual bool ShowsPreviewButton ()
 
virtual void PopulateOrExchange (ShuttleGui &WXUNUSED(S))
 
virtual ManualPageID HelpPageName ()
 If not empty string, the Help button is added below the panel. More...
 
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 TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- 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 GetNamesAndLabels ()
 
void OnHost (wxCommandEvent &e)
 
void OnDevice (wxCommandEvent &e)
 
void OnDefaultSampleRateChoice (wxCommandEvent &e)
 
void OnProjectSampleRateChoice (wxCommandEvent &e)
 

Private Attributes

AudacityProjectmProject
 
TranslatableStrings mHostNames
 
wxArrayStringEx mHostLabels
 
wxString mPlayDevice
 
wxString mRecordDevice
 
wxString mRecordSource
 
long mRecordChannels
 
wxChoice * mHost
 
wxChoice * mPlay
 
wxChoice * mRecord
 
wxChoice * mChannels
 
wxChoice * mProjectSampleRates { nullptr }
 
wxTextCtrl * mOtherProjectSampleRate { nullptr }
 
int mProjectSampleRateIndex
 
int mOtherProjectSampleRateValue
 
wxChoice * mDefaultSampleRates
 
wxTextCtrl * mOtherDefaultSampleRate
 
int mOtherDefaultSampleRateValue
 
TranslatableStrings mSampleRateNames
 
std::vector< int > mSampleRateValues
 

Additional Inherited Members

- Public Types inherited from PrefsPanel
using Factories = std::vector< PrefsPanel::PrefsNode >
 
using Factory = std::function< PrefsPanel *(wxWindow *parent, wxWindowID winid, AudacityProject *) >
 
- Static Public Member Functions inherited from PrefsPanel
static FactoriesDefaultFactories ()
 

Detailed Description

A PrefsPanel used to select recording and playback devices and other settings.

Presents interface for user to select the recording device and playback device, from the list of choices that PortAudio makes available.

Also lets user decide how many channels to record.

Definition at line 25 of file DevicePrefs.h.

Constructor & Destructor Documentation

◆ DevicePrefs()

DevicePrefs::DevicePrefs ( wxWindow *  parent,
wxWindowID  winid,
AudacityProject project 
)

Definition at line 69 of file DevicePrefs.cpp.

70: PrefsPanel(parent, winid, XO("Audio Settings"))
72{
73 Populate();
74}
XO("Cut/Copy/Paste")
const auto project
AudacityProject * mProject
Definition: DevicePrefs.h:47
void Populate()
Definition: DevicePrefs.cpp:96
PrefsPanel(wxWindow *parent, wxWindowID winid, const TranslatableString &title)
Definition: PrefsPanel.h:94

◆ ~DevicePrefs()

DevicePrefs::~DevicePrefs ( )
virtual

Definition at line 76 of file DevicePrefs.cpp.

77{
78}

Member Function Documentation

◆ Commit()

bool DevicePrefs::Commit ( )
overridevirtual

Implements PrefsPanel.

Definition at line 515 of file DevicePrefs.cpp.

516{
519 DeviceSourceMap *map = NULL;
520
521 if (mPlay->GetCount() > 0) {
522 map = (DeviceSourceMap *) mPlay->GetClientData(
523 mPlay->GetSelection());
524 }
525 if (map)
527
528 map = NULL;
529 if (mRecord->GetCount() > 0) {
530 map = (DeviceSourceMap *) mRecord->GetClientData(mRecord->GetSelection());
531 }
532 if (map) {
535 if (map->totalSources >= 1)
537 else
539 AudioIORecordChannels.Write(mChannels->GetSelection() + 1);
540 }
541
544
546
547 // The complex compound control may have value 'other' in which case the
548 // value in prefs comes from the second field.
549 if (mOtherDefaultSampleRate->IsEnabled())
550 {
552 gPrefs->Flush();
553 }
554
555 if (mProject)
556 {
557 auto& projectRate = ProjectRate::Get(*mProject);
558 if (mOtherProjectSampleRate->IsEnabled())
559 projectRate.SetRate(mOtherProjectSampleRateValue);
560 else
561 projectRate.SetRate(mSampleRateValues[mProjectSampleRates->GetSelection()]);
562 }
563
564 return true;
565}
DoubleSetting AudioIOLatencyCorrection
StringSetting AudioIORecordingSource
StringSetting AudioIOPlaybackDevice
DoubleSetting AudioIOLatencyDuration
StringSetting AudioIORecordingDevice
IntSetting AudioIORecordingSourceIndex
IntSetting AudioIORecordChannels
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
@ eIsSavingToPrefs
Definition: ShuttleGui.h:47
#define S(N)
Definition: ToChars.cpp:64
wxTextCtrl * mOtherProjectSampleRate
Definition: DevicePrefs.h:63
wxTextCtrl * mOtherDefaultSampleRate
Definition: DevicePrefs.h:69
void PopulateOrExchange(ShuttleGui &S) override
wxChoice * mRecord
Definition: DevicePrefs.h:59
int mOtherDefaultSampleRateValue
Definition: DevicePrefs.h:70
wxChoice * mPlay
Definition: DevicePrefs.h:58
wxChoice * mProjectSampleRates
Definition: DevicePrefs.h:62
wxChoice * mChannels
Definition: DevicePrefs.h:60
std::vector< int > mSampleRateValues
Definition: DevicePrefs.h:73
int mOtherProjectSampleRateValue
Definition: DevicePrefs.h:66
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:259
void Invalidate() override
Definition: Prefs.h:289
bool Reset()
Reset to the default value.
Definition: Prefs.h:284
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
virtual bool Flush() noexcept=0
PROJECT_RATE_API IntSetting DefaultSampleRate
wxString sourceString
Definition: DeviceManager.h:34
wxString deviceString
Definition: DeviceManager.h:35

References AudioIOLatencyCorrection, AudioIOLatencyDuration, AudioIOPlaybackDevice, AudioIORecordChannels, AudioIORecordingDevice, AudioIORecordingSource, AudioIORecordingSourceIndex, QualitySettings::DefaultSampleRate, DeviceSourceMap::deviceString, eIsSavingToPrefs, audacity::BasicSettings::Flush(), ProjectRate::Get(), gPrefs, Setting< T >::Invalidate(), mChannels, mOtherDefaultSampleRate, mOtherDefaultSampleRateValue, mOtherProjectSampleRate, mOtherProjectSampleRateValue, mPlay, mProject, mProjectSampleRates, mRecord, mSampleRateValues, PopulateOrExchange(), Setting< T >::Reset(), S, DeviceSourceMap::sourceIndex, DeviceSourceMap::sourceString, DeviceSourceMap::totalSources, and Setting< T >::Write().

Here is the call graph for this function:

◆ GetDescription()

TranslatableString DevicePrefs::GetDescription ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 86 of file DevicePrefs.cpp.

87{
88 return XO("Audio Settings");
89}

References XO().

Here is the call graph for this function:

◆ GetNamesAndLabels()

void DevicePrefs::GetNamesAndLabels ( )
private

Definition at line 138 of file DevicePrefs.cpp.

139{
140 // Gather list of hosts. Only added hosts that have devices attached.
141 // FIXME: TRAP_ERR PaErrorCode not handled in DevicePrefs GetNamesAndLabels()
142 // With an error code won't add hosts, but won't report a problem either.
143 int nDevices = Pa_GetDeviceCount();
144 for (int i = 0; i < nDevices; i++) {
145 const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
146 if ((info!=NULL)&&(info->maxOutputChannels > 0 || info->maxInputChannels > 0)) {
147 wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
149 .contains( Verbatim( name ) )) {
150 mHostNames.push_back( Verbatim( name ) );
151 mHostLabels.push_back(name);
152 }
153 }
154 }
155
156 //------------ Sample Rate Names
157 // JKC: I don't understand the following comment.
158 // Can someone please explain or correct it?
159 // XXX: This should use a previously changed, but not yet saved
160 // sound card setting from the "I/O" preferences tab.
161 // LLL: It means that until the user clicks "Ok" in preferences, the
162 // GetSupportedSampleRates() call should use the devices they
163 // may have changed on the Audio I/O page. As coded, the sample
164 // rates it will return could be completely invalid as they will
165 // be what's supported by the devices that were selected BEFORE
166 // coming into preferences.
167 //
168 // GetSupportedSampleRates() allows passing in device names, but
169 // how do you get at them as they are on the Audio I/O page????
170 for (int i = 0; i < AudioIOBase::NumStandardRates; i++)
171 {
172 int iRate = AudioIOBase::StandardRates[i];
173 mSampleRateValues.push_back(iRate);
174 mSampleRateNames.push_back(XO("%i Hz").Format(iRate));
175 }
176
177 mSampleRateNames.push_back(XO("Other..."));
178
179 // The label for the 'Other...' case can be any value at all.
180 mSampleRateValues.push_back(
181 44100); // If chosen, this value will be overwritten
182}
const TranslatableString name
Definition: Distortion.cpp:76
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: IteratorX.h:210
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
static const int StandardRates[]
Array of common audio sample rates.
Definition: AudioIOBase.h:189
static const int NumStandardRates
How many standard sample rates there are.
Definition: AudioIOBase.h:191
wxArrayStringEx mHostLabels
Definition: DevicePrefs.h:50
TranslatableStrings mSampleRateNames
Definition: DevicePrefs.h:72
TranslatableStrings mHostNames
Definition: DevicePrefs.h:49
Abstract base class used in importing a file.

References make_iterator_range(), mHostLabels, mHostNames, mSampleRateNames, mSampleRateValues, name, AudioIOBase::NumStandardRates, AudioIOBase::StandardRates, Verbatim(), and XO().

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSymbol()

ComponentInterfaceSymbol DevicePrefs::GetSymbol ( ) const
overridevirtual

Implements ComponentInterface.

Definition at line 81 of file DevicePrefs.cpp.

82{
84}
#define DEVICE_PREFS_PLUGIN_SYMBOL
Definition: DevicePrefs.h:23

References DEVICE_PREFS_PLUGIN_SYMBOL.

◆ HelpPageName()

ManualPageID DevicePrefs::HelpPageName ( )
overridevirtual

If not empty string, the Help button is added below the panel.

Default returns empty string.

Reimplemented from PrefsPanel.

Definition at line 91 of file DevicePrefs.cpp.

92{
93 return "Devices_Preferences";
94}

◆ OnDefaultSampleRateChoice()

void DevicePrefs::OnDefaultSampleRateChoice ( wxCommandEvent &  e)
private

Definition at line 499 of file DevicePrefs.cpp.

500{
501 const int sel = mDefaultSampleRates->GetSelection();
502 mOtherDefaultSampleRate->Enable(sel == (int)mDefaultSampleRates->GetCount() - 1);
503}
wxChoice * mDefaultSampleRates
Definition: DevicePrefs.h:68

References mDefaultSampleRates, and mOtherDefaultSampleRate.

Referenced by Populate().

Here is the caller graph for this function:

◆ OnDevice()

void DevicePrefs::OnDevice ( wxCommandEvent &  e)
private

Definition at line 435 of file DevicePrefs.cpp.

436{
437 int ndx = mRecord->GetCurrentSelection();
438 if (ndx == wxNOT_FOUND) {
439 ndx = 0;
440 }
441
442 int sel = mChannels->GetSelection();
443 int cnt = 0;
444
445 DeviceSourceMap *inMap = (DeviceSourceMap *) mRecord->GetClientData(ndx);
446 if (inMap != NULL) {
447 cnt = inMap->numChannels;
448 }
449
450 if (sel != wxNOT_FOUND) {
451 mRecordChannels = sel + 1;
452 }
453
454 mChannels->Clear();
455
456 // Mimic old behavior
457 if (cnt <= 0) {
458 cnt = 16;
459 }
460
461 // Place an artificial limit on the number of channels to prevent an
462 // outrageous number. I don't know if this is really necessary, but
463 // it doesn't hurt.
464 if (cnt > 256) {
465 cnt = 256;
466 }
467
468 wxArrayStringEx channelnames;
469
470 // Channel counts, mono, stereo etc...
471 for (int i = 0; i < cnt; i++) {
472 wxString name;
473
474 if (i == 0) {
475 name = _("1 (Mono)");
476 }
477 else if (i == 1) {
478 name = _("2 (Stereo)");
479 }
480 else {
481 name = wxString::Format(wxT("%d"), i + 1);
482 }
483
484 channelnames.push_back(name);
485 int index = mChannels->Append(name);
486 if (i == mRecordChannels - 1) {
487 mChannels->SetSelection(index);
488 }
489 }
490
491 if (mChannels->GetCount() && mChannels->GetCurrentSelection() == wxNOT_FOUND) {
492 mChannels->SetSelection(0);
493 }
494
495 ShuttleGui::SetMinSize(mChannels, channelnames);
496 Layout();
497}
wxT("CloseDown"))
#define _(s)
Definition: Internat.h:73
long mRecordChannels
Definition: DevicePrefs.h:55
static void SetMinSize(wxWindow *window, const TranslatableStrings &items)
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

References _, mChannels, mRecord, mRecordChannels, name, DeviceSourceMap::numChannels, ShuttleGui::SetMinSize(), and wxT().

Referenced by OnHost().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnHost()

void DevicePrefs::OnHost ( wxCommandEvent &  e)
private

Definition at line 323 of file DevicePrefs.cpp.

324{
325 // Bail if we have no hosts
326 if (mHostNames.size() < 1)
327 return;
328
329 // Find the index for the host API selected
330 int index = -1;
331 auto apiName = mHostLabels[mHost->GetCurrentSelection()];
332 int nHosts = Pa_GetHostApiCount();
333 for (int i = 0; i < nHosts; ++i) {
334 wxString name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(i)->name);
335 if (name == apiName) {
336 index = i;
337 break;
338 }
339 }
340 // We should always find the host!
341 if (index < 0) {
342 wxLogDebug(wxT("DevicePrefs::OnHost(): API index not found"));
343 return;
344 }
345
346 int nDevices = Pa_GetDeviceCount();
347
348 // FIXME: TRAP_ERR PaErrorCode not handled. nDevices can be negative number.
349 if (nDevices == 0) {
350 mHost->Clear();
351 mHost->Append(_("No audio interfaces"), (void *) NULL);
352 mHost->SetSelection(0);
353 }
354
355 const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
356 const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
357
358 wxArrayString playnames;
359 wxArrayString recordnames;
360 size_t i;
361 int devindex; /* temp variable to hold the numeric ID of each device in turn */
362 wxString device;
363 wxString recDevice;
364
365 recDevice = mRecordDevice;
366 if (!this->mRecordSource.empty())
367 recDevice += wxT(": ") + mRecordSource;
368
369 mRecord->Clear();
370 for (i = 0; i < inMaps.size(); i++) {
371 if (index == inMaps[i].hostIndex) {
372 device = MakeDeviceSourceString(&inMaps[i]);
373 devindex = mRecord->Append(device);
374 // We need to const cast here because SetClientData is a wx function
375 // It is okay because the original variable is non-const.
376 mRecord->SetClientData(devindex, const_cast<DeviceSourceMap *>(&inMaps[i]));
377 if (device == recDevice) { /* if this is the default device, select it */
378 mRecord->SetSelection(devindex);
379 }
380 }
381 }
382
383 mPlay->Clear();
384 for (i = 0; i < outMaps.size(); i++) {
385 if (index == outMaps[i].hostIndex) {
386 device = MakeDeviceSourceString(&outMaps[i]);
387 devindex = mPlay->Append(device);
388 mPlay->SetClientData(devindex, const_cast<DeviceSourceMap *>(&outMaps[i]));
389 if (device == mPlayDevice) { /* if this is the default device, select it */
390 mPlay->SetSelection(devindex);
391 }
392 }
393 }
394
395 /* deal with not having any devices at all */
396 if (mPlay->GetCount() == 0) {
397 playnames.push_back(_("No devices found"));
398 mPlay->Append(playnames[0], (void *) NULL);
399 mPlay->SetSelection(0);
400 }
401 if (mRecord->GetCount() == 0) {
402 recordnames.push_back(_("No devices found"));
403 mRecord->Append(recordnames[0], (void *) NULL);
404 mRecord->SetSelection(0);
405 }
406
407 /* what if we have no device selected? we should choose the default on
408 * this API, as defined by PortAudio. We then fall back to using 0 only if
409 * that fails */
410 if (mPlay->GetCount() && mPlay->GetSelection() == wxNOT_FOUND) {
412 if (defaultMap)
413 mPlay->SetStringSelection(MakeDeviceSourceString(defaultMap));
414
415 if (mPlay->GetSelection() == wxNOT_FOUND) {
416 mPlay->SetSelection(0);
417 }
418 }
419
420 if (mRecord->GetCount() && mRecord->GetSelection() == wxNOT_FOUND) {
422 if (defaultMap)
423 mRecord->SetStringSelection(MakeDeviceSourceString(defaultMap));
424
425 if (mPlay->GetSelection() == wxNOT_FOUND) {
426 mPlay->SetSelection(0);
427 }
428 }
429
430 ShuttleGui::SetMinSize(mPlay, mPlay->GetStrings());
431 ShuttleGui::SetMinSize(mRecord, mRecord->GetStrings());
432 OnDevice(e);
433}
wxString MakeDeviceSourceString(const DeviceSourceMap *map)
DeviceSourceMap * GetDefaultInputDevice(int hostIndex)
const std::vector< DeviceSourceMap > & GetInputDeviceMaps()
const std::vector< DeviceSourceMap > & GetOutputDeviceMaps()
static DeviceManager * Instance()
Gets the singleton instance.
DeviceSourceMap * GetDefaultOutputDevice(int hostIndex)
void OnDevice(wxCommandEvent &e)
wxChoice * mHost
Definition: DevicePrefs.h:57
wxString mRecordDevice
Definition: DevicePrefs.h:53
wxString mPlayDevice
Definition: DevicePrefs.h:52
wxString mRecordSource
Definition: DevicePrefs.h:54

References _, DeviceManager::GetDefaultInputDevice(), DeviceManager::GetDefaultOutputDevice(), DeviceManager::GetInputDeviceMaps(), DeviceManager::GetOutputDeviceMaps(), DeviceManager::Instance(), MakeDeviceSourceString(), mHost, mHostLabels, mHostNames, mPlay, mPlayDevice, mRecord, mRecordDevice, mRecordSource, name, OnDevice(), ShuttleGui::SetMinSize(), and wxT().

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnProjectSampleRateChoice()

void DevicePrefs::OnProjectSampleRateChoice ( wxCommandEvent &  e)
private

Definition at line 505 of file DevicePrefs.cpp.

506{
507 if (mProjectSampleRates == nullptr)
508 return;
509
510 const int sel = mProjectSampleRates->GetSelection();
512 sel == (int)mProjectSampleRates->GetCount() - 1);
513}

References mOtherProjectSampleRate, and mProjectSampleRates.

Referenced by Populate().

Here is the caller graph for this function:

◆ Populate()

void DevicePrefs::Populate ( )
private

Definition at line 96 of file DevicePrefs.cpp.

97{
98 // First any pre-processing for constructing the GUI.
100
103 ProjectRate::Get(*mProject).GetRate() :
105
106 auto it = std::find(
109
111 mSampleRateNames.size() - 1 :
112 std::distance(mSampleRateValues.begin(), it);
113
114 // Get current setting for devices
119
120 //------------------------- Main section --------------------
121 // Now construct the GUI itself.
122 // Use 'eIsCreatingFromPrefs' so that the GUI is
123 // initialised with values from gPrefs.
126 // ----------------------- End of main section --------------
127
128 wxCommandEvent e;
129 OnHost(e);
132}
@ eIsCreatingFromPrefs
Definition: ShuttleGui.h:46
void OnProjectSampleRateChoice(wxCommandEvent &e)
void OnDefaultSampleRateChoice(wxCommandEvent &e)
void OnHost(wxCommandEvent &e)
void GetNamesAndLabels()
int mProjectSampleRateIndex
Definition: DevicePrefs.h:65
double GetRate() const
Definition: ProjectRate.cpp:53
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207

References AudioIOPlaybackDevice, AudioIORecordChannels, AudioIORecordingDevice, AudioIORecordingSource, QualitySettings::DefaultSampleRate, eIsCreatingFromPrefs, ProjectRate::Get(), GetNamesAndLabels(), ProjectRate::GetRate(), mOtherDefaultSampleRateValue, mOtherProjectSampleRateValue, mPlayDevice, mProject, mProjectSampleRateIndex, mRecordChannels, mRecordDevice, mRecordSource, mSampleRateNames, mSampleRateValues, OnDefaultSampleRateChoice(), OnHost(), OnProjectSampleRateChoice(), PopulateOrExchange(), Setting< T >::Read(), and S.

Here is the call graph for this function:

◆ PopulateOrExchange()

void DevicePrefs::PopulateOrExchange ( ShuttleGui S)
override

Definition at line 184 of file DevicePrefs.cpp.

185{
186 ChoiceSetting HostSetting{
189 };
190 S.SetBorder(2);
191 S.StartScroller();
192
193 /* i18n-hint Software interface to audio devices */
194 S.StartStatic(XC("Interface", "device"));
195 {
196 S.StartMultiColumn(2);
197 {
198 S.Id(HostID);
199 mHost = S.TieChoice( XXO("&Host:"), HostSetting);
200
201 S.AddPrompt(XXO("Using:"));
202 S.AddFixedText( Verbatim(wxSafeConvertMB2WX(Pa_GetVersionText() ) ) );
203 }
204 S.EndMultiColumn();
205 }
206 S.EndStatic();
207
208 S.StartStatic(XO("Playback"));
209 {
210 S.StartMultiColumn(2);
211 {
212 S.Id(PlayID);
213 mPlay = S.AddChoice(XXO("&Device:"),
214 {} );
215 }
216 S.EndMultiColumn();
217 }
218 S.EndStatic();
219
220 // i18n-hint: modifier as in "Recording preferences", not progressive verb
221 S.StartStatic(XC("Recording", "preference"));
222 {
223 S.StartMultiColumn(2);
224 {
225 S.Id(RecordID);
226 mRecord = S.AddChoice(XXO("De&vice:"),
227 {} );
228
229 S.Id(ChannelsID);
230 mChannels = S.AddChoice(XXO("Cha&nnels:"),
231 {} );
232 }
233 S.EndMultiColumn();
234 }
235 S.EndStatic();
236
237
238 S.StartStatic(XO("Quality"));
239 {
240 S.StartMultiColumn(2);
241 {
242 if (mProject)
243 {
244 S.AddPrompt(XXO("&Project Sample Rate:"));
245
246 S.StartMultiColumn(3);
247 {
251
252 // Now do the edit box...
254 S.TieNumericTextBox({}, mOtherProjectSampleRateValue, 15);
255
256 auto helpBtn = S.AddBitmapButton(theTheme.Bitmap(bmpHelpIcon));
257
258 const auto helpText =
259 XO("Sample Rate used when recording new tracks, mixing down tracks and for playback in this project.")
260 .Translation();
261
262 helpBtn->SetToolTip(helpText);
263 helpBtn->SetLabel(helpText); // for screen readers
264 helpBtn->SetName(helpText);
265 }
266 S.EndMultiColumn();
267 }
268 }
269
270 S.AddPrompt(XXO("D&efault Sample Rate:"));
271
272 S.StartMultiColumn(2);
273 {
276 .TieNumberAsChoice(
279
281 S.TieNumericTextBox({}, mOtherDefaultSampleRateValue, 15);
282 }
283 S.EndMultiColumn();
284
285 S.TieChoice(
286 XXO("Default Sample &Format:"), QualitySettings::SampleFormatSetting);
287
288 S.EndMultiColumn();
289 }
290 S.EndStatic();
291
292 // These previously lived in recording preferences.
293 // However they are liable to become device specific.
294 // Buffering also affects playback, not just recording, so is a device characteristic.
295 S.StartStatic( XO("Latency"));
296 {
297 S.StartThreeColumn();
298 {
299 wxTextCtrl *w;
300 // only show the following controls if we use Portaudio v19, because
301 // for Portaudio v18 we always use default buffer sizes
302 w = S
303 .NameSuffix(XO("milliseconds"))
304 .TieNumericTextBox(XXO("&Buffer length:"),
306 25);
307 S.AddUnits(XO("milliseconds"));
308
309 w = S
310 .NameSuffix(XO("milliseconds"))
311 .TieNumericTextBox(XXO("&Latency compensation:"),
313 S.AddUnits(XO("milliseconds"));
314 }
315 S.EndThreeColumn();
316 }
317 S.EndStatic();
318
319 S.EndScroller();
320
321}
StringSetting AudioIOHost
@ ChannelsID
Definition: DevicePrefs.cpp:57
@ DefaultSampleRateChoice
Definition: DevicePrefs.cpp:58
@ PlayID
Definition: DevicePrefs.cpp:55
@ HostID
Definition: DevicePrefs.cpp:54
@ RecordID
Definition: DevicePrefs.cpp:56
@ ProjectSampleRateChoice
Definition: DevicePrefs.cpp:59
XXO("&Cut/Copy/Paste Toolbar")
#define XC(s, c)
Definition: Internat.h:37
ByColumns_t ByColumns
Definition: Prefs.cpp:515
THEME_API Theme theTheme
Definition: Theme.cpp:82
wxBitmap & Bitmap(int iIndex)
PROJECT_RATE_API EnumSetting< sampleFormat > SampleFormatSetting

References AudioIOHost, AudioIOLatencyCorrection, AudioIOLatencyDuration, ThemeBase::Bitmap(), ByColumns, ChannelsID, QualitySettings::DefaultSampleRate, DefaultSampleRateChoice, HostID, mChannels, mDefaultSampleRates, mHost, mHostLabels, mHostNames, mOtherDefaultSampleRate, mOtherDefaultSampleRateValue, mOtherProjectSampleRate, mOtherProjectSampleRateValue, mPlay, mProject, mProjectSampleRateIndex, mProjectSampleRates, mRecord, mSampleRateNames, mSampleRateValues, PlayID, ProjectSampleRateChoice, RecordID, S, QualitySettings::SampleFormatSetting, theTheme, Verbatim(), XC, XO(), and XXO().

Referenced by Commit(), and Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mChannels

wxChoice* DevicePrefs::mChannels
private

Definition at line 60 of file DevicePrefs.h.

Referenced by Commit(), OnDevice(), and PopulateOrExchange().

◆ mDefaultSampleRates

wxChoice* DevicePrefs::mDefaultSampleRates
private

Definition at line 68 of file DevicePrefs.h.

Referenced by OnDefaultSampleRateChoice(), and PopulateOrExchange().

◆ mHost

wxChoice* DevicePrefs::mHost
private

Definition at line 57 of file DevicePrefs.h.

Referenced by OnHost(), and PopulateOrExchange().

◆ mHostLabels

wxArrayStringEx DevicePrefs::mHostLabels
private

Definition at line 50 of file DevicePrefs.h.

Referenced by GetNamesAndLabels(), OnHost(), and PopulateOrExchange().

◆ mHostNames

TranslatableStrings DevicePrefs::mHostNames
private

Definition at line 49 of file DevicePrefs.h.

Referenced by GetNamesAndLabels(), OnHost(), and PopulateOrExchange().

◆ mOtherDefaultSampleRate

wxTextCtrl* DevicePrefs::mOtherDefaultSampleRate
private

Definition at line 69 of file DevicePrefs.h.

Referenced by Commit(), OnDefaultSampleRateChoice(), and PopulateOrExchange().

◆ mOtherDefaultSampleRateValue

int DevicePrefs::mOtherDefaultSampleRateValue
private

Definition at line 70 of file DevicePrefs.h.

Referenced by Commit(), Populate(), and PopulateOrExchange().

◆ mOtherProjectSampleRate

wxTextCtrl* DevicePrefs::mOtherProjectSampleRate { nullptr }
private

Definition at line 63 of file DevicePrefs.h.

Referenced by Commit(), OnProjectSampleRateChoice(), and PopulateOrExchange().

◆ mOtherProjectSampleRateValue

int DevicePrefs::mOtherProjectSampleRateValue
private

Definition at line 66 of file DevicePrefs.h.

Referenced by Commit(), Populate(), and PopulateOrExchange().

◆ mPlay

wxChoice* DevicePrefs::mPlay
private

Definition at line 58 of file DevicePrefs.h.

Referenced by Commit(), OnHost(), and PopulateOrExchange().

◆ mPlayDevice

wxString DevicePrefs::mPlayDevice
private

Definition at line 52 of file DevicePrefs.h.

Referenced by OnHost(), and Populate().

◆ mProject

AudacityProject* DevicePrefs::mProject
private

Definition at line 47 of file DevicePrefs.h.

Referenced by Commit(), Populate(), and PopulateOrExchange().

◆ mProjectSampleRateIndex

int DevicePrefs::mProjectSampleRateIndex
private

Definition at line 65 of file DevicePrefs.h.

Referenced by Populate(), and PopulateOrExchange().

◆ mProjectSampleRates

wxChoice* DevicePrefs::mProjectSampleRates { nullptr }
private

Definition at line 62 of file DevicePrefs.h.

Referenced by Commit(), OnProjectSampleRateChoice(), and PopulateOrExchange().

◆ mRecord

wxChoice* DevicePrefs::mRecord
private

Definition at line 59 of file DevicePrefs.h.

Referenced by Commit(), OnDevice(), OnHost(), and PopulateOrExchange().

◆ mRecordChannels

long DevicePrefs::mRecordChannels
private

Definition at line 55 of file DevicePrefs.h.

Referenced by OnDevice(), and Populate().

◆ mRecordDevice

wxString DevicePrefs::mRecordDevice
private

Definition at line 53 of file DevicePrefs.h.

Referenced by OnHost(), and Populate().

◆ mRecordSource

wxString DevicePrefs::mRecordSource
private

Definition at line 54 of file DevicePrefs.h.

Referenced by OnHost(), and Populate().

◆ mSampleRateNames

TranslatableStrings DevicePrefs::mSampleRateNames
private

Definition at line 72 of file DevicePrefs.h.

Referenced by GetNamesAndLabels(), Populate(), and PopulateOrExchange().

◆ mSampleRateValues

std::vector<int> DevicePrefs::mSampleRateValues
private

Definition at line 73 of file DevicePrefs.h.

Referenced by Commit(), GetNamesAndLabels(), Populate(), and PopulateOrExchange().


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