|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 |
|
43 #include "qaudiosystemplugin.h" |
|
44 |
|
45 QT_BEGIN_NAMESPACE |
|
46 |
|
47 /*! |
|
48 \class QAudioSystemPlugin |
|
49 \brief The QAudioSystemPlugin class provides an abstract base for audio plugins. |
|
50 |
|
51 \ingroup multimedia |
|
52 \inmodule QtMultimediaKit |
|
53 \internal |
|
54 |
|
55 Writing a audio plugin is achieved by subclassing this base class, |
|
56 reimplementing the pure virtual functions keys(), availableDevices(), |
|
57 createInput(), createOutput() and createDeviceInfo() then exporting |
|
58 the class with the Q_EXPORT_PLUGIN2() macro. |
|
59 |
|
60 Unit tests are available to help in debugging new plugins. |
|
61 |
|
62 \sa QAbstractAudioDeviceInfo, QAbstractAudioOutput, QAbstractAudioInput |
|
63 |
|
64 Qt supports win32, linux(alsa) and Mac OS X standard (builtin to the |
|
65 QtMultimediaKit library at compile time). |
|
66 |
|
67 You can support other backends other than these predefined ones by |
|
68 creating a plugin subclassing QAudioSystemPlugin, QAbstractAudioDeviceInfo, |
|
69 QAbstractAudioOutput and QAbstractAudioInput. |
|
70 |
|
71 Add "default" to your list of keys() available to override the default |
|
72 audio device to be provided by your plugin. |
|
73 |
|
74 -audio-backend configure option will force compiling in of the builtin backend |
|
75 into the QtMultimediaKit library at compile time. This is automatic by default |
|
76 and will only be compiled into the library if the dependencies are installed. |
|
77 eg. alsa-devel package installed for linux. |
|
78 |
|
79 If the builtin backend is not compiled into the QtMultimediaKit library and |
|
80 no audio plugins are available a fallback dummy backend will be used. |
|
81 This should print out warnings if this is the case when you try and use QAudioInput or QAudioOutput. To fix this problem |
|
82 reconfigure Qt using -audio-backend or create your own plugin with a default |
|
83 key to always override the dummy fallback. The easiest way to determine |
|
84 if you have only a dummy backend is to get a list of available audio devices. |
|
85 |
|
86 QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size() = 0 (dummy backend) |
|
87 */ |
|
88 |
|
89 /*! |
|
90 Construct a new audio plugin with \a parent. |
|
91 This is invoked automatically by the Q_EXPORT_PLUGIN2() macro. |
|
92 */ |
|
93 |
|
94 QAudioSystemPlugin::QAudioSystemPlugin(QObject* parent) : |
|
95 QObject(parent) |
|
96 {} |
|
97 |
|
98 /*! |
|
99 Destroy the audio plugin |
|
100 |
|
101 You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used. |
|
102 */ |
|
103 |
|
104 QAudioSystemPlugin::~QAudioSystemPlugin() |
|
105 {} |
|
106 |
|
107 /*! |
|
108 \fn QStringList QAudioSystemPlugin::keys() const |
|
109 Returns the list of device identifiers this plugin supports. |
|
110 */ |
|
111 |
|
112 /*! |
|
113 \fn QList<QByteArray> QAudioSystemPlugin::availableDevices(QAudio::Mode mode) const |
|
114 Returns a list of available audio devices for \a mode |
|
115 */ |
|
116 |
|
117 /*! |
|
118 \fn QAbstractAudioInput* QAudioSystemPlugin::createInput(const QByteArray& device) |
|
119 Returns a pointer to a QAbstractAudioInput created using \a device identifier |
|
120 */ |
|
121 |
|
122 /*! |
|
123 \fn QAbstractAudioOutput* QAudioSystemPlugin::createOutput(const QByteArray& device) |
|
124 Returns a pointer to a QAbstractAudioOutput created using \a device identifier |
|
125 |
|
126 */ |
|
127 |
|
128 /*! |
|
129 \fn QAbstractAudioDeviceInfo* QAudioSystemPlugin::createDeviceInfo(const QByteArray& device, QAudio::Mode mode) |
|
130 Returns a pointer to a QAbstractAudioDeviceInfo created using \a device and \a mode |
|
131 |
|
132 */ |
|
133 |
|
134 |
|
135 QT_END_NAMESPACE |