34#include <wx/combobox.h>
36#include <wx/textctrl.h>
37#include <wx/bmpbuttn.h>
52#define ID_DEFAULT_SAMPLE_RATE_CHOICE 7001
89 return XO(
"Audio Settings");
94 return "Devices_Preferences";
144 int nDevices = Pa_GetDeviceCount();
145 for (
int i = 0; i < nDevices; i++) {
146 const PaDeviceInfo *info = Pa_GetDeviceInfo(i);
147 if ((info!=NULL)&&(info->maxOutputChannels > 0 || info->maxInputChannels > 0)) {
148 wxString
name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(info->hostApi)->name);
195 S.StartStatic(
XC(
"Interface",
"device"));
197 S.StartMultiColumn(2);
200 mHost =
S.TieChoice(
XXO(
"&Host:"), HostSetting);
202 S.AddPrompt(
XXO(
"Using:"));
203 S.AddFixedText(
Verbatim(wxSafeConvertMB2WX(Pa_GetVersionText() ) ) );
209 S.StartStatic(
XO(
"Playback"));
211 S.StartMultiColumn(2);
222 S.StartStatic(
XC(
"Recording",
"preference"));
224 S.StartMultiColumn(2);
239 S.StartStatic(
XO(
"Quality"));
241 S.StartMultiColumn(2);
245 S.AddPrompt(
XXO(
"&Project Sample Rate:"));
247 S.StartMultiColumn(3);
259 const auto helpText =
260 XO(
"Sample Rate used when recording new tracks, mixing down tracks and for playback in this project.")
263 helpBtn->SetToolTip(helpText);
264 helpBtn->SetLabel(helpText);
265 helpBtn->SetName(helpText);
271 S.AddPrompt(
XXO(
"D&efault Sample Rate:"));
273 S.StartMultiColumn(2);
296 S.StartStatic(
XO(
"Latency"));
298 S.StartThreeColumn();
304 .NameSuffix(
XO(
"milliseconds"))
305 .TieNumericTextBox(
XXO(
"&Buffer length:"),
308 S.AddUnits(
XO(
"milliseconds"));
311 .NameSuffix(
XO(
"milliseconds"))
312 .TieNumericTextBox(
XXO(
"&Latency compensation:"),
314 S.AddUnits(
XO(
"milliseconds"));
333 int nHosts = Pa_GetHostApiCount();
334 for (
int i = 0; i < nHosts; ++i) {
335 wxString
name = wxSafeConvertMB2WX(Pa_GetHostApiInfo(i)->
name);
336 if (
name == apiName) {
343 wxLogDebug(
wxT(
"DevicePrefs::OnHost(): API index not found"));
347 int nDevices = Pa_GetDeviceCount();
352 mHost->Append(
_(
"No audio interfaces"), (
void *) NULL);
353 mHost->SetSelection(0);
359 wxArrayString playnames;
360 wxArrayString recordnames;
371 for (i = 0; i < inMaps.size(); i++) {
372 if (index == inMaps[i].hostIndex) {
374 devindex =
mRecord->Append(device);
378 if (device == recDevice) {
379 mRecord->SetSelection(devindex);
385 for (i = 0; i < outMaps.size(); i++) {
386 if (index == outMaps[i].hostIndex) {
388 devindex =
mPlay->Append(device);
391 mPlay->SetSelection(devindex);
397 if (
mPlay->GetCount() == 0) {
398 playnames.push_back(
_(
"No devices found"));
399 mPlay->Append(playnames[0], (
void *) NULL);
400 mPlay->SetSelection(0);
402 if (
mRecord->GetCount() == 0) {
403 recordnames.push_back(
_(
"No devices found"));
404 mRecord->Append(recordnames[0], (
void *) NULL);
411 if (
mPlay->GetCount() &&
mPlay->GetSelection() == wxNOT_FOUND) {
416 if (
mPlay->GetSelection() == wxNOT_FOUND) {
417 mPlay->SetSelection(0);
421 if (
mRecord->GetCount() &&
mRecord->GetSelection() == wxNOT_FOUND) {
426 if (
mPlay->GetSelection() == wxNOT_FOUND) {
427 mPlay->SetSelection(0);
438 int ndx =
mRecord->GetCurrentSelection();
439 if (ndx == wxNOT_FOUND) {
451 if (sel != wxNOT_FOUND) {
472 for (
int i = 0; i < cnt; i++) {
476 name =
_(
"1 (Mono)");
479 name =
_(
"2 (Stereo)");
482 name = wxString::Format(
wxT(
"%d"), i + 1);
485 channelnames.push_back(
name);
522 if (
mPlay->GetCount() > 0) {
524 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
const TranslatableString name
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