QAudioSystemPlugin Class
The QAudioSystemPlugin class provides an abstract base for audio plugins. More...
Header: | #include <QAudioSystemPlugin> |
qmake: | QT += multimedia |
Inherits: | QObject and QAudioSystemFactoryInterface |
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 |
- 31 public functions inherited from QObject
Static Public Members
const QMetaObject | staticMetaObject |
- 9 static public members inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 2 signals inherited from QObject
- 9 protected functions inherited from QObject
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.