Base class for an audio device with synchronised input and output channels. More...
#include <juce_AudioIODevice.h>
Public Member Functions | |
virtual | ~AudioIODevice () |
Destructor. | |
const String & | getName () const noexcept |
Returns the device's name, (as set in the constructor). | |
const String & | getTypeName () const noexcept |
Returns the type of the device. | |
virtual StringArray | getOutputChannelNames ()=0 |
Returns the names of all the available output channels on this device. | |
virtual StringArray | getInputChannelNames ()=0 |
Returns the names of all the available input channels on this device. | |
virtual std::optional< BigInteger > | getDefaultOutputChannels () const |
For devices that support a default layout, returns the channels that are enabled in the default layout. | |
virtual std::optional< BigInteger > | getDefaultInputChannels () const |
For devices that support a default layout, returns the channels that are enabled in the default layout. | |
virtual Array< double > | getAvailableSampleRates ()=0 |
Returns the set of sample-rates this device supports. | |
virtual Array< int > | getAvailableBufferSizes ()=0 |
Returns the set of buffer sizes that are available. | |
virtual int | getDefaultBufferSize ()=0 |
Returns the default buffer-size to use. | |
virtual String | open (const BigInteger &inputChannels, const BigInteger &outputChannels, double sampleRate, int bufferSizeSamples)=0 |
Tries to open the device ready to play. | |
virtual void | close ()=0 |
Closes and releases the device if it's open. | |
virtual bool | isOpen ()=0 |
Returns true if the device is still open. | |
virtual void | start (AudioIODeviceCallback *callback)=0 |
Starts the device actually playing. | |
virtual void | stop ()=0 |
Stops the device playing. | |
virtual bool | isPlaying ()=0 |
Returns true if the device is still calling back. | |
virtual String | getLastError ()=0 |
Returns the last error that happened if anything went wrong. | |
virtual int | getCurrentBufferSizeSamples ()=0 |
Returns the buffer size that the device is currently using. | |
virtual double | getCurrentSampleRate ()=0 |
Returns the sample rate that the device is currently using. | |
virtual int | getCurrentBitDepth ()=0 |
Returns the device's current physical bit-depth. | |
virtual BigInteger | getActiveOutputChannels () const =0 |
Returns a mask showing which of the available output channels are currently enabled. | |
virtual BigInteger | getActiveInputChannels () const =0 |
Returns a mask showing which of the available input channels are currently enabled. | |
virtual int | getOutputLatencyInSamples ()=0 |
Returns the device's output latency. | |
virtual int | getInputLatencyInSamples ()=0 |
Returns the device's input latency. | |
virtual AudioWorkgroup | getWorkgroup () const |
Returns the workgroup for this device. | |
virtual bool | hasControlPanel () const |
True if this device can show a pop-up control panel for editing its settings. | |
virtual bool | showControlPanel () |
Shows a device-specific control panel if there is one. | |
virtual bool | setAudioPreprocessingEnabled (bool shouldBeEnabled) |
On devices which support it, this allows automatic gain control or other mic processing to be disabled. | |
virtual int | getXRunCount () const noexcept |
Returns the number of under- or over runs reported by the OS since playback/recording has started. | |
Protected Member Functions | |
AudioIODevice (const String &deviceName, const String &typeName) | |
Creates a device, setting its name and type member variables. | |
Protected Attributes | |
String | name |
String | typeName |
Base class for an audio device with synchronised input and output channels.
Subclasses of this are used to implement different protocols such as DirectSound, ASIO, CoreAudio, etc.
To create one of these, you'll need to use the AudioIODeviceType class - see the documentation for that class for more info.
For an easier way of managing audio devices and their settings, have a look at the AudioDeviceManager class.
|
virtual |
Destructor.
Creates a device, setting its name and type member variables.
|
noexcept |
Returns the device's name, (as set in the constructor).
References name.
|
noexcept |
Returns the type of the device.
E.g. "CoreAudio", "ASIO", etc. - this comes from the AudioIODeviceType that created it.
|
pure virtual |
Returns the names of all the available output channels on this device.
To find out which of these are currently in use, call getActiveOutputChannels().
|
pure virtual |
Returns the names of all the available input channels on this device.
To find out which of these are currently in use, call getActiveInputChannels().
|
virtual |
For devices that support a default layout, returns the channels that are enabled in the default layout.
Returns nullopt if the device doesn't supply a default layout.
|
virtual |
For devices that support a default layout, returns the channels that are enabled in the default layout.
Returns nullopt if the device doesn't supply a default layout.
|
pure virtual |
Returns the set of sample-rates this device supports.
|
pure virtual |
Returns the set of buffer sizes that are available.
|
pure virtual |
|
pure virtual |
Tries to open the device ready to play.
inputChannels | a BigInteger in which a set bit indicates that the corresponding input channel should be enabled |
outputChannels | a BigInteger in which a set bit indicates that the corresponding output channel should be enabled |
sampleRate | the sample rate to try to use - to find out which rates are available, see getAvailableSampleRates() |
bufferSizeSamples | the size of i/o buffer to use - to find out the available buffer sizes, see getAvailableBufferSizes() |
|
pure virtual |
Closes and releases the device if it's open.
|
pure virtual |
Returns true if the device is still open.
A device might spontaneously close itself if something goes wrong, so this checks if it's still open.
|
pure virtual |
Starts the device actually playing.
This must be called after the device has been opened.
callback | the callback to use for streaming the data. |
|
pure virtual |
Stops the device playing.
Once a device has been started, this will stop it. Any pending calls to the callback class will be flushed before this method returns.
|
pure virtual |
Returns true if the device is still calling back.
The device might mysteriously stop, so this checks whether it's still playing.
|
pure virtual |
Returns the last error that happened if anything went wrong.
|
pure virtual |
Returns the buffer size that the device is currently using.
If the device isn't actually open, this value doesn't really mean much.
|
pure virtual |
Returns the sample rate that the device is currently using.
If the device isn't actually open, this value doesn't really mean much.
|
pure virtual |
Returns the device's current physical bit-depth.
If the device isn't actually open, this value doesn't really mean much.
|
pure virtual |
Returns a mask showing which of the available output channels are currently enabled.
|
pure virtual |
Returns a mask showing which of the available input channels are currently enabled.
|
pure virtual |
Returns the device's output latency.
This is the delay in samples between a callback getting a block of data, and that data actually getting played.
|
pure virtual |
Returns the device's input latency.
This is the delay in samples between some audio actually arriving at the soundcard, and the callback getting passed this block of data.
|
virtual |
Returns the workgroup for this device.
|
virtual |
True if this device can show a pop-up control panel for editing its settings.
This is generally just true of ASIO devices. If true, you can call showControlPanel() to display it.
|
virtual |
Shows a device-specific control panel if there is one.
This should only be called for devices which return true from hasControlPanel().
|
virtual |
On devices which support it, this allows automatic gain control or other mic processing to be disabled.
If the device doesn't support this operation, it'll return false.
|
virtualnoexcept |
Returns the number of under- or over runs reported by the OS since playback/recording has started.
This number may be different than determining the Xrun count manually (by measuring the time spent in the audio callback) as the OS may be doing some buffering internally - especially on mobile devices.
Returns -1 if playback/recording has not started yet or if getting the underrun count is not supported for this device (Android SDK 23 and lower).
|
protected |
|
protected |