Qt 5.11 | Qt Multimedia | C++ Classes | QAudioSystemPlugin

Qt 5.11.3 Reference Documentation

# QAudioSystemPlugin Class

The QAudioSystemPlugin class provides an abstract base for audio plugins. More...

Header: | #include <QAudioSystemPlugin>
qmake: | QT += multimedia
Inherits: | QAudioSystemFactoryInterface and

- List of all members, including inherited members

## Public Functions

| QAudioSystemPlugin(QObject *parent = nullptr)
virtual | ~QAudioSystemPlugin()

## Reimplemented Public Functions

virtual QList<QByteArray> | availableDevices(QAudio::Mode) const override = 0
virtual QAbstractAudioDeviceInfo * | createDeviceInfo(const QByteArray &device, QAudio::Mode mode) override = 0
virtual QAbstractAudioInput * | createInput(const QByteArray &device) override = 0
virtual QAbstractAudioOutput * | createOutput(const QByteArray &device) override = 0

## Detailed Description

The QAudioSystemPlugin class provides an abstract base for audio plugins.

Writing a audio plugin is achieved by subclassing this base class, reimplementing the pure virtual functions availableDevices(), createInput(), createOutput() and createDeviceInfo() then exporting the class with the Q_PLUGIN_METADATA() macro.

The json file containing the meta data should contain a list of keys matching the plugin. Add "default" to your list of keys available to override the default audio device to be provided by your plugin.

      { "Keys": [ "default" ] }

Unit tests are available to help in debugging new plugins.

Qt comes with plugins for Windows (WinMM and WASAPI), Linux (ALSA and PulseAudio), macOS / iOS (CoreAudio), Android (OpenSL ES) and QNX.

If no audio plugins are available, a fallback dummy backend will be used. This should print out warnings if this is the case when you try and use QAudioInput or QAudioOutput. To fix this problem, make sure the dependencies for the Qt plugins are installed on the system and reconfigure Qt (e.g. alsa-devel package on Linux), or create your own plugin with a default key to always override the dummy fallback. The easiest way to determine if you have only a dummy backend is to get a list of available audio devices.

QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size() = 0 (dummy backend)

See also QAbstractAudioDeviceInfo, QAbstractAudioOutput, and QAbstractAudioInput.

## Member Function Documentation

### QAudioSystemPlugin::QAudioSystemPlugin(QObject *parent = nullptr)

Default constructs an instance of QAudioSystemPlugin.

### `[virtual]` QAudioSystemPlugin::~QAudioSystemPlugin()

Destroys the instance of QAudioSystemPlugin. The destructor is virtual.

### `[override pure virtual]` QList<QByteArray> QAudioSystemPlugin::availableDevices(QAudio::Mode) const

### `[override pure virtual]` QAbstractAudioDeviceInfo *QAudioSystemPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode)

### `[override pure virtual]` QAbstractAudioInput *QAudioSystemPlugin::createInput(const QByteArray &device)

### `[override pure virtual]` QAbstractAudioOutput *QAudioSystemPlugin::createOutput(const QByteArray &device)