QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(defaultKey())); if (plugin) { QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput); if (list.size() > 0) return QAudioDeviceInfo(defaultKey(), list.at(0), QAudio::AudioOutput); } // if no plugin is marked as default or if the default plugin doesn't have any output device, // return the first output available from other plugins. QList<QAudioDeviceInfo> outputDevices = availableDevices(QAudio::AudioOutput); if (!outputDevices.isEmpty()) return outputDevices.first(); #endif return QAudioDeviceInfo(); }
QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(QLatin1String("default"))); if (plugin) { QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput); if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } #endif QAudioDeviceInfo result; #ifndef QT_NO_AUDIO_BACKEND #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN)) result = QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif #endif return result; }