The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
5.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_AUDIODEVICESELECTORCOMPONENT_H_INCLUDED
  18. #define JUCE_AUDIODEVICESELECTORCOMPONENT_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A component containing controls to let the user change the audio settings of
  22. an AudioDeviceManager object.
  23. Very easy to use - just create one of these and show it to the user.
  24. @see AudioDeviceManager
  25. */
  26. class JUCE_API AudioDeviceSelectorComponent : public Component,
  27. private ComboBoxListener, // (can't use ComboBox::Listener due to idiotic VC2005 bug)
  28. private ChangeListener
  29. {
  30. public:
  31. //==============================================================================
  32. /** Creates the component.
  33. If your app needs only output channels, you might ask for a maximum of 0 input
  34. channels, and the component won't display any options for choosing the input
  35. channels. And likewise if you're doing an input-only app.
  36. @param deviceManager the device manager that this component should control
  37. @param minAudioInputChannels the minimum number of audio input channels that the application needs
  38. @param maxAudioInputChannels the maximum number of audio input channels that the application needs
  39. @param minAudioOutputChannels the minimum number of audio output channels that the application needs
  40. @param maxAudioOutputChannels the maximum number of audio output channels that the application needs
  41. @param showMidiInputOptions if true, the component will allow the user to select which midi inputs are enabled
  42. @param showMidiOutputSelector if true, the component will let the user choose a default midi output device
  43. @param showChannelsAsStereoPairs if true, channels will be treated as pairs; if false, channels will be
  44. treated as a set of separate mono channels.
  45. @param hideAdvancedOptionsWithButton if true, only the minimum amount of UI components
  46. are shown, with an "advanced" button that shows the rest of them
  47. */
  48. AudioDeviceSelectorComponent (AudioDeviceManager& deviceManager,
  49. int minAudioInputChannels,
  50. int maxAudioInputChannels,
  51. int minAudioOutputChannels,
  52. int maxAudioOutputChannels,
  53. bool showMidiInputOptions,
  54. bool showMidiOutputSelector,
  55. bool showChannelsAsStereoPairs,
  56. bool hideAdvancedOptionsWithButton);
  57. /** Destructor */
  58. ~AudioDeviceSelectorComponent();
  59. /** The device manager that this component is controlling */
  60. AudioDeviceManager& deviceManager;
  61. //==============================================================================
  62. /** @internal */
  63. void resized() override;
  64. /** @internal */
  65. void childBoundsChanged (Component*) override;
  66. private:
  67. //==============================================================================
  68. ScopedPointer<ComboBox> deviceTypeDropDown;
  69. ScopedPointer<Label> deviceTypeDropDownLabel;
  70. ScopedPointer<Component> audioDeviceSettingsComp;
  71. String audioDeviceSettingsCompType;
  72. const int minOutputChannels, maxOutputChannels, minInputChannels, maxInputChannels;
  73. const bool showChannelsAsStereoPairs;
  74. const bool hideAdvancedOptionsWithButton;
  75. class MidiInputSelectorComponentListBox;
  76. friend struct ContainerDeletePolicy<MidiInputSelectorComponentListBox>;
  77. ScopedPointer<MidiInputSelectorComponentListBox> midiInputsList;
  78. ScopedPointer<ComboBox> midiOutputSelector;
  79. ScopedPointer<Label> midiInputsLabel, midiOutputLabel;
  80. void comboBoxChanged (ComboBox*) override;
  81. void changeListenerCallback (ChangeBroadcaster*) override;
  82. void updateAllControls();
  83. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioDeviceSelectorComponent)
  84. };
  85. #endif // JUCE_AUDIODEVICESELECTORCOMPONENT_H_INCLUDED