OpenShot Audio Library | OpenShotAudio  0.6.0
juce_AudioIODeviceType.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2022 - Raw Material Software Limited
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  The code included in this file is provided under the terms of the ISC license
11  http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12  To use, copy, modify, and/or distribute this software for any purpose with or
13  without fee is hereby granted provided that the above copyright notice and
14  this permission notice appear in all copies.
15 
16  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18  DISCLAIMED.
19 
20  ==============================================================================
21 */
22 
23 namespace juce
24 {
25 
26 //==============================================================================
61 class JUCE_API AudioIODeviceType
62 {
63 public:
64  //==============================================================================
69  const String& getTypeName() const noexcept { return typeName; }
70 
71  //==============================================================================
77  virtual void scanForDevices() = 0;
78 
86  virtual StringArray getDeviceNames (bool wantInputNames = false) const = 0;
87 
95  virtual int getDefaultDeviceIndex (bool forInput) const = 0;
96 
101  virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
102 
105  virtual bool hasSeparateInputsAndOutputs() const = 0;
106 
112  virtual AudioIODevice* createDevice (const String& outputDeviceName,
113  const String& inputDeviceName) = 0;
114 
115  //==============================================================================
125  class Listener
126  {
127  public:
128  virtual ~Listener() = default;
129 
131  virtual void audioDeviceListChanged() = 0;
132  };
133 
137  void addListener (Listener* listener);
138 
140  void removeListener (Listener* listener);
141 
142  //==============================================================================
144  virtual ~AudioIODeviceType();
145 
146  //==============================================================================
148  static AudioIODeviceType* createAudioIODeviceType_CoreAudio();
150  static AudioIODeviceType* createAudioIODeviceType_iOSAudio();
152  static AudioIODeviceType* createAudioIODeviceType_WASAPI (WASAPIDeviceMode deviceMode);
154  static AudioIODeviceType* createAudioIODeviceType_DirectSound();
156  static AudioIODeviceType* createAudioIODeviceType_ASIO();
158  static AudioIODeviceType* createAudioIODeviceType_ALSA();
160  static AudioIODeviceType* createAudioIODeviceType_JACK();
162  static AudioIODeviceType* createAudioIODeviceType_Android();
164  static AudioIODeviceType* createAudioIODeviceType_OpenSLES();
166  static AudioIODeviceType* createAudioIODeviceType_Oboe();
168  static AudioIODeviceType* createAudioIODeviceType_Bela();
169 
170  #ifndef DOXYGEN
171  [[deprecated ("You should call the method which takes a WASAPIDeviceMode instead.")]]
172  static AudioIODeviceType* createAudioIODeviceType_WASAPI (bool exclusiveMode);
173  #endif
174 
175 protected:
176  explicit AudioIODeviceType (const String& typeName);
177 
179  void callDeviceChangeListeners();
180 
181 private:
182  String typeName;
183  ListenerList<Listener> listeners;
184 
185  JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType)
186 };
187 
188 } // namespace juce
virtual void audioDeviceListChanged()=0
virtual int getDefaultDeviceIndex(bool forInput) const =0
virtual bool hasSeparateInputsAndOutputs() const =0
virtual StringArray getDeviceNames(bool wantInputNames=false) const =0
virtual void scanForDevices()=0
virtual int getIndexOfDevice(AudioIODevice *device, bool asInput) const =0
virtual AudioIODevice * createDevice(const String &outputDeviceName, const String &inputDeviceName)=0
const String & getTypeName() const noexcept