diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-10 03:07:46 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-11-10 03:07:46 (GMT) |
commit | 74d3a4bf9654c8bbe9139951cc5c9352015438a6 (patch) | |
tree | 63cc04b5546454fcf668125169c6793fcdbdf04c | |
parent | 8df98549a4d84b5877e50318140c2041e17632fb (diff) | |
download | Qt-74d3a4bf9654c8bbe9139951cc5c9352015438a6.zip Qt-74d3a4bf9654c8bbe9139951cc5c9352015438a6.tar.gz Qt-74d3a4bf9654c8bbe9139951cc5c9352015438a6.tar.bz2 |
Changes to low-level audio API.
QAudioFormat::isNull() -> QAudioFormat::isValid() (inverse logic)
QAudio::SuspendState -> QAudio::SuspendedState
QAudio::StopState -> QAudio::StoppedState
QAudioDeviceInfo::deviceList() ->
QAudioDeviceInfo::availableDevices()
clock() -> elapsedUSecs()
totalTime() -> processedUSecs()
QIODevice* start(QIODevice*) -> void
start(QIODevice*), QIODevice*
start()
Reviewed-by:Justin McPherson
40 files changed, 249 insertions, 270 deletions
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp index e205e03..4198605 100644 --- a/examples/multimedia/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audiodevices/audiodevices.cpp @@ -148,7 +148,7 @@ void AudioTest::modeChanged(int idx) mode=QAudio::AudioOutput; deviceBox->clear(); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode)) + foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(mode)) deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); } diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 62afd73..3d537a2 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -170,7 +170,7 @@ InputTest::InputTest() layout->addWidget(canvas); deviceBox = new QComboBox(this); - QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); for(int i = 0; i < devices.size(); ++i) { deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i))); } @@ -216,7 +216,7 @@ InputTest::~InputTest() {} void InputTest::status() { - qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, elapsedUSecs = "<<audioInput->elapsedUSecs()<<", processedUSecs = "<<audioInput->processedUSecs(); + qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, clock = "<<audioInput->clock()/1000<<"ms, totalTime = "<<audioInput->totalTime()/1000<<"ms"; } void InputTest::readMore() @@ -239,7 +239,7 @@ void InputTest::toggleMode() if (pullMode) { button->setText(tr("Click for Pull Mode")); - input = audioInput->start(); + input = audioInput->start(0); connect(input,SIGNAL(readyRead()),SLOT(readMore())); pullMode = false; } else { @@ -252,7 +252,7 @@ void InputTest::toggleMode() void InputTest::toggleSuspend() { // toggle suspend/resume - if(audioInput->state() == QAudio::SuspendedState) { + if(audioInput->state() == QAudio::SuspendState) { qWarning()<<"status: Suspended, resume()"; audioInput->resume(); button2->setText("Click To Suspend"); @@ -260,7 +260,7 @@ void InputTest::toggleSuspend() qWarning()<<"status: Active, suspend()"; audioInput->suspend(); button2->setText("Click To Resume"); - } else if (audioInput->state() == QAudio::StoppedState) { + } else if (audioInput->state() == QAudio::StopState) { qWarning()<<"status: Stopped, resume()"; audioInput->resume(); button2->setText("Click To Suspend"); diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp index 244840d..c92bbaf 100644 --- a/examples/multimedia/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audiooutput/audiooutput.cpp @@ -134,7 +134,7 @@ AudioTest::AudioTest() QVBoxLayout* layout = new QVBoxLayout; deviceBox = new QComboBox(this); - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) + 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 +200,7 @@ void AudioTest::deviceChanged(int idx) void AudioTest::status() { - qWarning()<<"byteFree = "<<audioOutput->bytesFree()<<" bytes, elapsedUSecs = "<<audioOutput->elapsedUSecs()<<", processedUSecs = "<<audioOutput->processedUSecs(); + qWarning()<<"byteFree = "<<audioOutput->bytesFree()<<" bytes, clock = "<<audioOutput->clock()/1000<<"ms, totalTime = "<<audioOutput->totalTime()/1000<<"ms"; } void AudioTest::writeMore() @@ -208,7 +208,7 @@ void AudioTest::writeMore() if(!audioOutput) return; - if(audioOutput->state() == QAudio::StoppedState) + if(audioOutput->state() == QAudio::StopState) return; int l; @@ -234,7 +234,7 @@ void AudioTest::toggle() if (pullMode) { button->setText("Click for Pull Mode"); - output = audioOutput->start(); + output = audioOutput->start(0); pullMode = false; timer->start(20); } else { @@ -247,7 +247,7 @@ void AudioTest::toggle() void AudioTest::togglePlay() { // toggle suspend/resume - if(audioOutput->state() == QAudio::SuspendedState) { + if(audioOutput->state() == QAudio::SuspendState) { qWarning()<<"status: Suspended, resume()"; audioOutput->resume(); button2->setText("Click To Suspend"); @@ -255,7 +255,7 @@ void AudioTest::togglePlay() qWarning()<<"status: Active, suspend()"; audioOutput->suspend(); button2->setText("Click To Resume"); - } else if (audioOutput->state() == QAudio::StoppedState) { + } else if (audioOutput->state() == QAudio::StopState) { qWarning()<<"status: Stopped, resume()"; audioOutput->resume(); button2->setText("Click To Suspend"); diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp index b687f34..04378d4 100644 --- a/src/multimedia/audio/qaudio.cpp +++ b/src/multimedia/audio/qaudio.cpp @@ -71,23 +71,23 @@ public: /*! \enum QAudio::Error - \value NoError No errors have occurred - \value OpenError An error opening the audio device - \value IOError An error occurred during read/write of audio device - \value UnderrunError Audio data is not being fed to the audio device at a fast enough rate - \value FatalError A non-recoverable error has occurred, the audio device is not usable at this time. + \value NoError No errors have occurred + \value OpenError An error opening the audio device + \value IOError An error occurred during read/write of audio device + \value UnderrunError Audio data is not being fed to the audio device at a fast enough rate + \value FatalError A non-recoverable error has occurred, the audio device is not usable at this time. */ /*! \enum QAudio::State - \value ActiveState Audio data is being processed, this state is set after start() is called - and while audio data is available to be processed. - \value SuspendedState The audio device is in a suspended state, this state will only be entered - after suspend() is called. - \value StoppedState The audio device is closed, not processing any audio data - \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state - is set after start() is called and while no audio data is available to be processed. + \value ActiveState Audio data is being processed, this state is set after start() is called + and while audio data is available to be processed. + \value SuspendState The audio device is in a suspended state, this state will only be entered + after suspend() is called. + \value StopState The audio device is closed, not processing any audio data + \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state + is set after start() is called and while no audio data is available to be processed. */ /*! diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h index 531e1a7..a66f0b1 100644 --- a/src/multimedia/audio/qaudio.h +++ b/src/multimedia/audio/qaudio.h @@ -56,7 +56,7 @@ QT_MODULE(Multimedia) namespace QAudio { enum Error { NoError, OpenError, IOError, UnderrunError, FatalError }; - enum State { ActiveState, SuspendedState, StoppedState, IdleState }; + enum State { ActiveState, SuspendState, StopState, IdleState }; enum Mode { AudioInput, AudioOutput }; } diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp index 89e4394..8804fb6 100644 --- a/src/multimedia/audio/qaudiodevicefactory.cpp +++ b/src/multimedia/audio/qaudiodevicefactory.cpp @@ -94,10 +94,10 @@ public: int bufferSize() const { return 0; } void setNotifyInterval(int ) {} int notifyInterval() const { return 0; } - qint64 processedUSecs() const { return 0; } - qint64 elapsedUSecs() const { return 0; } + qint64 totalTime() const { return 0; } + qint64 clock() const { return 0; } QAudio::Error error() const { return QAudio::OpenError; } - QAudio::State state() const { return QAudio::StoppedState; } + QAudio::State state() const { return QAudio::StopState; } QAudioFormat format() const { return QAudioFormat(); } }; @@ -115,18 +115,18 @@ public: int bufferSize() const { return 0; } void setNotifyInterval(int ) {} int notifyInterval() const { return 0; } - qint64 processedUSecs() const { return 0; } - qint64 elapsedUSecs() const { return 0; } + qint64 totalTime() const { return 0; } + qint64 clock() const { return 0; } QAudio::Error error() const { return QAudio::OpenError; } - QAudio::State state() const { return QAudio::StoppedState; } + QAudio::State state() const { return QAudio::StopState; } QAudioFormat format() const { return QAudioFormat(); } }; -QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) +QList<QAudioDeviceInfo> QAudioDeviceFactory::deviceList(QAudio::Mode mode) { QList<QAudioDeviceInfo> devices; #if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA)) - foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode)) + foreach (const QByteArray &handle, QAudioDeviceInfoInternal::deviceList(mode)) devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode); #endif QFactoryLoader* l = loader(); @@ -134,7 +134,7 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode) foreach (QString const& key, l->keys()) { QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(l->instance(key)); if (plugin) { - foreach (QByteArray const& handle, plugin->availableDevices(mode)) + foreach (QByteArray const& handle, plugin->deviceList(mode)) devices << QAudioDeviceInfo(key, handle, mode); } @@ -149,7 +149,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice() QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { - QList<QByteArray> list = plugin->availableDevices(QAudio::AudioInput); + QList<QByteArray> list = plugin->deviceList(QAudio::AudioInput); if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput); } @@ -164,7 +164,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice() QAudioEngineFactoryInterface* plugin = qobject_cast<QAudioEngineFactoryInterface*>(loader()->instance(QLatin1String("default"))); if (plugin) { - QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput); + QList<QByteArray> list = plugin->deviceList(QAudio::AudioOutput); if (list.size() > 0) return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput); } diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h index 2466455..008e4a8 100644 --- a/src/multimedia/audio/qaudiodevicefactory_p.h +++ b/src/multimedia/audio/qaudiodevicefactory_p.h @@ -72,7 +72,7 @@ class QAbstractAudioDeviceInfo; class QAudioDeviceFactory { public: - static QList<QAudioDeviceInfo> availableDevices(QAudio::Mode mode); + static QList<QAudioDeviceInfo> deviceList(QAudio::Mode mode); static QAudioDeviceInfo defaultInputDevice(); static QAudioDeviceInfo defaultOutputDevice(); diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index 5e3adcb..dce2884 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -121,7 +121,7 @@ public: classes that communicate with the device--such as QAudioInput, and QAudioOutput. The static functions defaultInputDevice(), defaultOutputDevice(), and - availableDevices() let you get a list of all available + 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. @@ -129,7 +129,7 @@ public: For instance: \code - foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) + foreach(const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::deviceList(QAudio::AudioOutput)) qDebug() << "Device name: " << deviceInfo.deviceName(); \endcode @@ -327,9 +327,9 @@ QAudioDeviceInfo QAudioDeviceInfo::defaultOutputDevice() Returns a list of audio devices that support \a mode. */ -QList<QAudioDeviceInfo> QAudioDeviceInfo::availableDevices(QAudio::Mode mode) +QList<QAudioDeviceInfo> QAudioDeviceInfo::deviceList(QAudio::Mode mode) { - return QAudioDeviceFactory::availableDevices(mode); + return QAudioDeviceFactory::deviceList(mode); } diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 5c7cb98..53b9904 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.h +++ b/src/multimedia/audio/qaudiodeviceinfo.h @@ -92,7 +92,7 @@ public: static QAudioDeviceInfo defaultInputDevice(); static QAudioDeviceInfo defaultOutputDevice(); - static QList<QAudioDeviceInfo> availableDevices(QAudio::Mode mode); + static QList<QAudioDeviceInfo> deviceList(QAudio::Mode mode); private: QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode); diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 5de6c70..e828238 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -382,7 +382,7 @@ void QAudioDeviceInfoInternal::updateLists() close(); } -QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) +QList<QByteArray> QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QList<QByteArray> devices; QByteArray filter; @@ -444,7 +444,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) QByteArray QAudioDeviceInfoInternal::defaultInputDevice() { - QList<QByteArray> devices = availableDevices(QAudio::AudioInput); + QList<QByteArray> devices = deviceList(QAudio::AudioInput); if(devices.size() == 0) return QByteArray(); @@ -453,7 +453,7 @@ QByteArray QAudioDeviceInfoInternal::defaultInputDevice() QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() { - QList<QByteArray> devices = availableDevices(QAudio::AudioOutput); + QList<QByteArray> devices = deviceList(QAudio::AudioOutput); if(devices.size() == 0) return QByteArray(); diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h index 5a807af..10078ca 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h @@ -92,7 +92,7 @@ public: QList<QAudioFormat::SampleType> sampleTypeList(); static QByteArray defaultInputDevice(); static QByteArray defaultOutputDevice(); - static QList<QByteArray> availableDevices(QAudio::Mode); + static QList<QByteArray> deviceList(QAudio::Mode); private: bool open(); diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp index 8905119..ec07748 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp @@ -324,7 +324,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() return get_device_info(audioDevice, QAudio::AudioOutput); } -QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) +QList<QByteArray> QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { QList<QByteArray> devices; diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h index 0fd3ef5..60532a8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h @@ -87,7 +87,7 @@ public: static QByteArray defaultInputDevice(); static QByteArray defaultOutputDevice(); - static QList<QByteArray> availableDevices(QAudio::Mode mode); + static QList<QByteArray> deviceList(QAudio::Mode mode); }; QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 33af022..69d5c94 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -103,7 +103,6 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const } else { nearest.setFrequency(11025); nearest.setChannels(1); - nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); nearest.setCodec(QLatin1String("audio/pcm")); @@ -334,7 +333,7 @@ void QAudioDeviceInfoInternal::updateLists() } } -QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) +QList<QByteArray> QAudioDeviceInfoInternal::deviceList(QAudio::Mode mode) { Q_UNUSED(mode) diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h index e191b6f..0d2ee29 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h @@ -93,7 +93,7 @@ public: QList<QAudioFormat::SampleType> sampleTypeList(); static QByteArray defaultInputDevice(); static QByteArray defaultOutputDevice(); - static QList<QByteArray> availableDevices(QAudio::Mode); + static QList<QByteArray> deviceList(QAudio::Mode); private: QAudio::Mode mode; diff --git a/src/multimedia/audio/qaudioengine.cpp b/src/multimedia/audio/qaudioengine.cpp index 88e3804..c6e9d97 100644 --- a/src/multimedia/audio/qaudioengine.cpp +++ b/src/multimedia/audio/qaudioengine.cpp @@ -189,12 +189,12 @@ QT_BEGIN_NAMESPACE */ /*! - \fn virtual qint64 QAbstractAudioOutput::processedUSecs() const + \fn virtual qint64 QAbstractAudioOutput::totalTime() const Returns the amount of audio data processed since start() was called in milliseconds. */ /*! - \fn virtual qint64 QAbstractAudioOutput::elapsedUSecs() const + \fn virtual qint64 QAbstractAudioOutput::clock() const Returns the milliseconds since start() was called, including time in Idle and suspend states. */ @@ -304,12 +304,12 @@ QT_BEGIN_NAMESPACE */ /*! - \fn virtual qint64 QAbstractAudioInput::processedUSecs() const + \fn virtual qint64 QAbstractAudioInput::totalTime() const Returns the amount of audio data processed since start() was called in milliseconds. */ /*! - \fn virtual qint64 QAbstractAudioInput::elapsedUSecs() const + \fn virtual qint64 QAbstractAudioInput::clock() const Returns the milliseconds since start() was called, including time in Idle and suspend states. */ diff --git a/src/multimedia/audio/qaudioengine.h b/src/multimedia/audio/qaudioengine.h index f9e80c1..57a9ae6 100644 --- a/src/multimedia/audio/qaudioengine.h +++ b/src/multimedia/audio/qaudioengine.h @@ -86,8 +86,8 @@ public: virtual int bufferSize() const = 0; virtual void setNotifyInterval(int milliSeconds) = 0; virtual int notifyInterval() const = 0; - virtual qint64 processedUSecs() const = 0; - virtual qint64 elapsedUSecs() const = 0; + virtual qint64 totalTime() const = 0; + virtual qint64 clock() const = 0; virtual QAudio::Error error() const = 0; virtual QAudio::State state() const = 0; virtual QAudioFormat format() const = 0; @@ -113,8 +113,8 @@ public: virtual int bufferSize() const = 0; virtual void setNotifyInterval(int milliSeconds) = 0; virtual int notifyInterval() const = 0; - virtual qint64 processedUSecs() const = 0; - virtual qint64 elapsedUSecs() const = 0; + virtual qint64 totalTime() const = 0; + virtual qint64 clock() const = 0; virtual QAudio::Error error() const = 0; virtual QAudio::State state() const = 0; virtual QAudioFormat format() const = 0; diff --git a/src/multimedia/audio/qaudioengineplugin.h b/src/multimedia/audio/qaudioengineplugin.h index 82dfa15..fe30e0d 100644 --- a/src/multimedia/audio/qaudioengineplugin.h +++ b/src/multimedia/audio/qaudioengineplugin.h @@ -60,7 +60,7 @@ QT_MODULE(Multimedia) struct Q_MULTIMEDIA_EXPORT QAudioEngineFactoryInterface : public QFactoryInterface { - virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0; + virtual QList<QByteArray> deviceList(QAudio::Mode) const = 0; virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0; @@ -80,7 +80,7 @@ public: ~QAudioEnginePlugin(); virtual QStringList keys() const = 0; - virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0; + virtual QList<QByteArray> deviceList(QAudio::Mode) const = 0; virtual QAbstractAudioInput* createInput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; virtual QAbstractAudioOutput* createOutput(const QByteArray& device, const QAudioFormat& format = QAudioFormat()) = 0; virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0; diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index b2bbe14..86fe85b 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QDebug> + #include <QtMultimedia/qaudioformat.h> @@ -214,13 +214,16 @@ bool QAudioFormat::operator!=(const QAudioFormat& other) const } /*! - Returns true if all of the parameters are valid. + Returns true if any of the parameters are invalid. */ -bool QAudioFormat::isValid() const +bool QAudioFormat::isNull() const { - return d->frequency != -1 && d->channels != -1 && d->sampleSize != -1 && - d->sampleType != QAudioFormat::Unknown && !d->codec.isEmpty(); + return d->frequency == -1 && d->channels == -1 && + d->sampleSize == -1 && + d->byteOrder == QAudioFormat::Endian(QSysInfo::ByteOrder) && + d->sampleType == QAudioFormat::Unknown && + d->codec.isNull(); } /*! diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index 7e92c2f..d5841ce 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -71,7 +71,7 @@ public: bool operator==(const QAudioFormat &other) const; bool operator!=(const QAudioFormat &other) const; - bool isValid() const; + bool isNull() const; void setFrequency(int frequency); int frequency() const; diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index e794eaf..7a3be23 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -121,15 +121,15 @@ QT_BEGIN_NAMESPACE when the state changes (stateChanged()). QAudioInput provides several ways of measuring the time that has - passed since the start() of the recording. The \c processedUSecs() + passed since the start() of the recording. The \c totalTime() function returns the length of the stream in microseconds written, i.e., it leaves out the times the audio input was suspended or idle. - The elapsedUSecs() function returns the time elapsed since start() was called regardless of + The clock() function returns the time elapsed since start() was called regardless of which states the QAudioInput has been in. If an error should occur, you can fetch its reason with error(). The possible error reasons are described by the QAudio::Error - enum. The QAudioInput will enter the \l{QAudio::}{StoppedState} when + enum. The QAudioInput will enter the \l{QAudio::}{StopState} when an error is encountered. Connect to the stateChanged() signal to handle the error: @@ -176,44 +176,37 @@ QAudioInput::~QAudioInput() } /*! - Uses the \a device as the QIODevice to transfer data. - Passing a QIODevice allows the data to be transfered without any extra code. - All that is required is to open the QIODevice. - - \sa QIODevice -*/ - -void QAudioInput::start(QIODevice* device) -{ - /* - -If currently not StoppedState, stop - -If previous start was push mode, delete internal QIODevice. - -open audio input. - If ok, NoError and ActiveState, else OpenError and StoppedState. - -emit stateChanged() - */ - d->start(device); -} - -/*! + Uses the \a device as the QIODevice to transfer data. + If \a device is null then the class creates an internal QIODevice. Returns a pointer to the QIODevice being used to handle the data transfer. This QIODevice can be used to read() audio data directly. + Passing a QIODevice allows the data to be transfered without any extra code. + All that is required is to open the QIODevice. \sa QIODevice */ -QIODevice* QAudioInput::start() +QIODevice* QAudioInput::start(QIODevice* device) { /* - -If currently not StoppedState, stop + PULL MODE (valid QIODevice) + -If currently not StopState, stop + -If previous start was push mode, delete internal QIODevice. + -open audio input. + If ok, NoError and ActiveState, else OpenError and StopState. + -emit stateChanged() + -return device + + PUSH MODE (device = 0) + -If currently not StopState, stop -If no internal QIODevice, create one. -open audio input. - -If ok, NoError and IdleState, else OpenError and StoppedState + -If ok, NoError and IdleState, else OpenError and StopState -emit stateChanged() -return internal QIODevice */ - return d->start(0); + return d->start(device); } /*! @@ -232,8 +225,8 @@ QAudioFormat QAudioInput::format() const void QAudioInput::stop() { /* - -If StoppedState, return - -set to StoppedState + -If StopState, return + -set to StopState -detach from audio device -emit stateChanged() */ @@ -262,7 +255,7 @@ void QAudioInput::suspend() /* -If not ActiveState|IdleState, return -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState + -set NoError and SuspendState -emit stateChanged() */ d->suspend(); @@ -275,7 +268,7 @@ void QAudioInput::suspend() void QAudioInput::resume() { /* - -If SuspendedState, return + -If SuspendState, return -resume audio -(PULL MODE): set ActiveState, NoError -(PUSH MODE): set IdleState, NoError @@ -364,9 +357,9 @@ int QAudioInput::notifyInterval() const was called in microseconds. */ -qint64 QAudioInput::processedUSecs() const +qint64 QAudioInput::totalTime() const { - return d->processedUSecs(); + return d->totalTime(); } /*! @@ -374,9 +367,9 @@ qint64 QAudioInput::processedUSecs() const Suspend states. */ -qint64 QAudioInput::elapsedUSecs() const +qint64 QAudioInput::clock() const { - return d->elapsedUSecs(); + return d->clock(); } /*! diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h index bf93a27..c8094f5 100644 --- a/src/multimedia/audio/qaudioinput.h +++ b/src/multimedia/audio/qaudioinput.h @@ -71,9 +71,7 @@ public: QAudioFormat format() const; - void start(QIODevice *device); - QIODevice* start(); - + QIODevice* start(QIODevice *device = 0); void stop(); void reset(); void suspend(); @@ -88,8 +86,8 @@ public: void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 8a8f0db..9eb8cfb 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -75,7 +75,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor intervalTime = 1000; audioBuffer = 0; errorState = QAudio::NoError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; audioSource = 0; pullMode = true; resuming = false; @@ -206,7 +206,7 @@ int QAudioInputPrivate::setFormat() QIODevice* QAudioInputPrivate::start(QIODevice* device) { - if(deviceState != QAudio::StoppedState) + if(deviceState != QAudio::StopState) close(); if(!pullMode && audioSource) { @@ -234,10 +234,10 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) void QAudioInputPrivate::stop() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; close(); emit stateChanged(deviceState); @@ -283,7 +283,7 @@ bool QAudioInputPrivate::open() } if (( err < 0)||(handle == 0)) { errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); return false; } @@ -367,7 +367,7 @@ bool QAudioInputPrivate::open() if( err < 0) { qWarning()<<errMessage; errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); return false; } @@ -413,7 +413,7 @@ bool QAudioInputPrivate::open() void QAudioInputPrivate::close() { - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; timer->stop(); if ( handle ) { @@ -490,7 +490,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if(l < 0) { close(); errorState = QAudio::IOError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); } else if(l == 0) { errorState = QAudio::NoError; @@ -508,7 +508,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) void QAudioInputPrivate::resume() { - if(deviceState == QAudio::SuspendedState) { + if(deviceState == QAudio::SuspendState) { int err = 0; if(handle) { @@ -558,7 +558,7 @@ int QAudioInputPrivate::notifyInterval() const return intervalTime; } -qint64 QAudioInputPrivate::processedUSecs() const +qint64 QAudioInputPrivate::totalTime() const { return totalTimeValue; } @@ -567,14 +567,14 @@ void QAudioInputPrivate::suspend() { if(deviceState == QAudio::ActiveState||resuming) { timer->stop(); - deviceState = QAudio::SuspendedState; + deviceState = QAudio::SuspendState; emit stateChanged(deviceState); } } void QAudioInputPrivate::userFeed() { - if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState) + if(deviceState == QAudio::StopState || deviceState == QAudio::SuspendState) return; #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -606,12 +606,12 @@ bool QAudioInputPrivate::deviceReady() return true; } -qint64 QAudioInputPrivate::elapsedUSecs() const +qint64 QAudioInputPrivate::clock() const { if(!handle) return 0; - if (deviceState == QAudio::StoppedState) + if (deviceState == QAudio::StopState) return 0; #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h index 67d5cf5..2ed7453 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.h +++ b/src/multimedia/audio/qaudioinput_alsa_p.h @@ -91,8 +91,8 @@ public: int bufferSize() const; void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; QAudioFormat format() const; diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index d63045f..cb05920 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -526,7 +526,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray& device, QAudioFormat co internalBufferSize = default_buffer_size; clockFrequency = AudioGetHostClockFrequency() / 1000; errorCode = QAudio::NoError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; intervalTimer = new QTimer(this); intervalTimer->setInterval(1000); @@ -708,7 +708,7 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) QIODevice* op = device; if (!open()) { - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; errorCode = QAudio::OpenError; return audioIO; } @@ -736,12 +736,12 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) void QAudioInputPrivate::stop() { QMutexLocker lock(&mutex); - if (stateCode != QAudio::StoppedState) { + if (stateCode != QAudio::StopState) { audioThreadStop(); audioBuffer->flush(true); errorCode = QAudio::NoError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } } @@ -749,11 +749,11 @@ void QAudioInputPrivate::stop() void QAudioInputPrivate::reset() { QMutexLocker lock(&mutex); - if (stateCode != QAudio::StoppedState) { + if (stateCode != QAudio::StopState) { audioThreadStop(); errorCode = QAudio::NoError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } } @@ -765,7 +765,7 @@ void QAudioInputPrivate::suspend() audioThreadStop(); errorCode = QAudio::NoError; - stateCode = QAudio::SuspendedState; + stateCode = QAudio::SuspendState; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } } @@ -773,7 +773,7 @@ void QAudioInputPrivate::suspend() void QAudioInputPrivate::resume() { QMutexLocker lock(&mutex); - if (stateCode == QAudio::SuspendedState) { + if (stateCode == QAudio::SuspendState) { audioThreadStart(); errorCode = QAudio::NoError; @@ -812,14 +812,14 @@ int QAudioInputPrivate::notifyInterval() const return intervalTimer->interval(); } -qint64 QAudioInputPrivate::processedUSecs() const +qint64 QAudioInputPrivate::totalTime() const { return totalFrames * 1000000 / audioFormat.frequency(); } -qint64 QAudioInputPrivate::elapsedUSecs() const +qint64 QAudioInputPrivate::clock() const { - if (stateCode == QAudio::StoppedState) + if (stateCode == QAudio::StopState) return 0; return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000); @@ -875,7 +875,7 @@ void QAudioInputPrivate::audioDeviceError() audioDeviceStop(); errorCode = QAudio::IOError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection); } } diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h index 2dbb808..a080648 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.h +++ b/src/multimedia/audio/qaudioinput_mac_p.h @@ -129,8 +129,8 @@ public: void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index b7f9ffd..a059e76 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -71,7 +71,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor totalTimeValue = 0; intervalTime = 1000; errorState = QAudio::NoError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; audioSource = 0; pullMode = true; resuming = false; @@ -173,7 +173,7 @@ QAudioFormat QAudioInputPrivate::format() const QIODevice* QAudioInputPrivate::start(QIODevice* device) { - if(deviceState != QAudio::StoppedState) + if(deviceState != QAudio::StopState) close(); if(!pullMode && audioSource) { @@ -201,7 +201,7 @@ QIODevice* QAudioInputPrivate::start(QIODevice* device) void QAudioInputPrivate::stop() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; close(); @@ -260,7 +260,7 @@ bool QAudioInputPrivate::open() (DWORD_PTR) this, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); qWarning("QAudioInput: failed to open audio device"); return false; @@ -269,7 +269,7 @@ bool QAudioInputPrivate::open() if(waveBlocks == 0) { errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); qWarning("QAudioInput: failed to allocate blocks. open failed"); return false; @@ -286,7 +286,7 @@ bool QAudioInputPrivate::open() if(result != MMSYSERR_NOERROR) { qWarning("QAudioInput: failed to setup block %d,err=%d",i,result); errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); return false; } @@ -295,7 +295,7 @@ bool QAudioInputPrivate::open() if(result) { qWarning("QAudioInput: failed to start audio input"); errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); return false; } @@ -309,12 +309,12 @@ bool QAudioInputPrivate::open() void QAudioInputPrivate::close() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; waveInReset(hWaveIn); waveInClose(hWaveIn); - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; int count = 0; while(!finished && count < 100) { @@ -333,9 +333,6 @@ void QAudioInputPrivate::close() int QAudioInputPrivate::bytesReady() const { - if(period_size == 0 || buffer_size == 0) - return 0; - int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size; if(buf < 0) buf = 0; @@ -403,14 +400,14 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) if(result != MMSYSERR_NOERROR) { qWarning("QAudioInput: failed to prepare block %d,err=%d",header,result); errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); } result = waveInAddBuffer(hWaveIn, &waveBlocks[header], sizeof(WAVEHDR)); if(result != MMSYSERR_NOERROR) { qWarning("QAudioInput: failed to setup block %d,err=%d",header,result); errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); } header++; @@ -438,14 +435,14 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len) void QAudioInputPrivate::resume() { - if(deviceState == QAudio::SuspendedState) { + if(deviceState == QAudio::SuspendState) { deviceState = QAudio::ActiveState; for(int i=0; i<buffer_size/period_size; i++) { result = waveInAddBuffer(hWaveIn, &waveBlocks[i], sizeof(WAVEHDR)); if(result != MMSYSERR_NOERROR) { qWarning("QAudioInput: failed to setup block %d,err=%d",i,result); errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); return; } @@ -491,7 +488,7 @@ int QAudioInputPrivate::notifyInterval() const return intervalTime; } -qint64 QAudioInputPrivate::processedUSecs() const +qint64 QAudioInputPrivate::totalTime() const { return totalTimeValue; } @@ -500,7 +497,7 @@ void QAudioInputPrivate::suspend() { if(deviceState == QAudio::ActiveState) { waveInReset(hWaveIn); - deviceState = QAudio::SuspendedState; + deviceState = QAudio::SuspendState; emit stateChanged(deviceState); } } @@ -513,7 +510,7 @@ void QAudioInputPrivate::feedback() #endif bytesAvailable = bytesReady(); - if(!(deviceState==QAudio::StoppedState||deviceState==QAudio::SuspendedState)) + if(!(deviceState==QAudio::StopState||deviceState==QAudio::SuspendState)) emit processMore(); } @@ -542,9 +539,9 @@ bool QAudioInputPrivate::deviceReady() return true; } -qint64 QAudioInputPrivate::elapsedUSecs() const +qint64 QAudioInputPrivate::clock() const { - if (deviceState == QAudio::StoppedState) + if (deviceState == QAudio::StopState) return 0; return timeStampOpened.elapsed()*1000; diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index a2bd687..26c470d 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -91,8 +91,8 @@ public: int bufferSize() const; void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp index f8f2fa1..81b9496 100644 --- a/src/multimedia/audio/qaudiooutput.cpp +++ b/src/multimedia/audio/qaudiooutput.cpp @@ -125,12 +125,12 @@ QT_BEGIN_NAMESPACE not emitted. A typical use-case would be to update a \l{QSlider}{slider} that allows seeking in the stream. If you want the time since playback started regardless of which - states the audio output has been in, elapsedUSecs() is the function for you. + states the audio output has been in, clock() is the function for you. If an error occurs, you can fetch the \l{QAudio::Error}{error type} with the error() function. Please see the QAudio::Error enum for a description of the possible errors that are reported. When - an error is encountered, the state changes to QAudio::StoppedState. + an error is encountered, the state changes to QAudio::StopState. You can check for errors by connecting to the stateChanged() signal: @@ -188,42 +188,36 @@ QAudioFormat QAudioOutput::format() const /*! Uses the \a device as the QIODevice to transfer data. + If \a device is null then the class creates an internal QIODevice. + Returns a pointer to the QIODevice being used to handle the data + transfer. This QIODevice can be used to write() audio data + directly. Passing a QIODevice allows the data to be transfered without any extra code. All that is required is to open the QIODevice. \sa QIODevice */ -void QAudioOutput::start(QIODevice* device) +QIODevice* QAudioOutput::start(QIODevice* device) { /* - -If currently not StoppedState, stop. + PULL MODE (valid QIODevice) + -If currently not StopState, stop. -If previous start was push mode, delete internal QIODevice. -open audio output. - -If ok, NoError and ActiveState, else OpenError and StoppedState + -If ok, NoError and ActiveState, else OpenError and StopState -emit stateChanged() - */ - d->start(device); -} - -/*! - Returns a pointer to the QIODevice being used to handle the data - transfer. This QIODevice can be used to write() audio data directly. + -return device - \sa QIODevice -*/ - -QIODevice* QAudioOutput::start() -{ - /* - -If currently not StoppedState, stop. + PUSH MODE (device = 0) + -If currently not StopState, stop. -If no internal QIODevice, create one. -open audio output. - -If ok, NoError and IdleState, else OpenError and StoppedState + -If ok, NoError and IdleState, else OpenError and StopState -emit stateChanged() -return internal QIODevice */ - return d->start(0); + return d->start(device); } /*! @@ -233,8 +227,8 @@ QIODevice* QAudioOutput::start() void QAudioOutput::stop() { /* - -If StoppedState, return - -set to StoppedState + -If StopState, return + -set to StopState -detach from audio device -emit stateChanged() */ @@ -263,7 +257,7 @@ void QAudioOutput::suspend() /* -If not ActiveState|IdleState, return -stop processing audio, saving all buffered audio data - -set NoError and SuspendedState + -set NoError and SuspendState -emit stateChanged() */ d->suspend(); @@ -276,7 +270,7 @@ void QAudioOutput::suspend() void QAudioOutput::resume() { /* - -If SuspendedState, return + -If SuspendState, return -resume audio -(PULL MODE): set ActiveState, NoError -(PUSH MODE): set IdleState, NoError @@ -364,9 +358,9 @@ int QAudioOutput::notifyInterval() const was called in microseconds. */ -qint64 QAudioOutput::processedUSecs() const +qint64 QAudioOutput::totalTime() const { - return d->processedUSecs(); + return d->totalTime(); } /*! @@ -374,9 +368,9 @@ qint64 QAudioOutput::processedUSecs() const Suspend states. */ -qint64 QAudioOutput::elapsedUSecs() const +qint64 QAudioOutput::clock() const { - return d->elapsedUSecs(); + return d->clock(); } /*! diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h index 38bab8e..bb3496e 100644 --- a/src/multimedia/audio/qaudiooutput.h +++ b/src/multimedia/audio/qaudiooutput.h @@ -71,9 +71,7 @@ public: QAudioFormat format() const; - void start(QIODevice *device); - QIODevice* start(); - + QIODevice* start(QIODevice *device = 0); void stop(); void reset(); void suspend(); @@ -88,8 +86,8 @@ public: void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index e9784d2..689da89 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -77,7 +77,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioF intervalTime = 1000; audioBuffer = 0; errorState = QAudio::NoError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; audioSource = 0; pullMode = true; resuming = false; @@ -215,8 +215,8 @@ int QAudioOutputPrivate::setFormat() QIODevice* QAudioOutputPrivate::start(QIODevice* device) { - if(deviceState != QAudio::StoppedState) - deviceState = QAudio::StoppedState; + if(deviceState != QAudio::StopState) + deviceState = QAudio::StopState; errorState = QAudio::NoError; @@ -256,9 +256,9 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) void QAudioOutputPrivate::stop() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; close(); emit stateChanged(deviceState); } @@ -304,7 +304,7 @@ bool QAudioOutputPrivate::open() } if (( err < 0)||(handle == 0)) { errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; return false; } snd_pcm_nonblock( handle, 0 ); @@ -387,7 +387,7 @@ bool QAudioOutputPrivate::open() if( err < 0) { qWarning()<<errMessage; errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; return false; } snd_pcm_hw_params_get_buffer_size(hwparams,&buffer_frames); @@ -431,7 +431,7 @@ bool QAudioOutputPrivate::open() void QAudioOutputPrivate::close() { - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; timer->stop(); if ( handle ) { @@ -494,7 +494,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) if(err < 0) { close(); errorState = QAudio::FatalError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); } return 0; @@ -507,7 +507,7 @@ int QAudioOutputPrivate::periodSize() const void QAudioOutputPrivate::setBufferSize(int value) { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) buffer_size = value; } @@ -529,14 +529,14 @@ int QAudioOutputPrivate::notifyInterval() const return intervalTime; } -qint64 QAudioOutputPrivate::processedUSecs() const +qint64 QAudioOutputPrivate::totalTime() const { return totalTimeValue; } void QAudioOutputPrivate::resume() { - if(deviceState == QAudio::SuspendedState) { + if(deviceState == QAudio::SuspendState) { int err = 0; if(handle) { @@ -571,7 +571,7 @@ void QAudioOutputPrivate::suspend() { if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) { timer->stop(); - deviceState = QAudio::SuspendedState; + deviceState = QAudio::SuspendState; errorState = QAudio::NoError; emit stateChanged(deviceState); } @@ -579,7 +579,7 @@ void QAudioOutputPrivate::suspend() void QAudioOutputPrivate::userFeed() { - if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState) + if(deviceState == QAudio::StopState || deviceState == QAudio::SuspendState) return; #ifdef DEBUG_AUDIO QTime now(QTime::currentTime()); @@ -658,12 +658,12 @@ bool QAudioOutputPrivate::deviceReady() return true; } -qint64 QAudioOutputPrivate::elapsedUSecs() const +qint64 QAudioOutputPrivate::clock() const { if(!handle) return 0; - if (deviceState == QAudio::StoppedState) + if (deviceState == QAudio::StopState) return 0; #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h index 619ecef..298e89e 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.h +++ b/src/multimedia/audio/qaudiooutput_alsa_p.h @@ -91,8 +91,8 @@ public: int bufferSize() const; void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; QAudioFormat format() const; diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp index e0651bf..f23db80 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.cpp +++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp @@ -288,7 +288,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device, const QAudioF internalBufferSize = default_buffer_size; clockFrequency = AudioGetHostClockFrequency() / 1000; errorCode = QAudio::NoError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; audioThreadState = Stopped; intervalTimer = new QTimer(this); @@ -436,7 +436,7 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) QIODevice* op = device; if (!open()) { - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; errorCode = QAudio::OpenError; return audioIO; } @@ -468,10 +468,10 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) void QAudioOutputPrivate::stop() { QMutexLocker lock(&mutex); - if (stateCode != QAudio::StoppedState) { + if (stateCode != QAudio::StopState) { audioThreadDrain(); - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; errorCode = QAudio::NoError; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } @@ -480,10 +480,10 @@ void QAudioOutputPrivate::stop() void QAudioOutputPrivate::reset() { QMutexLocker lock(&mutex); - if (stateCode != QAudio::StoppedState) { + if (stateCode != QAudio::StopState) { audioThreadStop(); - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; errorCode = QAudio::NoError; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } @@ -495,7 +495,7 @@ void QAudioOutputPrivate::suspend() if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) { audioThreadStop(); - stateCode = QAudio::SuspendedState; + stateCode = QAudio::SuspendState; errorCode = QAudio::NoError; QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode)); } @@ -504,7 +504,7 @@ void QAudioOutputPrivate::suspend() void QAudioOutputPrivate::resume() { QMutexLocker lock(&mutex); - if (stateCode == QAudio::SuspendedState) { + if (stateCode == QAudio::SuspendState) { audioThreadStart(); stateCode = QAudio::ActiveState; @@ -525,7 +525,7 @@ int QAudioOutputPrivate::periodSize() const void QAudioOutputPrivate::setBufferSize(int bs) { - if (stateCode == QAudio::StoppedState) + if (stateCode == QAudio::StopState) internalBufferSize = bs; } @@ -544,14 +544,14 @@ int QAudioOutputPrivate::notifyInterval() const return intervalTimer->interval(); } -qint64 QAudioOutputPrivate::processedUSecs() const +qint64 QAudioOutputPrivate::totalTime() const { return totalFrames * 1000000 / audioFormat.frequency(); } -qint64 QAudioOutputPrivate::elapsedUSecs() const +qint64 QAudioOutputPrivate::clock() const { - if (stateCode == QAudio::StoppedState) + if (stateCode == QAudio::StopState) return 0; return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000); @@ -614,7 +614,7 @@ void QAudioOutputPrivate::audioDeviceError() audioDeviceStop(); errorCode = QAudio::IOError; - stateCode = QAudio::StoppedState; + stateCode = QAudio::StopState; QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection); } } diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h index 76d06a9..04b3239 100644 --- a/src/multimedia/audio/qaudiooutput_mac_p.h +++ b/src/multimedia/audio/qaudiooutput_mac_p.h @@ -128,8 +128,8 @@ public: void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index 2cfc472..1810ed2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -71,7 +71,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioF intervalTime = 1000; audioBuffer = 0; errorState = QAudio::NoError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; audioSource = 0; pullMode = true; finished = false; @@ -157,7 +157,7 @@ QAudioFormat QAudioOutputPrivate::format() const QIODevice* QAudioOutputPrivate::start(QIODevice* device) { - if(deviceState != QAudio::StoppedState) + if(deviceState != QAudio::StopState) close(); if(!pullMode && audioSource) { @@ -187,7 +187,7 @@ QIODevice* QAudioOutputPrivate::start(QIODevice* device) void QAudioOutputPrivate::stop() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; close(); if(!pullMode && audioSource) { @@ -255,7 +255,7 @@ bool QAudioOutputPrivate::open() (DWORD_PTR) this, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) { errorState = QAudio::OpenError; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; emit stateChanged(deviceState); qWarning("QAudioOutput: open error"); return false; @@ -277,10 +277,10 @@ bool QAudioOutputPrivate::open() void QAudioOutputPrivate::close() { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StoppedState; + deviceState = QAudio::StopState; int delay = (buffer_size-bytesFree())*1000/(settings.frequency() *settings.channels()*(settings.sampleSize()/8)); waveOutReset(hWaveOut); @@ -308,7 +308,7 @@ int QAudioOutputPrivate::periodSize() const void QAudioOutputPrivate::setBufferSize(int value) { - if(deviceState == QAudio::StoppedState) + if(deviceState == QAudio::StopState) buffer_size = value; } @@ -330,7 +330,7 @@ int QAudioOutputPrivate::notifyInterval() const return intervalTime; } -qint64 QAudioOutputPrivate::processedUSecs() const +qint64 QAudioOutputPrivate::totalTime() const { return totalTimeValue; } @@ -390,7 +390,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len ) void QAudioOutputPrivate::resume() { - if(deviceState == QAudio::SuspendedState) { + if(deviceState == QAudio::SuspendState) { deviceState = QAudio::ActiveState; errorState = QAudio::NoError; waveOutRestart(hWaveOut); @@ -403,7 +403,7 @@ void QAudioOutputPrivate::suspend() { if(deviceState == QAudio::ActiveState) { waveOutPause(hWaveOut); - deviceState = QAudio::SuspendedState; + deviceState = QAudio::SuspendState; errorState = QAudio::NoError; emit stateChanged(deviceState); } @@ -417,7 +417,7 @@ void QAudioOutputPrivate::feedback() #endif bytesAvailable = bytesFree(); - if(!(deviceState==QAudio::StoppedState||deviceState==QAudio::SuspendedState)) { + if(!(deviceState==QAudio::StopState||deviceState==QAudio::SuspendState)) { if(bytesAvailable >= period_size) QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection); } @@ -491,9 +491,9 @@ bool QAudioOutputPrivate::deviceReady() return true; } -qint64 QAudioOutputPrivate::elapsedUSecs() const +qint64 QAudioOutputPrivate::clock() const { - if (deviceState == QAudio::StoppedState) + if (deviceState == QAudio::StopState) return 0; return timeStampOpened.elapsed()*1000; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index f90b8c2..bcf8e1e 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -90,8 +90,8 @@ public: int bufferSize() const; void setNotifyInterval(int milliSeconds); int notifyInterval() const; - qint64 processedUSecs() const; - qint64 elapsedUSecs() const; + qint64 totalTime() const; + qint64 clock() const; QAudio::Error error() const; QAudio::State state() const; diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index 715f219..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<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); + QList<QAudioDeviceInfo> 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<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { @@ -111,7 +111,7 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultOutput() void tst_QAudioDeviceInfo::outputList() { if(available) { - QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); QVERIFY(devices.size() > 0); device = new QAudioDeviceInfo(devices.at(0)); } diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp index 0778a8e..286e63f 100644 --- a/tests/auto/qaudioformat/tst_qaudioformat.cpp +++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp @@ -69,20 +69,17 @@ private slots: void tst_QAudioFormat::checkNull() { - // Default constructed QAudioFormat is invalid. + // Default constructed QAudioFormat is null. QAudioFormat audioFormat0; - QVERIFY(!audioFormat0.isValid()); + QVERIFY(audioFormat0.isNull()); - // validity is transferred + // Null is transferred QAudioFormat audioFormat1(audioFormat0); - QVERIFY(!audioFormat1.isValid()); + QVERIFY(audioFormat1.isNull()); + // Null is voided on activity audioFormat0.setFrequency(44100); - audioFormat0.setChannels(2); - audioFormat0.setSampleSize(16); - audioFormat0.setCodec("audio/pcm"); - audioFormat0.setSampleType(QAudioFormat::SignedInt); - QVERIFY(audioFormat0.isValid()); + QVERIFY(!audioFormat0.isNull()); } void tst_QAudioFormat::checkFrequency() diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 744ce38..3efc346 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -76,7 +76,7 @@ void tst_QAudioInput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio input device exists! - QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput); if(devices.size() > 0) available = true; else { @@ -137,16 +137,16 @@ void tst_QAudioInput::pullFile() QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State))); // Always have default states, before start - QVERIFY(audio->state() == QAudio::StoppedState); + QVERIFY(audio->state() == QAudio::StopState); QVERIFY(audio->error() == QAudio::NoError); - QVERIFY(audio->elapsedUSecs() == 0); + QVERIFY(audio->clock() == 0); audio->start(&filename); QTest::qWait(20); // Check state and periodSize() are valid non-zero values. QVERIFY(audio->state() == QAudio::ActiveState); QVERIFY(audio->error() == QAudio::NoError); - QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000); + QVERIFY(audio->clock() > 10000 && audio->clock() < 800000); QVERIFY(audio->periodSize() > 0); QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState @@ -154,12 +154,12 @@ void tst_QAudioInput::pullFile() QTest::qWait(5000); QVERIFY(readSignal.count() > 0); - QVERIFY(audio->processedUSecs() > 0); + QVERIFY(audio->totalTime() > 0); audio->stop(); QTest::qWait(20); - QVERIFY(audio->state() == QAudio::StoppedState); - QVERIFY(audio->elapsedUSecs() == 0); + QVERIFY(audio->state() == QAudio::StopState); + QVERIFY(audio->clock() == 0); // Can only check to make sure we got at least 1 more signal, but can be more. QVERIFY(stateSignal.count() > 1); diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 26694cc..b001af1 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -79,7 +79,7 @@ void tst_QAudioOutput::initTestCase() format.setSampleType(QAudioFormat::UnSignedInt); // Only perform tests if audio output device exists! - QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); + QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput); if(devices.size() > 0) available = true; else { @@ -140,9 +140,9 @@ void tst_QAudioOutput::pullFile() audio->setNotifyInterval(100); // Always have default states, before start - QVERIFY(audio->state() == QAudio::StoppedState); + QVERIFY(audio->state() == QAudio::StopState); QVERIFY(audio->error() == QAudio::NoError); - QVERIFY(audio->elapsedUSecs() == 0); + QVERIFY(audio->clock() == 0); audio->start(&file); QTest::qWait(20); // wait 20ms @@ -150,12 +150,12 @@ void tst_QAudioOutput::pullFile() QVERIFY(audio->state() == QAudio::ActiveState); QVERIFY(audio->error() == QAudio::NoError); QVERIFY(audio->periodSize() > 0); - QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000); + QVERIFY(audio->clock() > 10000 && audio->clock() < 800000); QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState // Wait until finished... QTestEventLoop::instance().enterLoop(1); - QCOMPARE(audio->processedUSecs(), qint64(692250)); + QCOMPARE(audio->totalTime(), qint64(692250)); #ifdef Q_OS_WINCE // 4.wav is a little less than 700ms, so notify should fire 4 times on Wince! @@ -166,8 +166,8 @@ void tst_QAudioOutput::pullFile() #endif audio->stop(); QTest::qWait(20); // wait 20ms - QVERIFY(audio->state() == QAudio::StoppedState); - QVERIFY(audio->elapsedUSecs() == 0); + QVERIFY(audio->state() == QAudio::StopState); + QVERIFY(audio->clock() == 0); // Can only check to make sure we got at least 1 more signal, but can be more. QVERIFY(stateSignal.count() > 1); @@ -184,7 +184,7 @@ void tst_QAudioOutput::pushFile() const qint64 fileSize = file.size(); - QIODevice* feed = audio->start(); + QIODevice* feed = audio->start(0); char* buffer = new char[fileSize]; file.read(buffer, fileSize); @@ -199,7 +199,7 @@ void tst_QAudioOutput::pushFile() QTestEventLoop::instance().enterLoop(1); QVERIFY(written == fileSize); - QVERIFY(audio->processedUSecs() == 692250); + QVERIFY(audio->totalTime() == 692250); audio->stop(); file.close(); |