Exemplo n.º 1
0
QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
{
    if (deviceInfo.isNull())
        return new QNullOutputDevice();
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
    if (deviceInfo.realm() == QLatin1String("builtin"))
        return new QAudioOutputPrivate(deviceInfo.handle(), format);
#endif
    QAudioEngineFactoryInterface* plugin =
        qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));

    if (plugin)
        return plugin->createOutput(deviceInfo.handle(), format);

    return new QNullOutputDevice();
}
QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
{
    if (deviceInfo.isNull())
        return new QNullOutputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
    if (deviceInfo.realm() == QLatin1String("builtin"))
        return new QAudioOutputPrivate(deviceInfo.handle(), format);
#endif
#endif
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
    QAudioEngineFactoryInterface* plugin =
        qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(deviceInfo.realm()));

    if (plugin)
        return plugin->createOutput(deviceInfo.handle(), format);
#endif
    return new QNullOutputDevice();
}