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.3KB

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