QAudioSystemPlugin Class
The QAudioSystemPlugin class provides an abstract base for audio plugins. More...
| Header: | #include <QAudioSystemPlugin> |
| qmake: | QT += multimedia |
| Inherits: | QObject and QAudioSystemFactoryInterface |
Related Non-Members
| typedef | QObjectList |
| QList<T> | qFindChildren(const QObject *obj, const QRegExp ®Exp) |
| T | qobject_cast(QObject *object) |
| T | qobject_cast(const QObject *object) |
Macros
| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
| Q_CLASSINFO(Name, Value) | |
| Q_DISABLE_COPY(Class) | |
| Q_DISABLE_COPY_MOVE(Class) | |
| Q_DISABLE_MOVE(Class) | |
| Q_EMIT | |
| Q_ENUM(...) | |
| Q_ENUM_NS(...) | |
| Q_FLAG(...) | |
| Q_FLAG_NS(...) | |
| Q_GADGET | |
| Q_INTERFACES(...) | |
| Q_INVOKABLE | |
| Q_NAMESPACE | |
| Q_OBJECT | |
| Q_PROPERTY(...) | |
| Q_REVISION | |
| Q_SET_OBJECT_NAME(Object) | |
| Q_SIGNAL | |
| Q_SIGNALS | |
| Q_SLOT | |
| Q_SLOTS |
Additional Inherited Members
- 1 property inherited from QObject
- 30 public functions inherited from QObject
- 1 public slot inherited from QObject
- 2 signals inherited from QObject
- 9 static public members inherited from QObject
- 9 protected functions inherited from QObject
Detailed Description
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.