OpenShot Audio Library | OpenShotAudio  0.3.1
juce_AudioIODeviceType.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2017 - ROLI Ltd.
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 
87  virtual StringArray getDeviceNames (bool wantInputNames = false) const = 0;
88 
96  virtual int getDefaultDeviceIndex (bool forInput) const = 0;
97 
102  virtual int getIndexOfDevice (AudioIODevice* device, bool asInput) const = 0;
103 
106  virtual bool hasSeparateInputsAndOutputs() const = 0;
107 
113  virtual AudioIODevice* createDevice (const String& outputDeviceName,
114  const String& inputDeviceName) = 0;
115 
116  //==============================================================================
126  class Listener
127  {
128  public:
129  virtual ~Listener() = default;
130 
132  virtual void audioDeviceListChanged() = 0;
133  };
134 
138  void addListener (Listener* listener);
139 
141  void removeListener (Listener* listener);
142 
143  //==============================================================================
145  virtual ~AudioIODeviceType();
146 
147  //==============================================================================
149  static AudioIODeviceType* createAudioIODeviceType_CoreAudio();
151  static AudioIODeviceType* createAudioIODeviceType_iOSAudio();
153  static AudioIODeviceType* createAudioIODeviceType_WASAPI (bool exclusiveMode);
155  static AudioIODeviceType* createAudioIODeviceType_DirectSound();
157  static AudioIODeviceType* createAudioIODeviceType_ASIO();
159  static AudioIODeviceType* createAudioIODeviceType_ALSA();
161  static AudioIODeviceType* createAudioIODeviceType_JACK();
163  static AudioIODeviceType* createAudioIODeviceType_Android();
165  static AudioIODeviceType* createAudioIODeviceType_OpenSLES();
167  static AudioIODeviceType* createAudioIODeviceType_Oboe();
169  static AudioIODeviceType* createAudioIODeviceType_Bela();
170 
171 protected:
172  explicit AudioIODeviceType (const String& typeName);
173 
175  void callDeviceChangeListeners();
176 
177 private:
178  String typeName;
179  ListenerList<Listener> listeners;
180 
181  JUCE_DECLARE_NON_COPYABLE (AudioIODeviceType)
182 };
183 
184 } // namespace juce
const String & getTypeName() const noexcept