OpenShot Library | libopenshot-audio  0.2.0
juce::AudioIODeviceType Class Referenceabstract

Represents a type of audio driver, such as DirectSound, ASIO, CoreAudio, etc. More...

#include <juce_AudioIODeviceType.h>

Classes

class  Listener
 A class for receiving events when audio devices are inserted or removed. More...
 

Public Member Functions

const StringgetTypeName () const noexcept
 Returns the name of this type of driver that this object manages. More...
 
virtual void scanForDevices ()=0
 Refreshes the object's cached list of known devices. More...
 
virtual StringArray getDeviceNames (bool wantInputNames=false) const =0
 Returns the list of available devices of this type. More...
 
virtual int getDefaultDeviceIndex (bool forInput) const =0
 Returns the name of the default device. More...
 
virtual int getIndexOfDevice (AudioIODevice *device, bool asInput) const =0
 Returns the index of a given device in the list of device names. More...
 
virtual bool hasSeparateInputsAndOutputs () const =0
 Returns true if two different devices can be used for the input and output.
 
virtual AudioIODevicecreateDevice (const String &outputDeviceName, const String &inputDeviceName)=0
 Creates one of the devices of this type. More...
 
void addListener (Listener *listener)
 Adds a listener that will be called when this type of device is added or removed from the system.
 
void removeListener (Listener *listener)
 Removes a listener that was previously added with addListener(). More...
 
virtual ~AudioIODeviceType ()
 Destructor. More...
 

Static Public Member Functions

static AudioIODeviceTypecreateAudioIODeviceType_CoreAudio ()
 Creates a CoreAudio device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_iOSAudio ()
 Creates an iOS device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_WASAPI (bool exclusiveMode)
 Creates a WASAPI device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_DirectSound ()
 Creates a DirectSound device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_ASIO ()
 Creates an ASIO device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_ALSA ()
 Creates an ALSA device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_JACK ()
 Creates a JACK device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_Android ()
 Creates an Android device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_OpenSLES ()
 Creates an Android OpenSLES device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_Oboe ()
 Creates an Oboe device type if it's available on this platform, or returns null. More...
 
static AudioIODeviceTypecreateAudioIODeviceType_Bela ()
 Creates a Bela device type if it's available on this platform, or returns null. More...
 

Protected Member Functions

 AudioIODeviceType (const String &typeName)
 
void callDeviceChangeListeners ()
 Synchronously calls all the registered device list change listeners. More...
 

Detailed Description

Represents a type of audio driver, such as DirectSound, ASIO, CoreAudio, etc.

To get a list of available audio driver types, use the AudioDeviceManager::createAudioDeviceTypes() method. Each of the objects returned can then be used to list the available devices of that type. E.g.

OwnedArray<AudioIODeviceType> types;
myAudioDeviceManager.createAudioDeviceTypes (types);
for (int i = 0; i < types.size(); ++i)
{
String typeName (types[i]->getTypeName()); // This will be things like "DirectSound", "CoreAudio", etc.
types[i]->scanForDevices(); // This must be called before getting the list of devices
StringArray deviceNames (types[i]->getDeviceNames()); // This will now return a list of available devices of this type
for (int j = 0; j < deviceNames.size(); ++j)
{
AudioIODevice* device = types[i]->createDevice (deviceNames [j]);
...
}
}

For an easier way of managing audio devices and their settings, have a look at the AudioDeviceManager class.

See also
AudioIODevice, AudioDeviceManager

Definition at line 65 of file juce_AudioIODeviceType.h.

Constructor & Destructor Documentation

◆ ~AudioIODeviceType()

juce::AudioIODeviceType::~AudioIODeviceType ( )
virtual

Destructor.

Definition at line 31 of file juce_AudioIODeviceType.cpp.

Member Function Documentation

◆ getTypeName()

const String& juce::AudioIODeviceType::getTypeName ( ) const
inlinenoexcept

Returns the name of this type of driver that this object manages.

This will be something like "DirectSound", "ASIO", "CoreAudio", "ALSA", etc.

Definition at line 73 of file juce_AudioIODeviceType.h.

Referenced by juce::AudioDeviceManager::createStateXml(), juce::AudioDeviceManager::getCurrentDeviceTypeObject(), and juce::AudioDeviceManager::initialise().

◆ scanForDevices()

virtual void juce::AudioIODeviceType::scanForDevices ( )
pure virtual

Refreshes the object's cached list of known devices.

This must be called at least once before calling getDeviceNames() or any of the other device creation methods.

Referenced by juce::AudioDeviceManager::createStateXml().

◆ getDeviceNames()

virtual StringArray juce::AudioIODeviceType::getDeviceNames ( bool  wantInputNames = false) const
pure virtual

Returns the list of available devices of this type.

The scanForDevices() method must have been called to create this list.

Parameters
wantInputNamesonly really used by DirectSound where devices are split up into inputs and outputs, this indicates whether to use the input or output name to refer to a pair of devices.

Referenced by juce::AudioDeviceManager::addAudioDeviceType(), juce::AudioDeviceManager::initialise(), and juce::AudioDeviceManager::initialiseWithDefaultDevices().

◆ getDefaultDeviceIndex()

virtual int juce::AudioIODeviceType::getDefaultDeviceIndex ( bool  forInput) const
pure virtual

Returns the name of the default device.

This will be one of the names from the getDeviceNames() list.

Parameters
forInputif true, this means that a default input device should be returned; if false, it should return the default output

Referenced by juce::AudioDeviceManager::initialiseWithDefaultDevices().

◆ getIndexOfDevice()

virtual int juce::AudioIODeviceType::getIndexOfDevice ( AudioIODevice device,
bool  asInput 
) const
pure virtual

Returns the index of a given device in the list of device names.

If asInput is true, it shows the index in the inputs list, otherwise it looks for it in the outputs list.

◆ createDevice()

virtual AudioIODevice* juce::AudioIODeviceType::createDevice ( const String outputDeviceName,
const String inputDeviceName 
)
pure virtual

Creates one of the devices of this type.

The deviceName must be one of the strings returned by getDeviceNames(), and scanForDevices() must have been called before this method is used.

Referenced by juce::AudioDeviceManager::setAudioDeviceSetup().

◆ removeListener()

void juce::AudioIODeviceType::removeListener ( Listener listener)

Removes a listener that was previously added with addListener().

Definition at line 37 of file juce_AudioIODeviceType.cpp.

◆ createAudioIODeviceType_CoreAudio()

static AudioIODeviceType* juce::AudioIODeviceType::createAudioIODeviceType_CoreAudio ( )
static

Creates a CoreAudio device type if it's available on this platform, or returns null.

Referenced by callDeviceChangeListeners(), and juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_iOSAudio()

static AudioIODeviceType* juce::AudioIODeviceType::createAudioIODeviceType_iOSAudio ( )
static

Creates an iOS device type if it's available on this platform, or returns null.

Referenced by callDeviceChangeListeners(), and juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_WASAPI()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_WASAPI ( bool  exclusiveMode)
static

Creates a WASAPI device type if it's available on this platform, or returns null.

Definition at line 54 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_DirectSound()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_DirectSound ( )
static

Creates a DirectSound device type if it's available on this platform, or returns null.

Definition at line 58 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_ASIO()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_ASIO ( )
static

Creates an ASIO device type if it's available on this platform, or returns null.

Definition at line 62 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_ALSA()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_ALSA ( )
static

Creates an ALSA device type if it's available on this platform, or returns null.

Definition at line 66 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_JACK()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_JACK ( )
static

Creates a JACK device type if it's available on this platform, or returns null.

Definition at line 70 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_Android()

static AudioIODeviceType* juce::AudioIODeviceType::createAudioIODeviceType_Android ( )
static

Creates an Android device type if it's available on this platform, or returns null.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes(), and createAudioIODeviceType_Bela().

◆ createAudioIODeviceType_OpenSLES()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_OpenSLES ( )
static

Creates an Android OpenSLES device type if it's available on this platform, or returns null.

Definition at line 82 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_Oboe()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_Oboe ( )
static

Creates an Oboe device type if it's available on this platform, or returns null.

Definition at line 86 of file juce_AudioIODeviceType.cpp.

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ createAudioIODeviceType_Bela()

AudioIODeviceType * juce::AudioIODeviceType::createAudioIODeviceType_Bela ( )
static

Creates a Bela device type if it's available on this platform, or returns null.

Definition at line 74 of file juce_AudioIODeviceType.cpp.

References createAudioIODeviceType_Android().

Referenced by juce::AudioDeviceManager::createAudioDeviceTypes().

◆ callDeviceChangeListeners()

void juce::AudioIODeviceType::callDeviceChangeListeners ( )
protected

Synchronously calls all the registered device list change listeners.

Definition at line 39 of file juce_AudioIODeviceType.cpp.

References juce::AudioIODeviceType::Listener::audioDeviceListChanged(), createAudioIODeviceType_CoreAudio(), and createAudioIODeviceType_iOSAudio().


The documentation for this class was generated from the following files: