Qt 4.8
Static Public Functions | List of all members
QAudioDeviceFactory Class Reference

#include <qaudiodevicefactory_p.h>

Static Public Functions

static QAbstractAudioDeviceInfoaudioDeviceInfo (const QString &realm, const QByteArray &handle, QAudio::Mode mode)
 
static QList< QAudioDeviceInfoavailableDevices (QAudio::Mode mode)
 
static QAbstractAudioInputcreateDefaultInputDevice (QAudioFormat const &format)
 
static QAbstractAudioOutputcreateDefaultOutputDevice (QAudioFormat const &format)
 
static QAbstractAudioInputcreateInputDevice (QAudioDeviceInfo const &device, QAudioFormat const &format)
 
static QAbstractAudioInputcreateNullInput ()
 
static QAbstractAudioOutputcreateNullOutput ()
 
static QAbstractAudioOutputcreateOutputDevice (QAudioDeviceInfo const &device, QAudioFormat const &format)
 
static QAudioDeviceInfo defaultInputDevice ()
 
static QAudioDeviceInfo defaultOutputDevice ()
 

Detailed Description

Definition at line 72 of file qaudiodevicefactory_p.h.

Functions

◆ audioDeviceInfo()

QAbstractAudioDeviceInfo * QAudioDeviceFactory::audioDeviceInfo ( const QString realm,
const QByteArray handle,
QAudio::Mode  mode 
)
static

Definition at line 198 of file qaudiodevicefactory.cpp.

Referenced by QAudioDeviceInfoPrivate::operator=(), and QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate().

199 {
200  QAbstractAudioDeviceInfo *rc = 0;
201 
202 #ifndef QT_NO_AUDIO_BACKEND
203 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
204  if (realm == QLatin1String("builtin"))
205  return new QAudioDeviceInfoInternal(handle, mode);
206 #endif
207 #endif
208 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
210  qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(realm));
211 
212  if (plugin)
213  rc = plugin->createDeviceInfo(handle, mode);
214 #endif
215  return rc == 0 ? new QNullDeviceInfo() : rc;
216 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
virtual QAbstractAudioDeviceInfo * createDeviceInfo(const QByteArray &device, QAudio::Mode mode)=0
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QAbstractAudioDeviceInfo class provides access for QAudioDeviceInfo to access the audio device pr...
Definition: qaudioengine.h:56

◆ availableDevices()

QList< QAudioDeviceInfo > QAudioDeviceFactory::availableDevices ( QAudio::Mode  mode)
static

Definition at line 133 of file qaudiodevicefactory.cpp.

Referenced by QAudioDeviceInfo::availableDevices().

134 {
135  QList<QAudioDeviceInfo> devices;
136 #ifndef QT_NO_AUDIO_BACKEND
137 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
138  foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
139  devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
140 #endif
141 #endif
142 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
143  QFactoryLoader* l = loader();
144 
145  foreach (QString const& key, l->keys()) {
147  if (plugin) {
148  foreach (QByteArray const& handle, plugin->availableDevices(mode))
149  devices << QAudioDeviceInfo(key, handle, mode);
150  }
151 
152  delete plugin;
153  }
154 #endif
155  return devices;
156 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual QList< QByteArray > availableDevices(QAudio::Mode) const =0
The QString class provides a Unicode character string.
Definition: qstring.h:83
QStringList keys() const
The QAudioDeviceInfo class provides an interface to query audio devices and their functionality...
QObject * instance(const QString &key) const
int key
QFactoryLoader * l
static QList< QByteArray > availableDevices(QAudio::Mode)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ createDefaultInputDevice()

QAbstractAudioInput * QAudioDeviceFactory::createDefaultInputDevice ( QAudioFormat const &  format)
static

Definition at line 218 of file qaudiodevicefactory.cpp.

Referenced by QAudioInput::QAudioInput().

219 {
221 }
static QAudioDeviceInfo defaultInputDevice()
static QAbstractAudioInput * createInputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format)

◆ createDefaultOutputDevice()

QAbstractAudioOutput * QAudioDeviceFactory::createDefaultOutputDevice ( QAudioFormat const &  format)
static

Definition at line 223 of file qaudiodevicefactory.cpp.

Referenced by QAudioOutput::QAudioOutput().

224 {
226 }
static QAudioDeviceInfo defaultOutputDevice()
static QAbstractAudioOutput * createOutputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format)

◆ createInputDevice()

QAbstractAudioInput * QAudioDeviceFactory::createInputDevice ( QAudioDeviceInfo const &  device,
QAudioFormat const &  format 
)
static

Definition at line 228 of file qaudiodevicefactory.cpp.

Referenced by QAudioInput::QAudioInput().

229 {
230  if (deviceInfo.isNull())
231  return new QNullInputDevice();
232 #ifndef QT_NO_AUDIO_BACKEND
233 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
234  if (deviceInfo.realm() == QLatin1String("builtin"))
235  return new QAudioInputPrivate(deviceInfo.handle(), format);
236 #endif
237 #endif
238 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
240  qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));
241 
242  if (plugin)
243  return plugin->createInput(deviceInfo.handle(), format);
244 #endif
245  return new QNullInputDevice();
246 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual QAbstractAudioInput * createInput(const QByteArray &device, const QAudioFormat &format=QAudioFormat())=0

◆ createNullInput()

static QAbstractAudioInput* QAudioDeviceFactory::createNullInput ( )
static

◆ createNullOutput()

static QAbstractAudioOutput* QAudioDeviceFactory::createNullOutput ( )
static

◆ createOutputDevice()

QAbstractAudioOutput * QAudioDeviceFactory::createOutputDevice ( QAudioDeviceInfo const &  device,
QAudioFormat const &  format 
)
static

Definition at line 248 of file qaudiodevicefactory.cpp.

Referenced by QAudioOutput::QAudioOutput().

249 {
250  if (deviceInfo.isNull())
251  return new QNullOutputDevice();
252 #ifndef QT_NO_AUDIO_BACKEND
253 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
254  if (deviceInfo.realm() == QLatin1String("builtin"))
255  return new QAudioOutputPrivate(deviceInfo.handle(), format);
256 #endif
257 #endif
258 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
260  qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));
261 
262  if (plugin)
263  return plugin->createOutput(deviceInfo.handle(), format);
264 #endif
265  return new QNullOutputDevice();
266 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual QAbstractAudioOutput * createOutput(const QByteArray &device, const QAudioFormat &format=QAudioFormat())=0

◆ defaultInputDevice()

QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice ( )
static

Definition at line 158 of file qaudiodevicefactory.cpp.

Referenced by QAudioDeviceInfo::defaultInputDevice().

159 {
160 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
161  QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
162 
163  if (plugin) {
165  if (list.size() > 0)
166  return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput);
167  }
168 #endif
169 
170 #ifndef QT_NO_AUDIO_BACKEND
171 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
173 #endif
174 #endif
175  return QAudioDeviceInfo();
176 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual QList< QByteArray > availableDevices(QAudio::Mode) const =0
static QByteArray defaultInputDevice()
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QAudioDeviceInfo class provides an interface to query audio devices and their functionality...
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ defaultOutputDevice()

QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice ( )
static

Definition at line 178 of file qaudiodevicefactory.cpp.

Referenced by QAudioDeviceInfo::defaultOutputDevice().

179 {
180 #if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
181  QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default")));
182 
183  if (plugin) {
185  if (list.size() > 0)
186  return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput);
187  }
188 #endif
189 
190 #ifndef QT_NO_AUDIO_BACKEND
191 #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
193 #endif
194 #endif
195  return QAudioDeviceInfo();
196 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
static QByteArray defaultOutputDevice()
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
virtual QList< QByteArray > availableDevices(QAudio::Mode) const =0
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QAudioDeviceInfo class provides an interface to query audio devices and their functionality...
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

The documentation for this class was generated from the following files: