33#include <wx/combobox.h>
35#include <wx/textctrl.h>
36#include <wx/bmpbuttn.h>
51#define ID_DEFAULT_SAMPLE_RATE_CHOICE 7001
88 return XO(
"Audio Settings");
93 return "Devices_Preferences";
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);
194 S.StartStatic(
XC(
"Interface",
"device"));
196 S.StartMultiColumn(2);
199 mHost =
S.TieChoice(
XXO(
"&Host:"), HostSetting);
201 S.AddPrompt(
XXO(
"Using:"));
202 S.AddFixedText(
Verbatim(wxSafeConvertMB2WX(Pa_GetVersionText() ) ) );
208 S.StartStatic(
XO(
"Playback"));
210 S.StartMultiColumn(2);
221 S.StartStatic(
XC(
"Recording",
"preference"));
223 S.StartMultiColumn(2);
238 S.StartStatic(
XO(
"Quality"));
240 S.StartMultiColumn(2);
244 S.AddPrompt(
XXO(
"&Project Sample Rate:"));
246 S.StartMultiColumn(3);
258 const auto helpText =
259 XO(
"Sample Rate used when recording new tracks, mixing down tracks and for playback in this project.")
262 helpBtn->SetToolTip(helpText);
263 helpBtn->SetLabel(helpText);
264 helpBtn->SetName(helpText);
270 S.AddPrompt(
XXO(
"D&efault Sample Rate:"));
272 S.StartMultiColumn(2);
295 S.StartStatic(
XO(
"Latency"));
297 S.StartThreeColumn();
303 .NameSuffix(
XO(
"milliseconds"))
304 .TieNumericTextBox(
XXO(
"&Buffer length:"),
307 S.AddUnits(
XO(
"milliseconds"));
310 .NameSuffix(
XO(
"milliseconds"))
311 .TieNumericTextBox(
XXO(
"&Latency compensation:"),
313 S.AddUnits(
XO(
"milliseconds"));
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) {
342 wxLogDebug(
wxT(
"DevicePrefs::OnHost(): API index not found"));
346 int nDevices = Pa_GetDeviceCount();
351 mHost->Append(
_(
"No audio interfaces"), (
void *) NULL);
352 mHost->SetSelection(0);
358 wxArrayString playnames;
359 wxArrayString recordnames;
370 for (i = 0; i < inMaps.size(); i++) {
371 if (index == inMaps[i].hostIndex) {
373 devindex =
mRecord->Append(device);
377 if (device == recDevice) {
378 mRecord->SetSelection(devindex);
384 for (i = 0; i < outMaps.size(); i++) {
385 if (index == outMaps[i].hostIndex) {
387 devindex =
mPlay->Append(device);
390 mPlay->SetSelection(devindex);
396 if (
mPlay->GetCount() == 0) {
397 playnames.push_back(
_(
"No devices found"));
398 mPlay->Append(playnames[0], (
void *) NULL);
399 mPlay->SetSelection(0);
401 if (
mRecord->GetCount() == 0) {
402 recordnames.push_back(
_(
"No devices found"));
403 mRecord->Append(recordnames[0], (
void *) NULL);
410 if (
mPlay->GetCount() &&
mPlay->GetSelection() == wxNOT_FOUND) {
415 if (
mPlay->GetSelection() == wxNOT_FOUND) {
416 mPlay->SetSelection(0);
420 if (
mRecord->GetCount() &&
mRecord->GetSelection() == wxNOT_FOUND) {
425 if (
mPlay->GetSelection() == wxNOT_FOUND) {
426 mPlay->SetSelection(0);
437 int ndx =
mRecord->GetCurrentSelection();
438 if (ndx == wxNOT_FOUND) {
450 if (sel != wxNOT_FOUND) {
471 for (
int i = 0; i < cnt; i++) {
475 name =
_(
"1 (Mono)");
478 name =
_(
"2 (Stereo)");
481 name = wxString::Format(
wxT(
"%d"), i + 1);
484 channelnames.push_back(
name);
521 if (
mPlay->GetCount() > 0) {
523 mPlay->GetSelection());
DoubleSetting AudioIOLatencyCorrection
StringSetting AudioIORecordingSource
StringSetting AudioIOPlaybackDevice
DoubleSetting AudioIOLatencyDuration
StringSetting AudioIORecordingDevice
StringSetting AudioIOHost
IntSetting AudioIORecordingSourceIndex
IntSetting AudioIORecordChannels
wxString MakeDeviceSourceString(const DeviceSourceMap *map)
@ DefaultSampleRateChoice
@ ProjectSampleRateChoice
PrefsPanel * DevicePrefsFactory(wxWindow *parent, wxWindowID winid, AudacityProject *project)
#define DEVICE_PREFS_PLUGIN_SYMBOL
XXO("&Cut/Copy/Paste Toolbar")
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
audacity::BasicSettings * gPrefs
an object holding per-project preferred sample rate
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
static const int StandardRates[]
Array of common audio sample rates.
static const int NumStandardRates
How many standard sample rates there are.
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
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)
A PrefsPanel used to select recording and playback devices and other settings.
wxTextCtrl * mOtherProjectSampleRate
void OnDevice(wxCommandEvent &e)
wxChoice * mDefaultSampleRates
wxArrayStringEx mHostLabels
void OnProjectSampleRateChoice(wxCommandEvent &e)
wxTextCtrl * mOtherDefaultSampleRate
ComponentInterfaceSymbol GetSymbol() const override
void PopulateOrExchange(ShuttleGui &S) override
int mOtherDefaultSampleRateValue
TranslatableStrings mSampleRateNames
void OnDefaultSampleRateChoice(wxCommandEvent &e)
void OnHost(wxCommandEvent &e)
TranslatableString GetDescription() const override
wxChoice * mProjectSampleRates
ManualPageID HelpPageName() override
If not empty string, the Help button is added below the panel.
std::vector< int > mSampleRateValues
int mProjectSampleRateIndex
AudacityProject * mProject
int mOtherProjectSampleRateValue
TranslatableStrings mHostNames
Base class for a panel in the PrefsDialog. Classes derived from this class include BatchPrefs,...
static ProjectRate & Get(AudacityProject &project)
bool Write(const T &value)
Write value to config and return true if successful.
void Invalidate() override
bool Reset()
Reset to the default value.
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined */
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
static void SetMinSize(wxWindow *window, const TranslatableStrings &items)
wxBitmap & Bitmap(int iIndex)
Holds a msgid for the translation catalog; may also bind format arguments.
virtual bool Flush() noexcept=0
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
PROJECT_RATE_API IntSetting DefaultSampleRate
PROJECT_RATE_API EnumSetting< sampleFormat > SampleFormatSetting
PrefsPanel::Registration sAttachment