From fb50411e4c0c132631f8237933fbb0972fa4c9aa Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Thu, 24 Sep 2009 11:55:52 +1000 Subject: AudioService API changes; QString->const QString&, remove QAudioDeviceId use QAudioDeviceInfo. Reviewed-by: Bill King --- doc/src/snippets/audio/main.cpp | 3 +- .../multimedia/audio/audiodevices/audiodevices.cpp | 32 ++-- .../multimedia/audio/audiodevices/audiodevices.h | 3 +- .../multimedia/audio/audioinput/audioinput.cpp | 6 +- examples/multimedia/audio/audioinput/audioinput.h | 2 +- .../multimedia/audio/audiooutput/audiooutput.cpp | 8 +- .../multimedia/audio/audiooutput/audiooutput.h | 2 +- src/multimedia/audio/audio.pri | 7 +- src/multimedia/audio/qaudiodevicefactory.cpp | 83 +++++----- src/multimedia/audio/qaudiodevicefactory_p.h | 17 +-- src/multimedia/audio/qaudiodeviceid.cpp | 168 --------------------- src/multimedia/audio/qaudiodeviceid.h | 94 ------------ src/multimedia/audio/qaudiodeviceid_p.h | 82 ---------- src/multimedia/audio/qaudiodeviceinfo.cpp | 164 ++++++++++++++++---- src/multimedia/audio/qaudiodeviceinfo.h | 32 ++-- src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 38 ++--- src/multimedia/audio/qaudiodeviceinfo_alsa_p.h | 6 +- src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp | 28 ++-- src/multimedia/audio/qaudiodeviceinfo_mac_p.h | 4 +- src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 38 ++--- src/multimedia/audio/qaudiodeviceinfo_win32_p.h | 6 +- src/multimedia/audio/qaudioformat.cpp | 2 +- src/multimedia/audio/qaudioformat.h | 2 +- src/multimedia/audio/qaudioinput.cpp | 10 +- src/multimedia/audio/qaudioinput.h | 5 +- src/multimedia/audio/qaudiooutput.cpp | 8 +- src/multimedia/audio/qaudiooutput.h | 4 +- tests/auto/qaudiodeviceid/qaudiodeviceid.pro | 7 - tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp | 118 --------------- .../auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp | 8 +- tests/auto/qaudioinput/tst_qaudioinput.cpp | 2 +- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 2 +- 32 files changed, 302 insertions(+), 689 deletions(-) delete mode 100644 src/multimedia/audio/qaudiodeviceid.cpp delete mode 100644 src/multimedia/audio/qaudiodeviceid.h delete mode 100644 src/multimedia/audio/qaudiodeviceid_p.h delete mode 100644 tests/auto/qaudiodeviceid/qaudiodeviceid.pro delete mode 100644 tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp index e663115..0910865 100644 --- a/doc/src/snippets/audio/main.cpp +++ b/doc/src/snippets/audio/main.cpp @@ -98,8 +98,7 @@ private: //![2] format.setSampleType(QAudioFormat::SignedInt); - QAudioDeviceId id = QAudioDeviceInfo::defaultOutputDevice(); - QAudioDeviceInfo info(id); + QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (!info.isFormatSupported(format)) format = info.nearestFormat(format); diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audio/audiodevices/audiodevices.cpp index 0d305ff..4198605 100644 --- a/examples/multimedia/audio/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audio/audiodevices/audiodevices.cpp @@ -80,8 +80,6 @@ AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f ) connect(sampleTypesBox,SIGNAL(activated(int)),SLOT(sampleTypeChanged(int))); connect(endianBox,SIGNAL(activated(int)),SLOT(endianChanged(int))); - device = 0; - modeBox->setCurrentIndex(0); modeChanged(0); deviceBox->setCurrentIndex(0); @@ -98,8 +96,8 @@ void AudioTest::test() logOutput->clear(); logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); - if(device) { - if(device->isFormatSupported(settings)) { + if (!deviceInfo.isNull()) { + if (deviceInfo.isFormatSupported(settings)) { logOutput->append("Success"); nearestFreq->setText(""); nearestChannel->setText(""); @@ -108,7 +106,7 @@ void AudioTest::test() nearestSampleType->setText(""); nearestEndian->setText(""); } else { - QAudioFormat nearest = device->nearestFormat(settings); + QAudioFormat nearest = deviceInfo.nearestFormat(settings); logOutput->append(tr("Failed")); nearestFreq->setText(QString("%1").arg(nearest.frequency())); nearestChannel->setText(QString("%1").arg(nearest.channels())); @@ -150,40 +148,34 @@ void AudioTest::modeChanged(int idx) mode=QAudio::AudioOutput; deviceBox->clear(); - QList devices = QAudioDeviceInfo::deviceList(mode); - for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); - } + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); } void AudioTest::deviceChanged(int idx) { - delete device; - device = 0; - if (deviceBox->count() == 0) return; // device has changed - deviceHandle = deviceBox->itemData(idx).value(); - device = new QAudioDeviceInfo(deviceHandle, this); + deviceInfo = deviceBox->itemData(idx).value(); frequencyBox->clear(); - QList freqz = device->supportedFrequencies(); + QList freqz = deviceInfo.supportedFrequencies(); for(int i = 0; i < freqz.size(); ++i) frequencyBox->addItem(QString("%1").arg(freqz.at(i))); if(freqz.size()) settings.setFrequency(freqz.at(0)); channelsBox->clear(); - QList chz = device->supportedChannels(); + QList chz = deviceInfo.supportedChannels(); for(int i = 0; i < chz.size(); ++i) channelsBox->addItem(QString("%1").arg(chz.at(i))); if(chz.size()) settings.setChannels(chz.at(0)); codecsBox->clear(); - QStringList codecz = device->supportedCodecs(); + QStringList codecz = deviceInfo.supportedCodecs(); for(int i = 0; i < codecz.size(); ++i) codecsBox->addItem(QString("%1").arg(codecz.at(i))); if(codecz.size()) @@ -192,14 +184,14 @@ void AudioTest::deviceChanged(int idx) codecsBox->addItem("audio/test"); sampleSizesBox->clear(); - QList sampleSizez = device->supportedSampleSizes(); + QList sampleSizez = deviceInfo.supportedSampleSizes(); for(int i = 0; i < sampleSizez.size(); ++i) sampleSizesBox->addItem(QString("%1").arg(sampleSizez.at(i))); if(sampleSizez.size()) settings.setSampleSize(sampleSizez.at(0)); sampleTypesBox->clear(); - QList sampleTypez = device->supportedSampleTypes(); + QList sampleTypez = deviceInfo.supportedSampleTypes(); for(int i = 0; i < sampleTypez.size(); ++i) { switch(sampleTypez.at(i)) { case QAudioFormat::SignedInt: @@ -219,7 +211,7 @@ void AudioTest::deviceChanged(int idx) } endianBox->clear(); - QList endianz = device->supportedByteOrders(); + QList endianz = deviceInfo.supportedByteOrders(); for(int i = 0; i < endianz.size(); ++i) { switch(endianz.at(i)) { case QAudioFormat::LittleEndian: diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audio/audiodevices/audiodevices.h index acf492d..5fe5547 100644 --- a/examples/multimedia/audio/audiodevices/audiodevices.h +++ b/examples/multimedia/audio/audiodevices/audiodevices.h @@ -60,8 +60,7 @@ public: AudioTest( QMainWindow *parent = 0, Qt::WFlags f = 0 ); virtual ~AudioTest(); - QAudioDeviceId deviceHandle; - QAudioDeviceInfo* device; + QAudioDeviceInfo deviceInfo; QAudioFormat settings; QAudio::Mode mode; diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audio/audioinput/audioinput.cpp index a586bf3..c09e7d9 100644 --- a/examples/multimedia/audio/audioinput/audioinput.cpp +++ b/examples/multimedia/audio/audioinput/audioinput.cpp @@ -250,9 +250,9 @@ InputTest::InputTest() layout->addWidget(canvas); deviceBox = new QComboBox(this); - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); + deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i))); } connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); layout->addWidget(deviceBox); @@ -367,7 +367,7 @@ void InputTest::deviceChanged(int idx) audioInput->disconnect(this); delete audioInput; - device = deviceBox->itemData(idx).value(); + device = deviceBox->itemData(idx).value(); audioInput = new QAudioInput(device, format, this); connect(audioInput,SIGNAL(notify()),SLOT(status())); connect(audioInput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audio/audioinput/audioinput.h index c1bc602..7ba6f1f 100644 --- a/examples/multimedia/audio/audioinput/audioinput.h +++ b/examples/multimedia/audio/audioinput/audioinput.h @@ -116,7 +116,7 @@ public: InputTest(); ~InputTest(); - QAudioDeviceId device; + QAudioDeviceInfo device; QAudioFormat format; QAudioInput* audioInput; Spectrum* spec; diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audio/audiooutput/audiooutput.cpp index d239eb0..19f7a3f 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audio/audiooutput/audiooutput.cpp @@ -142,10 +142,8 @@ AudioTest::AudioTest() QVBoxLayout* layout = new QVBoxLayout; deviceBox = new QComboBox(this); - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); - for(int i = 0; i < devices.size(); ++i) { - deviceBox->addItem(QAudioDeviceInfo(devices.at(i)).deviceName(), qVariantFromValue(devices.at(i))); - } + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) + deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int))); layout->addWidget(deviceBox); @@ -200,7 +198,7 @@ void AudioTest::deviceChanged(int idx) audioOutput->disconnect(this); delete audioOutput; - device = deviceBox->itemData(idx).value(); + device = deviceBox->itemData(idx).value(); audioOutput = new QAudioOutput(device,settings,this); connect(audioOutput,SIGNAL(notify()),SLOT(status())); connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State))); diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audio/audiooutput/audiooutput.h index e2c22ee..a5c0289 100644 --- a/examples/multimedia/audio/audiooutput/audiooutput.h +++ b/examples/multimedia/audio/audiooutput/audiooutput.h @@ -87,7 +87,7 @@ public: AudioTest(); ~AudioTest(); - QAudioDeviceId device; + QAudioDeviceInfo device; Generator* gen; QAudioOutput* audioOutput; QIODevice* output; diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index c7fbbb0..c445941 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -5,9 +5,7 @@ HEADERS += $$PWD/qaudio.h \ $$PWD/qaudiodeviceinfo.h \ $$PWD/qaudioengineplugin.h \ $$PWD/qaudioengine.h \ - $$PWD/qaudiodevicefactory_p.h \ - $$PWD/qaudiodeviceid.h \ - $$PWD/qaudiodeviceid_p.h + $$PWD/qaudiodevicefactory_p.h SOURCES += $$PWD/qaudio.cpp \ @@ -17,8 +15,7 @@ SOURCES += $$PWD/qaudio.cpp \ $$PWD/qaudioinput.cpp \ $$PWD/qaudioengineplugin.cpp \ $$PWD/qaudioengine.cpp \ - $$PWD/qaudiodevicefactory.cpp \ - $$PWD/qaudiodeviceid.cpp + $$PWD/qaudiodevicefactory.cpp mac { HEADERS += $$PWD/qaudioinput_mac_p.h \ diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 9ed1d70..8804fb6 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -44,7 +44,6 @@ #include #include #include "qaudiodevicefactory_p.h" -#include "qaudiodeviceid_p.h" #if defined(Q_OS_WIN) #include "qaudiodeviceinfo_win32_p.h" @@ -123,12 +122,12 @@ public: QAudioFormat format() const { return QAudioFormat(); } }; -QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) +QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) { - QList devices; + QList devices; #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - foreach (const QByteArray &handle, QAudioDeviceInfoPrivate::deviceList(mode)) - devices += createDeviceId(QLatin1String("builtin"), mode, handle); + foreach (const QByteArray &handle, QAudioDeviceInfoInternal::deviceList(mode)) + devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif QFactoryLoader* l = loader(); @@ -136,7 +135,7 @@ QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) QAudioEngineFactoryInterface* plugin = qobject_cast(l->instance(key)); if (plugin) { foreach (QByteArray const& handle, plugin->deviceList(mode)) - devices += createDeviceId(key, mode, handle); + devices << QAudioDeviceInfo(key, handle, mode); } delete plugin; @@ -145,50 +144,51 @@ QList QAudioDeviceFactory::deviceList(QAudio::Mode mode) return devices; } -QAudioDeviceId QAudioDeviceFactory::defaultInputDevice() +QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() { QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { QList list = plugin->deviceList(QAudio::AudioInput); if (list.size() > 0) - return createDeviceId(QLatin1String("default"), QAudio::AudioInput, list.at(0)); + return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - return createDeviceId(QLatin1String("builtin"), QAudio::AudioInput, QAudioDeviceInfoPrivate::defaultInputDevice()); + return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput); #endif - return QAudioDeviceId(); + return QAudioDeviceInfo(); } -QAudioDeviceId QAudioDeviceFactory::defaultOutputDevice() +QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() { QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(QLatin1String("default"))); if (plugin) { QList list = plugin->deviceList(QAudio::AudioOutput); if (list.size() > 0) - return createDeviceId(QLatin1String("default"), QAudio::AudioOutput, list.at(0)); + return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - return createDeviceId(QLatin1String("builtin"), QAudio::AudioOutput, QAudioDeviceInfoPrivate::defaultOutputDevice()); + return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput); #endif - return QAudioDeviceId(); + return QAudioDeviceInfo(); } -QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(QAudioDeviceId const& id) +QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode) { - if (id.isNull()) - return new QNullDeviceInfo(); + QAbstractAudioDeviceInfo *rc = 0; + #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) - return new QAudioDeviceInfoPrivate(id.d->handle, QAudio::Mode(id.d->mode)); + if (realm == QLatin1String("builtin")) + return new QAudioDeviceInfoInternal(handle, mode); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(id.d->key)); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(realm)); if (plugin) - return plugin->createDeviceInfo(id.d->handle, QAudio::Mode(id.d->mode)); + rc = plugin->createDeviceInfo(handle, mode); - return new QNullDeviceInfo(); + return rc == 0 ? new QNullDeviceInfo() : rc; } QAbstractAudioInput* QAudioDeviceFactory::createDefaultInputDevice(QAudioFormat const &format) @@ -201,50 +201,39 @@ QAbstractAudioOutput* QAudioDeviceFactory::createDefaultOutputDevice(QAudioForma return createOutputDevice(defaultOutputDevice(), format); } -QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceId const& id, QAudioFormat const &format) +QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format) { - if (id.isNull()) + if (deviceInfo.isNull()) return new QNullInputDevice(); #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) { - if(!defaultInputDevice().isNull()) - return new QAudioInputPrivate(id.d->handle, format); - else - return new QNullInputDevice(); - } + if (deviceInfo.realm() == QLatin1String("builtin")) + return new QAudioInputPrivate(deviceInfo.handle(), format); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance((id.d->key))); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) - return plugin->createInput(id.d->handle, format); + return plugin->createInput(deviceInfo.handle(), format); return new QNullInputDevice(); } -QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceId const& id, QAudioFormat const &format) +QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format) { - if (id.isNull()) + if (deviceInfo.isNull()) return new QNullOutputDevice(); #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - if (id.d->key == QLatin1String("builtin")) { - if(!defaultOutputDevice().isNull()) - return new QAudioOutputPrivate(id.d->handle, format); - else - return new QNullOutputDevice(); - } + if (deviceInfo.realm() == QLatin1String("builtin")) + return new QAudioOutputPrivate(deviceInfo.handle(), format); #endif - QAudioEngineFactoryInterface* plugin = qobject_cast(loader()->instance(id.d->key)); + QAudioEngineFactoryInterface* plugin = + qobject_cast(loader()->instance(deviceInfo.realm())); if (plugin) - return plugin->createOutput(id.d->handle, format); + return plugin->createOutput(deviceInfo.handle(), format); return new QNullOutputDevice(); } -QAudioDeviceId QAudioDeviceFactory::createDeviceId(QString const& key, int mode, QByteArray const& handle) -{ - return QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle)); -} - QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h index 8e4cf5a..008e4a8 100644 --- a/src/multimedia/audio/qaudiodevicefactory_p.h +++ b/src/multimedia/audio/qaudiodevicefactory_p.h @@ -57,7 +57,6 @@ #include #include -#include #include QT_BEGIN_HEADER @@ -68,28 +67,26 @@ QT_MODULE(Multimedia) class QAbstractAudioInput; class QAbstractAudioOutput; - +class QAbstractAudioDeviceInfo; class QAudioDeviceFactory { public: - static QList deviceList(QAudio::Mode mode); + static QList deviceList(QAudio::Mode mode); - static QAudioDeviceId defaultInputDevice(); - static QAudioDeviceId defaultOutputDevice(); + static QAudioDeviceInfo defaultInputDevice(); + static QAudioDeviceInfo defaultOutputDevice(); - static QAbstractAudioDeviceInfo* audioDeviceInfo(QAudioDeviceId const &device); + static QAbstractAudioDeviceInfo* audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); static QAbstractAudioInput* createDefaultInputDevice(QAudioFormat const &format); static QAbstractAudioOutput* createDefaultOutputDevice(QAudioFormat const &format); - static QAbstractAudioInput* createInputDevice(QAudioDeviceId const &device, QAudioFormat const &format); - static QAbstractAudioOutput* createOutputDevice(QAudioDeviceId const &device, QAudioFormat const &format); + static QAbstractAudioInput* createInputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format); + static QAbstractAudioOutput* createOutputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format); static QAbstractAudioInput* createNullInput(); static QAbstractAudioOutput* createNullOutput(); - - static QAudioDeviceId createDeviceId(QString const& key, int mode, QByteArray const& handle); }; QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceid.cpp b/src/multimedia/audio/qaudiodeviceid.cpp deleted file mode 100644 index bdbc580..0000000 --- a/src/multimedia/audio/qaudiodeviceid.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include -#include "qaudiodeviceid_p.h" - - -QT_BEGIN_NAMESPACE - -/*! - \class QAudioDeviceId - \brief The QAudioDeviceId class provides means for identifying a unique input or output device on a system. - - \inmodule QtMultimedia - \ingroup multimedia - \since 4.6 - - \sa QAudioDeviceInfo, QAudioOutput, QAudioInput -*/ - -/*! - Construct a new null QAudioDeviceId. -*/ - -QAudioDeviceId::QAudioDeviceId() -{ -} - -/*! - Copy the QAudDeviceId referenced by \a other. -*/ - -QAudioDeviceId::QAudioDeviceId(const QAudioDeviceId &other): - d(other.d) -{ -} - -/*! - Destroy the QAudioDeviceId. -*/ - -QAudioDeviceId::~QAudioDeviceId() -{ -} - -/*! - Make a copy of the \a other QAudioDeviceId. -*/ - -QAudioDeviceId& QAudioDeviceId::operator=(const QAudioDeviceId &other) -{ - d = other.d; - return *this; -} - -/*! - Compare with the \a other QAudioDeviceId, return true if they are the same; - otherwise false. -*/ - -bool QAudioDeviceId::operator==(const QAudioDeviceId &other) const -{ - return (d.constData() == 0 && other.d.constData() == 0) || - (d.constData() != 0 && other.d.constData() != 0 && - d->key == other.d->key && d->mode == other.d->mode && d->handle == other.d->handle); -} - -/*! - Compare with the \a other QAudioDeviceId, return false if they are the same; - otherwise true. -*/ - -bool QAudioDeviceId::operator!=(const QAudioDeviceId &other) const -{ - return !(*this == other); -} - -/*! - Returns true if this is not a valid QAudioDeviceId; otherwise false. -*/ - -bool QAudioDeviceId::isNull() const -{ - return d.constData() == 0; -} - -/*! - \internal -*/ - -QAudioDeviceId::QAudioDeviceId(QAudioDeviceIdPrivate* data): - d(data) -{ -} - -/*! - \internal -*/ - -QAudioDeviceIdPrivate::QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h): - key(k), mode(m), handle(h) -{ -} - -#ifndef QT_NO_DATASTREAM -Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream &s, const QAudioDeviceId &id) -{ - s << id.d->key << id.d->mode << id.d->handle; - return s; -} - -Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream &s, QAudioDeviceId &id) -{ - QString key; - int mode; - QByteArray handle; - - s >> key >> mode >> handle; - id = QAudioDeviceId(new QAudioDeviceIdPrivate(key, mode, handle)); - - return s; -} -#endif - - -QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceid.h b/src/multimedia/audio/qaudiodeviceid.h deleted file mode 100644 index 61d0d9a..0000000 --- a/src/multimedia/audio/qaudiodeviceid.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAUDIODEVICEID_H -#define QAUDIODEVICEID_H - -#include -#include - - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - - -class QAudioDeviceFactory; -class QAudioDeviceIdPrivate; - -class Q_MULTIMEDIA_EXPORT QAudioDeviceId -{ - friend class QAudioDeviceFactory; - friend Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&); - friend Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&); - -public: - QAudioDeviceId(); - QAudioDeviceId(const QAudioDeviceId &other); - ~QAudioDeviceId(); - - QAudioDeviceId& operator=(const QAudioDeviceId &other); - bool operator==(const QAudioDeviceId &id) const; - bool operator!=(const QAudioDeviceId &id) const; - - bool isNull() const; - -private: - QAudioDeviceId(QAudioDeviceIdPrivate *data); - - QSharedDataPointer d; -}; - -#ifndef QT_NO_DATASTREAM -Q_MULTIMEDIA_EXPORT QDataStream &operator<<(QDataStream&, const QAudioDeviceId&); -Q_MULTIMEDIA_EXPORT QDataStream &operator>>(QDataStream&, QAudioDeviceId&); -#endif - -QT_END_NAMESPACE - -QT_END_HEADER - -Q_DECLARE_METATYPE(QAudioDeviceId) - - -#endif // QAUDIODEVICEID_H diff --git a/src/multimedia/audio/qaudiodeviceid_p.h b/src/multimedia/audio/qaudiodeviceid_p.h deleted file mode 100644 index 113e1f0..0000000 --- a/src/multimedia/audio/qaudiodeviceid_p.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtMultimedia module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of other Qt classes. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#ifndef QAUDIODEVICEIDPRIVATE_H -#define QAUDIODEVICEIDPRIVATE_H - -#include -#include -#include - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Multimedia) - - -class QAudioDeviceIdPrivate : public QSharedData -{ -public: - QAudioDeviceIdPrivate(QString const& k, int m, QByteArray const& h); - - QString key; - int mode; - QByteArray handle; -}; - - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QAUDIODEVICEIDPRIVATE_H diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index e38a91e..dce2884 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -46,12 +46,52 @@ QT_BEGIN_NAMESPACE +class QAudioDeviceInfoPrivate : public QSharedData +{ +public: + QAudioDeviceInfoPrivate():info(0) {} + QAudioDeviceInfoPrivate(const QString &r, const QByteArray &h, QAudio::Mode m): + realm(r), handle(h), mode(m) + { + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + } + + QAudioDeviceInfoPrivate(const QAudioDeviceInfoPrivate &other): + QSharedData(other), + realm(other.realm), handle(other.handle), mode(other.mode) + { + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + } + + QAudioDeviceInfoPrivate& operator=(const QAudioDeviceInfoPrivate &other) + { + delete info; + + realm = other.realm; + handle = other.handle; + mode = other.mode; + info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode); + return *this; + } + + ~QAudioDeviceInfoPrivate() + { + delete info; + } + + QString realm; + QByteArray handle; + QAudio::Mode mode; + QAbstractAudioDeviceInfo* info; +}; + + /*! \class QAudioDeviceInfo \brief The QAudioDeviceInfo class provides an interface to query audio devices and their functionality. - \inmodule QtMultimedia \ingroup multimedia + \since 4.6 QAudioDeviceInfo lets you query for audio devices--such as sound @@ -77,41 +117,45 @@ QT_BEGIN_NAMESPACE \dots 8 \snippet doc/src/snippets/audio/main.cpp 2 - A QAudioDeviceInfo is constructed with a QAudioDeviceId, which is - an identifier for a physical device. It is used by Qt to construct + A QAudioDeviceInfo is used by Qt to construct classes that communicate with the device--such as - QAudioDeviceInfo, QAudioInput, and QAudioOutput. The static + QAudioInput, and QAudioOutput. The static functions defaultInputDevice(), defaultOutputDevice(), and - deviceList() let you get a hold of the ids for all available - devices. You fetch ids based on whether you will use the device - for input or output; this is specified by the QAudio::Mode enum. - The QAudioDeviceId returned are only valid for the QAudio::Mode. + deviceList() let you get a list of all available + devices. Devices are fetch according to the value of mode + this is specified by the QAudio::Mode enum. + The QAudioDeviceInfo returned are only valid for the QAudio::Mode. For instance: \code - foreach(QAudioDeviceId audioId, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) { - QAudioDeviceInfo info(audioId); - qDebug() << "Device name: " << info.deviceName(); - } + foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) + qDebug() << "Device name: " << deviceInfo.deviceName(); \endcode In this code sample, we loop through all devices that are able to output sound, i.e., play an audio stream in a supported format. For each device we find, we simply print the deviceName(). - \sa QAudioOutput, QAudioInput, QAudioDeviceId + \sa QAudioOutput, QAudioInput */ /*! - Construct a new audio device info and attach it to \a parent. - Using the audio device with the specified \a id. + Constructs an empty QAudioDeviceInfo object. */ -QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent): - QObject(parent) +QAudioDeviceInfo::QAudioDeviceInfo(): + d(new QAudioDeviceInfoPrivate) +{ +} + +/*! + Constructs a copy of \a other. +*/ + +QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceInfo& other): + d(other.d) { - d = QAudioDeviceFactory::audioDeviceInfo(id); } /*! @@ -120,7 +164,25 @@ QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent): QAudioDeviceInfo::~QAudioDeviceInfo() { - delete d; +} + +/*! + Sets the QAudioDeviceInfo object to be equal to \a other. +*/ + +QAudioDeviceInfo& QAudioDeviceInfo::operator=(const QAudioDeviceInfo &other) +{ + d = other.d; + return *this; +} + +/*! + Returns whether this QAudioDeviceInfo object holds a device definition. +*/ + +bool QAudioDeviceInfo::isNull() const +{ + return d->info == 0; } /*! @@ -135,7 +197,7 @@ QAudioDeviceInfo::~QAudioDeviceInfo() QString QAudioDeviceInfo::deviceName() const { - return d->deviceName(); + return isNull() ? QString() : d->info->deviceName(); } /*! @@ -144,7 +206,7 @@ QString QAudioDeviceInfo::deviceName() const bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const { - return d->isFormatSupported(settings); + return isNull() ? false : d->info->isFormatSupported(settings); } /*! @@ -163,7 +225,7 @@ bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const QAudioFormat QAudioDeviceInfo::preferredFormat() const { - return d->preferredFormat(); + return isNull() ? QAudioFormat() : d->info->preferredFormat(); } /*! @@ -176,7 +238,7 @@ QAudioFormat QAudioDeviceInfo::preferredFormat() const QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const { - return d->nearestFormat(settings); + return isNull() ? QAudioFormat() : d->info->nearestFormat(settings); } /*! @@ -193,7 +255,7 @@ QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const QStringList QAudioDeviceInfo::supportedCodecs() const { - return d->codecList(); + return isNull() ? QStringList() : d->info->codecList(); } /*! @@ -202,7 +264,7 @@ QStringList QAudioDeviceInfo::supportedCodecs() const QList QAudioDeviceInfo::supportedFrequencies() const { - return d->frequencyList(); + return isNull() ? QList() : d->info->frequencyList(); } /*! @@ -211,7 +273,7 @@ QList QAudioDeviceInfo::supportedFrequencies() const QList QAudioDeviceInfo::supportedChannels() const { - return d->channelsList(); + return isNull() ? QList() : d->info->channelsList(); } /*! @@ -220,7 +282,7 @@ QList QAudioDeviceInfo::supportedChannels() const QList QAudioDeviceInfo::supportedSampleSizes() const { - return d->sampleSizeList(); + return isNull() ? QList() : d->info->sampleSizeList(); } /*! @@ -229,7 +291,7 @@ QList QAudioDeviceInfo::supportedSampleSizes() const QList QAudioDeviceInfo::supportedByteOrders() const { - return d->byteOrderList(); + return isNull() ? QList() : d->info->byteOrderList(); } /*! @@ -238,7 +300,7 @@ QList QAudioDeviceInfo::supportedByteOrders() const QList QAudioDeviceInfo::supportedSampleTypes() const { - return d->sampleTypeList(); + return isNull() ? QList() : d->info->sampleTypeList(); } /*! @@ -246,7 +308,7 @@ QList QAudioDeviceInfo::supportedSampleTypes() const All platform and audio plugin implementations provide a default audio device to use. */ -QAudioDeviceId QAudioDeviceInfo::defaultInputDevice() +QAudioDeviceInfo QAudioDeviceInfo::defaultInputDevice() { return QAudioDeviceFactory::defaultInputDevice(); } @@ -256,7 +318,7 @@ QAudioDeviceId QAudioDeviceInfo::defaultInputDevice() All platform and audio plugin implementations provide a default audio device to use. */ -QAudioDeviceId QAudioDeviceInfo::defaultOutputDevice() +QAudioDeviceInfo QAudioDeviceInfo::defaultOutputDevice() { return QAudioDeviceFactory::defaultOutputDevice(); } @@ -265,10 +327,48 @@ QAudioDeviceId QAudioDeviceInfo::defaultOutputDevice() Returns a list of audio devices that support \a mode. */ -QList QAudioDeviceInfo::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfo::deviceList(QAudio::Mode mode) { return QAudioDeviceFactory::deviceList(mode); } + +/*! + \internal +*/ + +QAudioDeviceInfo::QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode): + d(new QAudioDeviceInfoPrivate(realm, handle, mode)) +{ +} + +/*! + \internal +*/ + +QString QAudioDeviceInfo::realm() const +{ + return d->realm; +} + +/*! + \internal +*/ + +QByteArray QAudioDeviceInfo::handle() const +{ + return d->handle; +} + + +/*! + \internal +*/ + +QAudio::Mode QAudioDeviceInfo::mode() const +{ + return d->mode; +} + QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index b6adb85..53b9904 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -52,7 +52,7 @@ #include #include -#include + QT_BEGIN_HEADER @@ -60,17 +60,22 @@ QT_BEGIN_NAMESPACE QT_MODULE(Multimedia) +class QAudioDeviceFactory; -class QAbstractAudioDeviceInfo; - -class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo : public QObject +class QAudioDeviceInfoPrivate; +class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo { - Q_OBJECT + friend class QAudioDeviceFactory; public: - explicit QAudioDeviceInfo(const QAudioDeviceId &id, QObject *parent = 0); + QAudioDeviceInfo(); + QAudioDeviceInfo(const QAudioDeviceInfo& other); ~QAudioDeviceInfo(); + QAudioDeviceInfo& operator=(const QAudioDeviceInfo& other); + + bool isNull() const; + QString deviceName() const; bool isFormatSupported(const QAudioFormat &format) const; @@ -84,19 +89,24 @@ public: QList supportedByteOrders() const; QList supportedSampleTypes() const; - static QAudioDeviceId defaultInputDevice(); - static QAudioDeviceId defaultOutputDevice(); + static QAudioDeviceInfo defaultInputDevice(); + static QAudioDeviceInfo defaultOutputDevice(); - static QList deviceList(QAudio::Mode mode); + static QList deviceList(QAudio::Mode mode); private: - Q_DISABLE_COPY(QAudioDeviceInfo) + QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); + QString realm() const; + QByteArray handle() const; + QAudio::Mode mode() const; - QAbstractAudioDeviceInfo* d; + QSharedDataPointer d; }; QT_END_NAMESPACE QT_END_HEADER +Q_DECLARE_METATYPE(QAudioDeviceInfo) + #endif // QAUDIODEVICEINFO_H diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index c944cf0..dc24875 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) { handle = 0; @@ -62,17 +62,17 @@ QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mo this->mode = mode; } -QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate() +QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() { close(); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { @@ -97,7 +97,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return nearest; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { if(testSettings(format)) return format; @@ -105,48 +105,48 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return preferredFormat(); } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return device; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { updateLists(); return codecz; } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { updateLists(); return freqz; } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { updateLists(); return channelz; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { updateLists(); return sizez; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { updateLists(); return byteOrderz; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { updateLists(); return typez; } -bool QAudioDeviceInfoPrivate::open() +bool QAudioDeviceInfoInternal::open() { int err = 0; QString dev = device; @@ -166,14 +166,14 @@ bool QAudioDeviceInfoPrivate::open() return true; } -void QAudioDeviceInfoPrivate::close() +void QAudioDeviceInfoInternal::close() { if(handle) snd_pcm_close(handle); handle = 0; } -bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -324,7 +324,7 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const return false; } -void QAudioDeviceInfoPrivate::updateLists() +void QAudioDeviceInfoInternal::updateLists() { // redo all lists based on current settings freqz.clear(); @@ -358,7 +358,7 @@ void QAudioDeviceInfoPrivate::updateLists() close(); } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QAudio::Mode _m; QList devices; @@ -416,7 +416,7 @@ QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { QList devices = deviceList(QAudio::AudioInput); if(devices.size() == 0) @@ -425,7 +425,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return QByteArray("default"); } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { QList devices = deviceList(QAudio::AudioOutput); if(devices.size() == 0) diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 9990281..10078ca 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -71,12 +71,12 @@ const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoPrivate(); + QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); + ~QAudioDeviceInfoInternal(); bool testSettings(const QAudioFormat& format) const; void updateLists(); diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index 957a5c7..ec07748 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode) { QDataStream ds(handle); quint32 did, tm; @@ -76,12 +76,12 @@ QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray const& handle, QAudi mode = QAudio::Mode(tm); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return format.codec() == QString::fromLatin1("audio/pcm"); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat rc; @@ -134,7 +134,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return rc; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { QAudioFormat rc(format); QAudioFormat target = preferredFormat(); @@ -158,17 +158,17 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return rc; } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return name; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { return QStringList() << QString::fromLatin1("audio/pcm"); } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { QSet rc; @@ -208,7 +208,7 @@ QList QAudioDeviceInfoPrivate::frequencyList() return rc.toList(); } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { QList rc; @@ -248,17 +248,17 @@ QList QAudioDeviceInfoPrivate::channelsList() return rc; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { return QList() << 8 << 16 << 24 << 32 << 64; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { return QList() << QAudioFormat::LittleEndian << QAudioFormat::BigEndian; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { return QList() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float; } @@ -296,7 +296,7 @@ static QByteArray get_device_info(AudioDeviceID audioDevice, QAudio::Mode mode) return device; } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { AudioDeviceID audioDevice; UInt32 size = sizeof(audioDevice); @@ -310,7 +310,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() return get_device_info(audioDevice, QAudio::AudioInput); } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { AudioDeviceID audioDevice; UInt32 size = sizeof(audioDevice); @@ -324,7 +324,7 @@ QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() return get_device_info(audioDevice, QAudio::AudioOutput); } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QList devices; diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h index 7e8e752..60532a8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h @@ -62,14 +62,14 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { public: AudioDeviceID deviceId; QString name; QAudio::Mode mode; - QAudioDeviceInfoPrivate(QByteArray const& handle, QAudio::Mode mode); + QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode mode); bool isFormatSupported(const QAudioFormat& format) const; QAudioFormat preferredFormat() const; diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index ba9f5e2..69d5c94 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -74,23 +74,23 @@ QT_BEGIN_NAMESPACE #endif -QAudioDeviceInfoPrivate::QAudioDeviceInfoPrivate(QByteArray dev, QAudio::Mode mode) +QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) { device = QLatin1String(dev); this->mode = mode; } -QAudioDeviceInfoPrivate::~QAudioDeviceInfoPrivate() +QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() { close(); } -bool QAudioDeviceInfoPrivate::isFormatSupported(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const { return testSettings(format); } -QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const +QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const { QAudioFormat nearest; if(mode == QAudio::AudioOutput) { @@ -110,7 +110,7 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const return nearest; } -QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) const +QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format) const { if(testSettings(format)) return format; @@ -118,58 +118,58 @@ QAudioFormat QAudioDeviceInfoPrivate::nearestFormat(const QAudioFormat& format) return preferredFormat(); } -QString QAudioDeviceInfoPrivate::deviceName() const +QString QAudioDeviceInfoInternal::deviceName() const { return device; } -QStringList QAudioDeviceInfoPrivate::codecList() +QStringList QAudioDeviceInfoInternal::codecList() { updateLists(); return codecz; } -QList QAudioDeviceInfoPrivate::frequencyList() +QList QAudioDeviceInfoInternal::frequencyList() { updateLists(); return freqz; } -QList QAudioDeviceInfoPrivate::channelsList() +QList QAudioDeviceInfoInternal::channelsList() { updateLists(); return channelz; } -QList QAudioDeviceInfoPrivate::sampleSizeList() +QList QAudioDeviceInfoInternal::sampleSizeList() { updateLists(); return sizez; } -QList QAudioDeviceInfoPrivate::byteOrderList() +QList QAudioDeviceInfoInternal::byteOrderList() { updateLists(); return byteOrderz; } -QList QAudioDeviceInfoPrivate::sampleTypeList() +QList QAudioDeviceInfoInternal::sampleTypeList() { updateLists(); return typez; } -bool QAudioDeviceInfoPrivate::open() +bool QAudioDeviceInfoInternal::open() { return true; } -void QAudioDeviceInfoPrivate::close() +void QAudioDeviceInfoInternal::close() { } -bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const +bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). @@ -199,7 +199,7 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const return false; } -void QAudioDeviceInfoPrivate::updateLists() +void QAudioDeviceInfoInternal::updateLists() { // redo all lists based on current settings bool base = false; @@ -333,7 +333,7 @@ void QAudioDeviceInfoPrivate::updateLists() } } -QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) +QList QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { Q_UNUSED(mode) @@ -367,12 +367,12 @@ QList QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) return devices; } -QByteArray QAudioDeviceInfoPrivate::defaultOutputDevice() +QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { return QByteArray("default"); } -QByteArray QAudioDeviceInfoPrivate::defaultInputDevice() +QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { return QByteArray("default"); } diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index 7cf7f45..0d2ee29 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -68,13 +68,13 @@ QT_BEGIN_NAMESPACE const unsigned int MAX_SAMPLE_RATES = 5; const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 }; -class QAudioDeviceInfoPrivate : public QAbstractAudioDeviceInfo +class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo { Q_OBJECT public: - QAudioDeviceInfoPrivate(QByteArray dev,QAudio::Mode mode); - ~QAudioDeviceInfoPrivate(); + QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode); + ~QAudioDeviceInfoInternal(); bool open(); void close(); diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index c23e454..86fe85b 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -286,7 +286,7 @@ int QAudioFormat::sampleSize() const \sa QAudioDeviceInfo::supportedCodecs() */ -void QAudioFormat::setCodec(QString codec) +void QAudioFormat::setCodec(const QString &codec) { d->codec = codec; } diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index 4cd6e23..d5841ce 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -82,7 +82,7 @@ public: void setSampleSize(int sampleSize); int sampleSize() const; - void setCodec(QString codec); + void setCodec(const QString &codec); QString codec() const; void setByteOrder(QAudioFormat::Endian byteOrder); diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index 3c0d98e..858846f 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE You can construct an audio input with the system's \l{QAudioDeviceInfo::defaultInputDevice()}{default audio input device}. It is also possible to create QAudioInput with a - specific QAudioDeviceId. When you create the audio input, you + specific QAudioDeviceInfo. When you create the audio input, you should also send in the QAudioFormat to be used for the recording (see the QAudioFormat class description for details). @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE QAudioInput lets you record audio with an audio input device. The default constructor of this class will use the systems default - audio device, but you can also specify a QAudioDeviceId for a + audio device, but you can also specify a QAudioDeviceInfo for a specific device. You also need to pass in the QAudioFormat in which you wish to record. @@ -154,14 +154,14 @@ QAudioInput::QAudioInput(const QAudioFormat &format, QObject *parent): /*! Construct a new audio input and attach it to \a parent. - The \a id of the audio input device is used with the input + The device referenced by \a audioDevice is used with the input \a format parameters. */ -QAudioInput::QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent): +QAudioInput::QAudioInput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent): QObject(parent) { - d = QAudioDeviceFactory::createInputDevice(id, format); + d = QAudioDeviceFactory::createInputDevice(audioDevice, format); connect(d, SIGNAL(notify()), SIGNAL(notify())); connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State))); } diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h index 277a6cf..c8094f5 100644 --- a/src/multimedia/audio/qaudioinput.h +++ b/src/multimedia/audio/qaudioinput.h @@ -48,7 +48,8 @@ #include #include -#include +#include + QT_BEGIN_HEADER @@ -65,7 +66,7 @@ class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject public: explicit QAudioInput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); - explicit QAudioInput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioInput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); ~QAudioInput(); QAudioFormat format() const; diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index 8a8edb4..3d3f5f5 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE You can construct an audio output with the system's \l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output device}. It is also possible to create QAudioOutput with a - specific QAudioDeviceId. When you create the audio output, you + specific QAudioDeviceInfo. When you create the audio output, you should also send in the QAudioFormat to be used for the playback (see the QAudioFormat class description for details). @@ -155,14 +155,14 @@ QAudioOutput::QAudioOutput(const QAudioFormat &format, QObject *parent): /*! Construct a new audio output and attach it to \a parent. - The \a id of the audio output device is used with the output + The device referenced by \a audioDevice is used with the output \a format parameters. */ -QAudioOutput::QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format, QObject *parent): +QAudioOutput::QAudioOutput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent): QObject(parent) { - d = QAudioDeviceFactory::createOutputDevice(id, format); + d = QAudioDeviceFactory::createOutputDevice(audioDevice, format); connect(d, SIGNAL(notify()), SIGNAL(notify())); connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State))); } diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h index 1ed3d06..bb3496e 100644 --- a/src/multimedia/audio/qaudiooutput.h +++ b/src/multimedia/audio/qaudiooutput.h @@ -48,7 +48,7 @@ #include #include -#include +#include QT_BEGIN_HEADER @@ -66,7 +66,7 @@ class Q_MULTIMEDIA_EXPORT QAudioOutput : public QObject public: explicit QAudioOutput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); - explicit QAudioOutput(const QAudioDeviceId &id, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); + explicit QAudioOutput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0); ~QAudioOutput(); QAudioFormat format() const; diff --git a/tests/auto/qaudiodeviceid/qaudiodeviceid.pro b/tests/auto/qaudiodeviceid/qaudiodeviceid.pro deleted file mode 100644 index e0c7d4d..0000000 --- a/tests/auto/qaudiodeviceid/qaudiodeviceid.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) - -DEFINES += SRCDIR=\\\"$$PWD/\\\" - -SOURCES += tst_qaudiodeviceid.cpp - -QT = core multimedia diff --git a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp b/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp deleted file mode 100644 index 02e475e..0000000 --- a/tests/auto/qaudiodeviceid/tst_qaudiodeviceid.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -#include -#include - - -class tst_QAudioDeviceId : public QObject -{ - Q_OBJECT - -public: - tst_QAudioDeviceId(QObject* parent=0) : QObject(parent) {} - -private slots: - void initTestCase(); - void checkNull(); - void checkEquality(); - -private: - bool available; -}; - -void tst_QAudioDeviceId::initTestCase() -{ - // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); - if(devices.size() > 0) - available = true; - else { - qWarning()<<"NOTE: no audio output device found, no test will be performed"; - available = false; - } -} - -void tst_QAudioDeviceId::checkNull() -{ - if(available) { - // Default constructed is null. - QAudioDeviceId deviceId0; - QVERIFY(deviceId0.isNull()); - - // Null is transferred - QAudioDeviceId deviceId1(deviceId0); - QVERIFY(deviceId1.isNull()); - } -} - -void tst_QAudioDeviceId::checkEquality() -{ - if(available) { - QAudioDeviceId deviceId0; - QAudioDeviceId deviceId1; - - // Null ids are equivalent - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); - - deviceId1 = QAudioDeviceInfo::defaultOutputDevice(); - - // Different - QVERIFY(deviceId0 != deviceId1); - QVERIFY(!(deviceId0 == deviceId1)); - - // Same - deviceId0 = deviceId1; - - QVERIFY(deviceId0 == deviceId1); - QVERIFY(!(deviceId0 != deviceId1)); - } -} - -QTEST_MAIN(tst_QAudioDeviceId) - -#include "tst_qaudiodeviceid.moc" diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index 45912e2..7b9a422 100644 --- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -77,7 +77,7 @@ private: void tst_QAudioDeviceInfo::initTestCase() { // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); if(devices.size() > 0) available = true; else { @@ -90,7 +90,7 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultInput() { // Only perform tests if audio input device exists! bool storeAvailable = available; - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { @@ -111,9 +111,9 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultOutput() void tst_QAudioDeviceInfo::outputList() { if(available) { - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); QVERIFY(devices.size() > 0); - device = new QAudioDeviceInfo(devices.at(0), this); + device = new QAudioDeviceInfo(devices.at(0)); } } diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index bf11961..7331072 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -75,7 +75,7 @@ void tst_QAudioInput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio input device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index db2444b..b45a57e 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -78,7 +78,7 @@ void tst_QAudioOutput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio output device exists! - QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); + QList devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); if(devices.size() > 0) available = true; else { -- cgit v0.12