Audacity  3.0.3
DeviceToolBar.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  DeviceToolBar.cpp
6 
7  Dominic Mazzoni
8 
9 *******************************************************************//*******************************************************************/
15 
16 
17 
18 #include "DeviceToolBar.h"
19 #include "ToolManager.h"
20 
21 // For compilers that support precompilation, includes "wx/wx.h".
22 #include <wx/wxprec.h>
23 
24 #include <wx/setup.h> // for wxUSE_* macros
25 
26 #ifndef WX_PRECOMP
27 #include <wx/app.h>
28 #include <wx/choice.h>
29 #include <wx/event.h>
30 #include <wx/intl.h>
31 #include <wx/settings.h>
32 #include <wx/sizer.h>
33 #include <wx/statbmp.h>
34 #include <wx/stattext.h>
35 #include <wx/tooltip.h>
36 #endif
37 
38 #include "../TrackPanel.h"
39 
40 #include "AColor.h"
41 #include "AllThemeResources.h"
42 #include "AudioIOBase.h"
43 #include "ImageManipulation.h"
44 #include "../KeyboardCapture.h"
45 #include "Prefs.h"
46 #include "Project.h"
47 #include "../ShuttleGui.h"
48 #include "../widgets/Grabber.h"
49 #include "DeviceManager.h"
50 #include "../widgets/AudacityMessageBox.h"
51 #include "../widgets/Grabber.h"
52 
53 #if wxUSE_ACCESSIBILITY
54 #include "../widgets/WindowAccessible.h"
55 #endif
56 
58 
62 
63 BEGIN_EVENT_TABLE(DeviceToolBar, ToolBar)
64  EVT_CHOICE(wxID_ANY, DeviceToolBar::OnChoice)
65  EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, DeviceToolBar::OnCaptureKey)
67 
69 {
70  static int value = wxNewId();
71  return value;
72 }
73 
74 //Standard constructor
76 : ToolBar( project, DeviceBarID, XO("Device"), wxT("Device"), true )
77 {
78  DeviceManager::Instance()->Bind( EVT_RESCANNED_DEVICES,
80 }
81 
83 {
84 }
85 
87 {
88  auto &toolManager = ToolManager::Get( project );
89  return *static_cast<DeviceToolBar*>( toolManager.GetToolBar(DeviceBarID) );
90 }
91 
93 {
94  return Get( const_cast<AudacityProject&>( project )) ;
95 }
96 
97 void DeviceToolBar::Create(wxWindow *parent)
98 {
99  ToolBar::Create(parent);
100 
101  // Simulate a size event to set initial meter placement/size
102  wxSizeEvent event(GetSize(), GetId());
103  event.SetEventObject(this);
104  GetEventHandler()->ProcessEvent(event);
105 }
106 
108 {
109  mInput = NULL;
110  mOutput = NULL;
111  mInputChannels = NULL;
112  mHost = NULL;
113 }
114 
116 {
117  SetBackgroundColour( theTheme.Colour( clrMedium ) );
118  DeinitChildren();
119 
120  // Hosts
121  mHost = safenew wxChoice(this,
122  wxID_ANY,
123  wxDefaultPosition,
124  wxDefaultSize);
125 #if wxUSE_ACCESSIBILITY
126  // so that name can be set on a standard control
127  mHost->SetAccessible(safenew WindowAccessible(mHost));
128 #endif
129  Add(mHost, 15, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 1);
130 
131  // Input device
133  wxID_ANY,
134  theTheme.Bitmap(bmpMic)), 0, wxALIGN_CENTER_VERTICAL);
135  mInput = safenew wxChoice(this,
136  wxID_ANY,
137  wxDefaultPosition,
138  wxDefaultSize);
139 #if wxUSE_ACCESSIBILITY
140  // so that name can be set on a standard control
141  mInput->SetAccessible(safenew WindowAccessible(mInput));
142 #endif
143  Add(mInput, 30, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 1);
144 
145  // Input channels
146  mInputChannels = safenew wxChoice(this,
147  wxID_ANY,
148  wxDefaultPosition,
149  wxDefaultSize);
150 #if wxUSE_ACCESSIBILITY
151  // so that name can be set on a standard control
153 #endif
154  Add(mInputChannels, 20, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 1);
155 
156  // Output device
158  wxID_ANY,
159  theTheme.Bitmap(bmpSpeaker)), 0, wxALIGN_CENTER_VERTICAL);
160  mOutput = safenew wxChoice(this,
161  wxID_ANY,
162  wxDefaultPosition,
163  wxDefaultSize);
164 #if wxUSE_ACCESSIBILITY
165  // so that name can be set on a standard control
166  mOutput->SetAccessible(safenew WindowAccessible(mOutput));
167 #endif
168  Add(mOutput, 30, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 1);
169 
170 #if defined(__WXGTK3__)
171  // Nothing special
172 #elif defined(__WXGTK__)
173  // Scale the font to fit inside (hopefully)
174  wxFont font = mHost->GetFont();
175  font.Scale((double) toolbarSingle / mHost->GetSize().GetHeight());
176 
177  // Set it
178  mHost->SetFont(font);
179  mInput->SetFont(font);
180  mInputChannels->SetFont(font);
181  mOutput->SetFont(font);
182 #endif
183 
184  mHost->Bind(wxEVT_SET_FOCUS,
186  this);
187  mHost->Bind(wxEVT_KILL_FOCUS,
189  this);
190  mOutput->Bind(wxEVT_SET_FOCUS,
192  this);
193  mOutput->Bind(wxEVT_KILL_FOCUS,
195  this);
196  mInput->Bind(wxEVT_SET_FOCUS,
198  this);
199  mInput->Bind(wxEVT_KILL_FOCUS,
201  this);
202  mInputChannels->Bind(wxEVT_SET_FOCUS,
204  this);
205  mInputChannels->Bind(wxEVT_KILL_FOCUS,
207  this);
208 
209  SetNames();
210 
211  RefillCombos();
212 }
213 
214 void DeviceToolBar::OnFocus(wxFocusEvent &event)
215 {
216  KeyboardCapture::OnFocus( *this, event );
217 }
218 
219 void DeviceToolBar::OnCaptureKey(wxCommandEvent &event)
220 {
221  wxKeyEvent *kevent = (wxKeyEvent *)event.GetEventObject();
222  int keyCode = kevent->GetKeyCode();
223 
224  // Pass UP/DOWN/LEFT/RIGHT through for input/output choice
225  if (FindFocus() == mInput && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
226  || keyCode == WXK_UP || keyCode == WXK_DOWN)) {
227  return;
228  }
229 
230  if (FindFocus() == mOutput && (keyCode == WXK_LEFT || keyCode == WXK_RIGHT
231  || keyCode == WXK_UP || keyCode == WXK_DOWN)) {
232  return;
233  }
234  event.Skip();
235 
236  return;
237 }
238 
240 {
241  wxString desc;
242  const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
243  const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
244 
245 
246  int hostSelectionIndex = mHost->GetSelection();
247  wxString oldHost = hostSelectionIndex >= 0 ? mHost->GetString(hostSelectionIndex) :
248  wxString{};
249  auto hostName = AudioIOHost.Read();
250 
251  // if the prefs host name doesn't match the one displayed, it changed
252  // in another project's DeviceToolBar, so we need to repopulate everything.
253  if (oldHost != hostName)
254  FillHostDevices();
255 
256  auto devName = AudioIORecordingDevice.Read();
257  auto sourceName = AudioIORecordingSource.Read();
258  if (sourceName.empty())
259  desc = devName;
260  else
261  desc = devName + wxT(": ") + sourceName;
262 
263  if (mInput->GetStringSelection() != desc &&
264  mInput->FindString(desc) != wxNOT_FOUND) {
265  mInput->SetStringSelection(desc);
267  } else if (mInput->GetStringSelection() != desc && mInput->GetCount()) {
268  for (size_t i = 0; i < inMaps.size(); i++) {
269  if (inMaps[i].hostString == hostName &&
270  MakeDeviceSourceString(&inMaps[i]) == mInput->GetString(0)) {
271  // use the default. It should exist but check just in case, falling back on the 0 index.
272  DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultInputDevice(inMaps[i].hostIndex);
273  if (defaultMap) {
274  mInput->SetStringSelection(MakeDeviceSourceString(defaultMap));
275  SetDevices(defaultMap, NULL);
276  } else {
277  //use the first item (0th index) if we have no familiar devices
278  mInput->SetSelection(0);
279  SetDevices(&inMaps[i], NULL);
280  }
281  break;
282  }
283  }
284  }
285 
286  devName = AudioIOPlaybackDevice.Read();
287  sourceName = gPrefs->Read(wxT("/AudioIO/PlaybackSource"), wxT(""));
288  if (sourceName.empty())
289  desc = devName;
290  else
291  desc = devName + wxT(": ") + sourceName;
292 
293  if (mOutput->GetStringSelection() != desc &&
294  mOutput->FindString(desc) != wxNOT_FOUND) {
295  mOutput->SetStringSelection(desc);
296  } else if (mOutput->GetStringSelection() != desc &&
297  mOutput->GetCount()) {
298  for (size_t i = 0; i < outMaps.size(); i++) {
299  if (outMaps[i].hostString == hostName &&
300  MakeDeviceSourceString(&outMaps[i]) == mOutput->GetString(0)) {
301  // use the default. It should exist but check just in case, falling back on the 0 index.
302  DeviceSourceMap *defaultMap = DeviceManager::Instance()->GetDefaultOutputDevice(outMaps[i].hostIndex);
303  if (defaultMap) {
304  mOutput->SetStringSelection(MakeDeviceSourceString(defaultMap));
305  SetDevices(NULL, defaultMap);
306  } else {
307  //use the first item (0th index) if we have no familiar devices
308  mOutput->SetSelection(0);
309  SetDevices(NULL, &outMaps[i]);
310  }
311  break;
312  }
313  }
314  }
315 
316  long oldChannels;
317  oldChannels = mInputChannels->GetSelection() + 1;
318  auto newChannels = AudioIORecordChannels.ReadWithDefault(0);
319  if (newChannels > 0 && oldChannels != newChannels)
320  mInputChannels->SetSelection(newChannels - 1);
321 
322  if (!hostName.empty() && mHost->GetStringSelection() != hostName)
323  mHost->SetStringSelection(hostName);
324 
326 
327  // Set label to pull in language change
328  SetLabel(XO("Device"));
329 
330  // Give base class a chance
332 
333  Layout();
334  Refresh();
335 }
336 
338 {
339  if (id == DeviceToolbarPrefsID())
340  UpdatePrefs();
342 }
343 
344 
346 {
347  auto gAudioIO = AudioIOBase::Get();
348  if (gAudioIO) {
349  // we allow changes when monitoring, but not when recording
350  bool audioStreamActive = gAudioIO->IsStreamActive() && !gAudioIO->IsMonitoring();
351 
352  // Here we should relinquish focus
353  if (audioStreamActive) {
354  wxWindow *focus = wxWindow::FindFocus();
355  if (focus == mHost || focus == mInput || focus == mOutput || focus == mInputChannels)
356  TrackPanel::Get( mProject ).SetFocus();
357  }
358 
359  mHost->Enable(!audioStreamActive);
360  mInput->Enable(!audioStreamActive);
361  mOutput->Enable(!audioStreamActive);
362  mInputChannels->Enable(!audioStreamActive);
363  }
364 }
365 
367 {
368  /* i18n-hint: (noun) It's the device used for playback.*/
369  mOutput->SetName(_("Playback Device"));
370  /* i18n-hint: (noun) It's the device used for recording.*/
371  mInput->SetName(_("Recording Device"));
372  mHost->SetName(_("Audio Host"));
373  mInputChannels->SetName(_("Recording Channels"));
374 }
375 
377 {
378 #if wxUSE_TOOLTIPS
379  SetNames();
380  mOutput->SetToolTip(mOutput->GetName() + wxT(" - ") + mOutput->GetStringSelection());
381  mInput->SetToolTip(mInput->GetName() + wxT(" - ") + mInput->GetStringSelection());
382  mHost->SetToolTip(mHost->GetName() + wxT(" - ") + mHost->GetStringSelection());
383  mInputChannels->SetToolTip(mInputChannels->GetName() + wxT(" - ") + mInputChannels->GetStringSelection());
384 #endif
385 }
386 
388 {
389  FillHosts();
390  FillHostDevices();
392  // make the device display selection reflect the prefs if they exist
393  UpdatePrefs();
394 }
395 
397 {
398  const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
399  const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
400 
401  wxArrayString hosts;
402 
403  // go over our lists add the host to the list if it isn't there yet
404 
405  for (auto & device : inMaps) {
406  if (!make_iterator_range(hosts).contains(device.hostString)) {
407  hosts.push_back(device.hostString);
408  }
409  }
410 
411  for (auto & device : outMaps) {
412  if (!make_iterator_range(hosts).contains(device.hostString)) {
413  hosts.push_back(device.hostString);
414  }
415  }
416 
417  mHost->Clear();
418  mHost->Append(hosts);
419 
420  if (hosts.size() == 0) {
421  mHost->Enable(false);
422  }
423 
424  mHost->SetMinSize(wxSize(50, wxDefaultCoord));
425 }
426 
428 {
429  const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
430  const std::vector<DeviceSourceMap> &outMaps = DeviceManager::Instance()->GetOutputDeviceMaps();
431 
432  //read what is in the prefs
433  auto host = AudioIOHost.Read();
434  int foundHostIndex = -1;
435 
436  // if the host is not in the hosts combo then we rescanned.
437  // set it to blank so we search for another host.
438  if (mHost->FindString(host) == wxNOT_FOUND) {
439  host = wxT("");
440  }
441 
442  for (auto & device : outMaps) {
443  if (device.hostString == host) {
444  foundHostIndex = device.hostIndex;
445  break;
446  }
447  }
448 
449  if (foundHostIndex == -1) {
450  for (auto & device : inMaps) {
451  if (device.hostString == host) {
452  foundHostIndex = device.hostIndex;
453  break;
454  }
455  }
456  }
457 
458  // If no host was found based on the prefs device host, load the first available one
459  if (foundHostIndex == -1) {
460  if (outMaps.size()) {
461  foundHostIndex = outMaps[0].hostIndex;
462  }
463  else if (inMaps.size()) {
464  foundHostIndex = inMaps[0].hostIndex;
465  }
466  }
467 
468  // Make sure in/out are clear in case no host was found
469  mInput->Clear();
470  mOutput->Clear();
471 
472  // If we still have no host it means no devices, in which case do nothing.
473  if (foundHostIndex == -1) {
474  return;
475  }
476 
477  // Repopulate the Input/Output device list available to the user
478  for (auto & device : inMaps) {
479  if (foundHostIndex == device.hostIndex) {
480  mInput->Append(MakeDeviceSourceString(&device));
481  if (host.empty()) {
482  host = device.hostString;
483  AudioIOHost.Write(host);
484  mHost->SetStringSelection(host);
485  }
486  }
487  }
488  mInput->Enable(mInput->GetCount() ? true : false);
489 
490  mInput->SetMinSize(wxSize(50, wxDefaultCoord));
491 
492  for (auto & device : outMaps) {
493  if (foundHostIndex == device.hostIndex) {
494  mOutput->Append(MakeDeviceSourceString(&device));
495  if (host.empty()) {
496  host = device.hostString;
497  AudioIOHost.Write(host);
498  gPrefs->Flush();
499  mHost->SetStringSelection(host);
500  }
501  }
502  }
503  mOutput->Enable(mOutput->GetCount() ? true : false);
504 
505  mOutput->SetMinSize(wxSize(50, wxDefaultCoord));
506 
507  // The setting of the Device is left up to OnChoice
508 }
509 
511 {
512  const std::vector<DeviceSourceMap> &inMaps = DeviceManager::Instance()->GetInputDeviceMaps();
513  auto host = AudioIOHost.Read();
514  auto device = AudioIORecordingDevice.Read();
515  auto source = AudioIORecordingSource.Read();
516  long newChannels;
517 
518  auto oldChannels = AudioIORecordChannels.Read();
519  mInputChannels->Clear();
520  for (auto & dev: inMaps) {
521  if (source == dev.sourceString &&
522  device == dev.deviceString &&
523  host == dev.hostString) {
524 
525  // add one selection for each channel of this source
526  for (size_t j = 0; j < (unsigned int) dev.numChannels; j++) {
527  wxString name;
528 
529  if (j == 0) {
530  name = _("1 (Mono) Recording Channel");
531  }
532  else if (j == 1) {
533  name = _("2 (Stereo) Recording Channels");
534  }
535  else {
536  name = wxString::Format(wxT("%d"), (int) j + 1);
537  }
538  mInputChannels->Append(name);
539  }
540  newChannels = dev.numChannels;
541  if (oldChannels <= newChannels && oldChannels >= 1) {
542  newChannels = oldChannels;
543  }
544  if (newChannels >= 1) {
545  mInputChannels->SetSelection(newChannels - 1);
546  }
547  AudioIORecordChannels.Write(newChannels);
548  break;
549  }
550  }
551  mInputChannels->Enable(mInputChannels->GetCount() ? true : false);
552 
553  mInputChannels->SetMinSize(wxSize(50, wxDefaultCoord));
554 }
555 
556 void DeviceToolBar::OnRescannedDevices( wxEvent &event )
557 {
558  event.Skip();
559  // Hosts may have disappeared or appeared so a complete repopulate is needed.
560  RefillCombos();
561 }
562 
563 //return 1 if host changed, 0 otherwise.
565 {
566  int hostSelectionIndex;
567  hostSelectionIndex = mHost->GetSelection();
568 
569  auto oldHost = AudioIOHost.Read();
570  wxString newHost = hostSelectionIndex >= 0 ? mHost->GetString(hostSelectionIndex) :
571  oldHost;
572 
573  if (oldHost == newHost)
574  return 0;
575 
576  //change the host and switch to correct devices.
577  AudioIOHost.Write(newHost);
578  gPrefs->Flush();
579 
580  // populate the devices
581  FillHostDevices();
582 
583  return 1;
584 }
585 
587 {
588  if (in) {
591  if (in->totalSources >= 1)
593  else
595  gPrefs->Flush();
596 
598  }
599 
600  if (out) {
602  if (out->totalSources >= 1) {
603  gPrefs->Write(wxT("/AudioIO/PlaybackSource"), out->sourceString);
604  } else {
605  gPrefs->Write(wxT("/AudioIO/PlaybackSource"), wxT(""));
606  }
607  gPrefs->Flush();
608  }
609 }
610 
611 void DeviceToolBar::ChangeDevice(bool isInput)
612 {
613  int newIndex = -1;
614  wxChoice *combo = isInput ? mInput :mOutput;
615  size_t i;
616 
617  int selectionIndex = combo->GetSelection();
618  auto host = AudioIOHost.Read();
619  const std::vector<DeviceSourceMap> &maps = isInput ? DeviceManager::Instance()->GetInputDeviceMaps()
621 
622  // Find device indices for input and output
623  if (selectionIndex >= 0 ) {
624  wxString newDevice = combo->GetStringSelection();
625  for (i = 0; i < maps.size(); ++i) {
626  wxString name;
627  name = MakeDeviceSourceString(&maps[i]);
628  if (name == newDevice && maps[i].hostString == host) {
629  newIndex = i;
630  }
631  }
632  }
633 
634  if (newIndex < 0) {
635  wxLogDebug(wxT("DeviceToolBar::OnChoice(): couldn't find device indices"));
636  return;
637  }
638 
639  SetDevices(isInput ? &maps[newIndex] : NULL,
640  isInput ? NULL : &maps[newIndex]);
641 }
642 
643 void DeviceToolBar::OnChoice(wxCommandEvent &event)
644 {
645  wxObject *eventObject = event.GetEventObject();
646  //if we've changed hosts, we've handled the device switching already.
647  if (eventObject == mHost) {
648  ChangeHost();
649  } else if (eventObject == mInputChannels) {
650  int channelsSelectionIndex = mInputChannels->GetSelection();
651  if (channelsSelectionIndex >= 0)
652  AudioIORecordChannels.Write(channelsSelectionIndex + 1);
653  } else if (eventObject == mInput) {
654  ChangeDevice(true);
655  }
656  else if (eventObject == mOutput) {
657  ChangeDevice(false);
658  }
659 
660  auto gAudioIO = AudioIOBase::Get();
661  if (gAudioIO) {
662  // We cannot have gotten here if gAudioIO->IsAudioTokenActive(),
663  // per the setting of AudioIONotBusyFlag and AudioIOBusyFlag in
664  // AudacityProject::GetUpdateFlags().
665  // However, we can have an invalid audio token (so IsAudioTokenActive()
666  // is false), but be monitoring.
667  // If monitoring, have to stop the stream, so HandleDeviceChange() can work.
668  // We could disable the Preferences command while monitoring, i.e.,
669  // set AudioIONotBusyFlag/AudioIOBusyFlag according to monitoring, as well.
670  // Instead allow it because unlike recording, for example, monitoring
671  // is not clearly something that should prohibit changing device.
672  // TODO: We *could* be smarter in this method and call HandleDeviceChange()
673  // only when the device choices actually changed. True of lots of prefs!
674  // As is, we always stop monitoring before handling the device change.
675  if (gAudioIO->IsMonitoring())
676  {
677  gAudioIO->StopStream();
678  while (gAudioIO->IsBusy())
679  wxMilliSleep(100);
680  }
681  gAudioIO->HandleDeviceChange();
682  }
683 
685 }
686 
688 {
689  ShowComboDialog(mInput, XO("Select Recording Device"));
690 }
692 {
693  ShowComboDialog(mOutput, XO("Select Playback Device"));
694 }
696 {
697  ShowComboDialog(mHost, XO("Select Audio Host"));
698 }
700 {
701  ShowComboDialog(mInputChannels, XO("Select Recording Channels"));
702 }
703 
705 {
706  if (!combo || combo->GetCount() == 0) {
707  AudacityMessageBox( XO("Device information is not available.") );
708  return;
709  }
710 
711 #if USE_PORTMIXER
712  wxArrayStringEx inputSources = combo->GetStrings();
713 
714  wxDialogWrapper dlg(nullptr, wxID_ANY, title);
715  dlg.SetName();
716  ShuttleGui S(&dlg, eIsCreating);
717  wxChoice *c;
718 
719  S.StartVerticalLay(true);
720  {
721  S.StartHorizontalLay(wxCENTER, false);
722  {
723  c = S.AddChoice( Verbatim( combo->GetName() ),
724  transform_container<TranslatableStrings>( inputSources, Verbatim ),
725  combo->GetSelection());
726  c->SetMinSize(c->GetBestSize());
727  }
728  S.EndHorizontalLay();
729  }
730  S.EndVerticalLay();
731  S.AddStandardButtons();
732 
733  dlg.GetSizer()->SetSizeHints(&dlg);
734  dlg.Center();
735 
736  if (dlg.ShowModal() == wxID_OK)
737  {
738  wxCommandEvent dummyEvent;
739  dummyEvent.SetEventObject(combo);
740  // SetSelection() doesn't send an event, so we call OnChoice explicitly
741  combo->SetSelection(c->GetSelection());
742  OnChoice(dummyEvent);
743  }
744 #endif
745 }
746 
748  []( AudacityProject &project ){
749  return ToolBar::Holder{ safenew DeviceToolBar{ project } }; }
750 };
751 
752 namespace {
754  /* i18n-hint: Clicking this menu item shows the toolbar
755  that manages devices */
756  DeviceBarID, wxT("ShowDeviceTB"), XXO("&Device Toolbar")
757 };
758 }
759 
AudioIORecordingDevice
StringSetting AudioIORecordingDevice
Definition: AudioIOBase.cpp:945
DeviceToolBar::ChangeHost
int ChangeHost()
Definition: DeviceToolBar.cpp:564
DeviceToolBar::DeinitChildren
void DeinitChildren()
Definition: DeviceToolBar.cpp:107
AudioIOPlaybackDevice
StringSetting AudioIOPlaybackDevice
Definition: AudioIOBase.cpp:939
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
AudioIOBase.h
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ShuttleGuiBase::AddChoice
wxChoice * AddChoice(const TranslatableString &Prompt, const TranslatableStrings &choices, int Selected=-1)
Definition: ShuttleGui.cpp:398
ToolManager.h
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
make_iterator_range
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
Definition: MemoryX.h:551
DeviceToolBar::Create
void Create(wxWindow *parent) override
Definition: DeviceToolBar.cpp:97
DeviceToolBar::SetNames
void SetNames()
Definition: DeviceToolBar.cpp:366
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
DeviceToolBar::FillHosts
void FillHosts()
Definition: DeviceToolBar.cpp:396
IMPLEMENT_CLASS
IMPLEMENT_CLASS(DeviceToolBar, ToolBar)
DeviceToolBar
A toobar to allow easier changing of input and output devices .
Definition: DeviceToolBar.h:24
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
AllThemeResources.h
DeviceToolBar::Get
static DeviceToolBar & Get(AudacityProject &project)
Definition: DeviceToolBar.cpp:86
DeviceToolBar::ChangeDevice
void ChangeDevice(bool isInput)
Definition: DeviceToolBar.cpp:611
EVT_COMMAND
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, LabelDialog::OnFreqUpdate) LabelDialog
Definition: LabelDialog.cpp:92
Project.h
DeviceToolBar::ShowHostDialog
void ShowHostDialog()
Definition: DeviceToolBar.cpp:695
ToolBar::mProject
AudacityProject & mProject
Definition: ToolBar.h:235
DeviceToolBar::SetDevices
void SetDevices(const DeviceSourceMap *in, const DeviceSourceMap *out)
Definition: DeviceToolBar.cpp:586
ToolBar::SetLabel
void SetLabel(const wxString &label) override
Definition: ToolBar.cpp:398
Setting::Write
bool Write(const T &value)
Write value to config and return true if successful.
Definition: Prefs.h:172
DeviceToolBar::ShowComboDialog
void ShowComboDialog(wxChoice *combo, const TranslatableString &title)
Definition: DeviceToolBar.cpp:704
ToolManager::Get
static ToolManager & Get(AudacityProject &project)
Definition: ToolManager.cpp:356
DeviceBarID
@ DeviceBarID
Definition: ToolBar.h:81
DeviceToolBar::OnRescannedDevices
void OnRescannedDevices(wxEvent &)
Definition: DeviceToolBar.cpp:556
MakeDeviceSourceString
wxString MakeDeviceSourceString(const DeviceSourceMap *map)
Definition: DeviceManager.cpp:54
DeviceToolBar::mHost
wxChoice * mHost
Definition: DeviceToolBar.h:75
DeviceSourceMap::deviceString
wxString deviceString
Definition: DeviceManager.h:42
AStaticBitmap
A widget for bitmaps which ignores the erase event for flicker-free use.
Definition: Grabber.h:150
TrackPanel::Get
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:227
XO
#define XO(s)
Definition: Internat.h:31
DeviceToolBar::ShowChannelsDialog
void ShowChannelsDialog()
Definition: DeviceToolBar.cpp:699
ToolBar::Holder
wxWindowPtr< ToolBar > Holder
Definition: ToolBar.h:102
DeviceToolBar::ShowOutputDialog
void ShowOutputDialog()
Definition: DeviceToolBar.cpp:691
DeviceToolBar::OnCaptureKey
void OnCaptureKey(wxCommandEvent &event)
Definition: DeviceToolBar.cpp:219
factory
static RegisteredToolbarFactory factory
Definition: DeviceToolBar.cpp:747
DeviceToolBar.h
wxArrayStringEx
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Definition: wxArrayStringEx.h:18
PrefsListener::Broadcast
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
Definition: Prefs.cpp:100
AttachedToolBarMenuItem
Definition: ToolManager.h:224
desc
const TranslatableString desc
Definition: ExportPCM.cpp:58
DeviceSourceMap
Definition: DeviceManager.h:35
ThemeBase::Bitmap
wxBitmap & Bitmap(int iIndex)
Definition: Theme.cpp:1076
AudioIORecordingSourceIndex
IntSetting AudioIORecordingSourceIndex
Definition: AudioIOBase.cpp:949
Setting::Read
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:128
DeviceToolBar::FillInputChannels
void FillInputChannels()
Definition: DeviceToolBar.cpp:510
DeviceToolBar::ShowInputDialog
void ShowInputDialog()
Definition: DeviceToolBar.cpp:687
PrefsListener::UpdateSelectedPrefs
virtual void UpdateSelectedPrefs(int id)
Definition: Prefs.cpp:127
DeviceToolBar::RefillCombos
void RefillCombos()
Definition: DeviceToolBar.cpp:387
DeviceToolBar::UpdatePrefs
void UpdatePrefs() override
Definition: DeviceToolBar.cpp:239
DeviceToolBar::EnableDisableButtons
void EnableDisableButtons() override
Definition: DeviceToolBar.cpp:345
DeviceManager::GetDefaultOutputDevice
DeviceSourceMap * GetDefaultOutputDevice(int hostIndex)
Definition: DeviceManager.cpp:84
XXO
#define XXO(s)
Definition: Internat.h:44
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
DeviceToolBar::~DeviceToolBar
virtual ~DeviceToolBar()
Definition: DeviceToolBar.cpp:82
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
DeviceToolBar::DeviceToolBar
DeviceToolBar(AudacityProject &project)
Definition: DeviceToolBar.cpp:75
AudioIORecordingSource
StringSetting AudioIORecordingSource
Definition: AudioIOBase.cpp:947
ToolBar::UpdatePrefs
void UpdatePrefs() override
Definition: ToolBar.cpp:605
name
const TranslatableString name
Definition: Distortion.cpp:98
AudioIOBase::Get
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:89
DeviceToolBar::FillHostDevices
void FillHostDevices()
Definition: DeviceToolBar.cpp:427
WindowAccessible
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
DeviceToolBar::Populate
void Populate() override
Definition: DeviceToolBar.cpp:115
wxDialogWrapper::SetName
void SetName(const TranslatableString &title)
Definition: wxPanelWrapper.cpp:76
Setting::ReadWithDefault
bool ReadWithDefault(T *pVar, const T &defaultValue) const
overload of ReadWithDefault returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:134
ToolBar::Create
virtual void Create(wxWindow *parent)
Definition: ToolBar.cpp:475
DeviceSourceMap::totalSources
int totalSources
Definition: DeviceManager.h:39
theTheme
THEME_API Theme theTheme
Definition: Theme.cpp:79
DeviceSourceMap::sourceIndex
int sourceIndex
Definition: DeviceManager.h:37
DeviceManager.h
DeviceToolBar::RegenerateTooltips
void RegenerateTooltips() override
Definition: DeviceToolBar.cpp:376
RegisteredToolbarFactory
Definition: ToolBar.h:261
wxDialogWrapper
Definition: wxPanelWrapper.h:81
title
static const auto title
Definition: NoUpdatesAvailableDialog.cpp:22
FileConfig::Flush
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Definition: FileConfig.cpp:143
DeviceToolBar::mInputChannels
wxChoice * mInputChannels
Definition: DeviceToolBar.h:74
_
#define _(s)
Definition: Internat.h:75
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:92
DeviceToolbarPrefsID
static int DeviceToolbarPrefsID()
Methods for DeviceToolBar.
Definition: DeviceToolBar.cpp:68
AudioIOHost
StringSetting AudioIOHost
Definition: AudioIOBase.cpp:933
DeviceToolBar::OnChoice
void OnChoice(wxCommandEvent &event)
Definition: DeviceToolBar.cpp:643
DeviceManager::GetDefaultInputDevice
DeviceSourceMap * GetDefaultInputDevice(int hostIndex)
Definition: DeviceManager.cpp:88
DeviceManager::Instance
static DeviceManager * Instance()
Gets the singleton instance.
Definition: DeviceManager.cpp:35
Setting::Reset
bool Reset()
Reset to the default value.
Definition: Prefs.h:183
KeyboardCapture::OnFocus
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
Definition: KeyboardCapture.cpp:95
Verbatim
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Definition: TranslatableString.h:321
ToolBar
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:98
anonymous_namespace{DeviceToolBar.cpp}::sAttachment
AttachedToolBarMenuItem sAttachment
Definition: DeviceToolBar.cpp:753
ThemeBase::Colour
wxColour & Colour(int iIndex)
Definition: Theme.cpp:1057
DeviceManager::GetInputDeviceMaps
const std::vector< DeviceSourceMap > & GetInputDeviceMaps()
Definition: DeviceManager.cpp:40
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
DeviceSourceMap::sourceString
wxString sourceString
Definition: DeviceManager.h:41
DeviceManager::GetOutputDeviceMaps
const std::vector< DeviceSourceMap > & GetOutputDeviceMaps()
Definition: DeviceManager.cpp:46
Prefs.h
DeviceToolBar::UpdateSelectedPrefs
void UpdateSelectedPrefs(int) override
Definition: DeviceToolBar.cpp:337
DeviceToolBar::OnFocus
void OnFocus(wxFocusEvent &event)
Definition: DeviceToolBar.cpp:214
safenew
#define safenew
Definition: MemoryX.h:10
toolbarSingle
#define toolbarSingle
Definition: ToolBar.h:59
DeviceToolBar::mInput
wxChoice * mInput
Definition: DeviceToolBar.h:72
AColor.h
DeviceToolBar::mOutput
wxChoice * mOutput
Definition: DeviceToolBar.h:73
END_EVENT_TABLE
END_EVENT_TABLE()
ToolBar::Add
void Add(wxWindow *window, int proportion=0, int flag=wxALIGN_TOP, int border=0, wxObject *userData=NULL)
Definition: ToolBar.cpp:686
ImageManipulation.h
AudioIORecordChannels
IntSetting AudioIORecordChannels
Definition: AudioIOBase.cpp:943
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631