summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-01-08 02:29:05 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-01-08 02:29:05 (GMT)
commit118e7a807d0764dee97612589fe5d7072d271e1e (patch)
treee2d7e366acb46082c119c165e11a235c6eced9b5 /src/multimedia
parent2dde31f712b5952838d867966d99565e1c7c825d (diff)
parent3f3e86d6fce5bb781bc41def35d0f15c58ef769c (diff)
downloadQt-118e7a807d0764dee97612589fe5d7072d271e1e.zip
Qt-118e7a807d0764dee97612589fe5d7072d271e1e.tar.gz
Qt-118e7a807d0764dee97612589fe5d7072d271e1e.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-multimedia-team into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-multimedia-team: QAudioInput loses data on Maemo5/other linux platforms. Fix warning in qfilesystemmodel_p.h Frequency to SampleRate and channels to channelCount. Added setChannelCount() to QAudioFormat.
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qaudio_mac.cpp12
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp26
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.h2
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp26
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp8
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp14
-rw-r--r--src/multimedia/audio/qaudioformat.cpp46
-rw-r--r--src/multimedia/audio/qaudioformat.h6
-rw-r--r--src/multimedia/audio/qaudioinput.cpp4
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp10
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.cpp2
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp14
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp4
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.cpp6
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.cpp6
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp14
16 files changed, 131 insertions, 69 deletions
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
index 1cd9225..d876745 100644
--- a/src/multimedia/audio/qaudio_mac.cpp
+++ b/src/multimedia/audio/qaudio_mac.cpp
@@ -48,8 +48,8 @@ QT_BEGIN_NAMESPACE
QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat)
{
dbg.nospace() << "QAudioFormat(" <<
- audioFormat.frequency() << "," <<
- audioFormat.channels() << "," <<
+ audioFormat.sampleRate() << "," <<
+ audioFormat.channelCount() << "," <<
audioFormat.sampleSize()<< "," <<
audioFormat.codec() << "," <<
audioFormat.byteOrder() << "," <<
@@ -64,8 +64,8 @@ QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
{
QAudioFormat audioFormat;
- audioFormat.setFrequency(sf.mSampleRate);
- audioFormat.setChannels(sf.mChannelsPerFrame);
+ audioFormat.setSampleRate(sf.mSampleRate);
+ audioFormat.setChannelCount(sf.mChannelsPerFrame);
audioFormat.setSampleSize(sf.mBitsPerChannel);
audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
@@ -84,9 +84,9 @@ AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& au
AudioStreamBasicDescription sf;
sf.mFormatFlags = kAudioFormatFlagIsPacked;
- sf.mSampleRate = audioFormat.frequency();
+ sf.mSampleRate = audioFormat.sampleRate();
sf.mFramesPerPacket = 1;
- sf.mChannelsPerFrame = audioFormat.channels();
+ sf.mChannelsPerFrame = audioFormat.channelCount();
sf.mBitsPerChannel = audioFormat.sampleSize();
sf.mBytesPerFrame = sf.mChannelsPerFrame * (sf.mBitsPerChannel / 8);
sf.mBytesPerPacket = sf.mFramesPerPacket * sf.mBytesPerFrame;
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
index 5e3adcb..226d723 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -100,13 +100,13 @@ public:
You can also query each device for the formats it supports. A
format in this context is a set consisting of a specific byte
- order, channel, codec, frequency, sample rate, and sample type. A
+ order, channel, codec, sample rate, sample size and sample type. A
format is represented by the QAudioFormat class.
The values supported by the the device for each of these
parameters can be fetched with
supportedByteOrders(), supportedChannels(), supportedCodecs(),
- supportedFrequencies(), supportedSampleSizes(), and
+ supportedSampleRates(), supportedSampleSizes(), and
supportedSampleTypes(). The combinations supported are dependent on the platform,
audio plugins installed and the audio device capabilities. If you need a specific format, you can check if
the device supports it with isFormatSupported(), or fetch a
@@ -259,7 +259,16 @@ QStringList QAudioDeviceInfo::supportedCodecs() const
}
/*!
- Returns a list of supported frequencies.
+ Returns a list of supported sample rates.
+*/
+
+QList<int> QAudioDeviceInfo::supportedSampleRates() const
+{
+ return supportedFrequencies();
+}
+
+/*!
+ \internal
*/
QList<int> QAudioDeviceInfo::supportedFrequencies() const
@@ -268,7 +277,16 @@ QList<int> QAudioDeviceInfo::supportedFrequencies() const
}
/*!
- Returns a list of supported channels.
+ Returns a list of supported channel counts.
+*/
+
+QList<int> QAudioDeviceInfo::supportedChannelCounts() const
+{
+ return supportedChannels();
+}
+
+/*!
+ \internal
*/
QList<int> QAudioDeviceInfo::supportedChannels() const
diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h
index 5c7cb98..78b1e69 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.h
+++ b/src/multimedia/audio/qaudiodeviceinfo.h
@@ -84,7 +84,9 @@ public:
QStringList supportedCodecs() const;
QList<int> supportedFrequencies() const;
+ QList<int> supportedSampleRates() const;
QList<int> supportedChannels() const;
+ QList<int> supportedChannelCounts() const;
QList<int> supportedSampleSizes() const;
QList<QAudioFormat::Endian> supportedByteOrders() const;
QList<QAudioFormat::SampleType> supportedSampleTypes() const;
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
index f58f5be..9187264 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
@@ -78,20 +78,20 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
{
QAudioFormat nearest;
if(mode == QAudio::AudioOutput) {
- nearest.setFrequency(44100);
- nearest.setChannels(2);
+ nearest.setSampleRate(44100);
+ nearest.setChannelCount(2);
nearest.setByteOrder(QAudioFormat::LittleEndian);
nearest.setSampleType(QAudioFormat::SignedInt);
nearest.setSampleSize(16);
nearest.setCodec(QLatin1String("audio/pcm"));
} else {
- nearest.setFrequency(8000);
- nearest.setChannels(1);
+ nearest.setSampleRate(8000);
+ nearest.setChannelCount(1);
nearest.setSampleType(QAudioFormat::UnSignedInt);
nearest.setSampleSize(8);
nearest.setCodec(QLatin1String("audio/pcm"));
if(!testSettings(nearest)) {
- nearest.setChannels(2);
+ nearest.setChannelCount(2);
nearest.setSampleSize(16);
nearest.setSampleType(QAudioFormat::SignedInt);
}
@@ -253,8 +253,8 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
snd_pcm_hw_params_any( handle, params );
// set the values!
- snd_pcm_hw_params_set_channels(handle,params,format.channels());
- snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
+ snd_pcm_hw_params_set_channels(handle,params,format.channelCount());
+ snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),dir);
switch(format.sampleSize()) {
case 8:
if(format.sampleType() == QAudioFormat::SignedInt)
@@ -295,18 +295,18 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
} else
testCodec = true;
- if(err>=0 && format.channels() != -1) {
- err = snd_pcm_hw_params_test_channels(handle,params,format.channels());
+ if(err>=0 && format.channelCount() != -1) {
+ err = snd_pcm_hw_params_test_channels(handle,params,format.channelCount());
if(err>=0)
- err = snd_pcm_hw_params_set_channels(handle,params,format.channels());
+ err = snd_pcm_hw_params_set_channels(handle,params,format.channelCount());
if(err>=0)
testChannel = true;
}
- if(err>=0 && format.frequency() != -1) {
- err = snd_pcm_hw_params_test_rate(handle,params,format.frequency(),0);
+ if(err>=0 && format.sampleRate() != -1) {
+ err = snd_pcm_hw_params_test_rate(handle,params,format.sampleRate(),0);
if(err>=0)
- err = snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
+ err = snd_pcm_hw_params_set_rate(handle,params,format.sampleRate(),dir);
if(err>=0)
testFreq = true;
}
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
index 8905119..8e19b12 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
@@ -144,10 +144,10 @@ QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format)
rc.setCodec(QString::fromLatin1("audio/pcm"));
- if (rc.frequency() != target.frequency())
- rc.setFrequency(target.frequency());
- if (rc.channels() != target.channels())
- rc.setChannels(target.channels());
+ if (rc.sampleRate() != target.sampleRate())
+ rc.setSampleRate(target.sampleRate());
+ if (rc.channelCount() != target.channelCount())
+ rc.setChannelCount(target.channelCount());
if (rc.sampleSize() != target.sampleSize())
rc.setSampleSize(target.sampleSize());
if (rc.byteOrder() != target.byteOrder())
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
index 33af022..739b0d0 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
@@ -94,15 +94,15 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
{
QAudioFormat nearest;
if(mode == QAudio::AudioOutput) {
- nearest.setFrequency(44100);
- nearest.setChannels(2);
+ nearest.setSampleRate(44100);
+ nearest.setChannelCount(2);
nearest.setByteOrder(QAudioFormat::LittleEndian);
nearest.setSampleType(QAudioFormat::SignedInt);
nearest.setSampleSize(16);
nearest.setCodec(QLatin1String("audio/pcm"));
} else {
- nearest.setFrequency(11025);
- nearest.setChannels(1);
+ nearest.setSampleRate(11025);
+ nearest.setChannelCount(1);
nearest.setByteOrder(QAudioFormat::LittleEndian);
nearest.setSampleType(QAudioFormat::SignedInt);
nearest.setSampleSize(8);
@@ -181,12 +181,12 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
if(!format.codec().startsWith(QLatin1String("audio/pcm")))
failed = true;
- if(!failed && !(format.channels() == 1 || format.channels() == 2))
+ if(!failed && !(format.channelCount() == 1 || format.channelCount() == 2))
failed = true;
if(!failed) {
- if(!(format.frequency() == 8000 || format.frequency() == 11025 || format.frequency() == 22050 ||
- format.frequency() == 44100 || format.frequency() == 48000 || format.frequency() == 96000))
+ if(!(format.sampleRate() == 8000 || format.sampleRate() == 11025 || format.sampleRate() == 22050 ||
+ format.sampleRate() == 44100 || format.sampleRate() == 48000 || format.sampleRate() == 96000))
failed = true;
}
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
index b2bbe14..f7867f4 100644
--- a/src/multimedia/audio/qaudioformat.cpp
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -144,7 +144,7 @@ public:
Values are initialized as follows:
\list
\o frequency() = -1
- \o channels() = -1
+ \o channelCount() = -1
\o sampleSize() = -1
\o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder)
\o sampleType() = QAudioFormat::Unknown
@@ -224,7 +224,16 @@ bool QAudioFormat::isValid() const
}
/*!
- Sets the frequency to \a frequency.
+ Sets the sample rate to \a samplerate Hertz.
+*/
+
+void QAudioFormat::setSampleRate(int samplerate)
+{
+ d->frequency = samplerate;
+}
+
+/*!
+ \internal
*/
void QAudioFormat::setFrequency(int frequency)
@@ -233,7 +242,16 @@ void QAudioFormat::setFrequency(int frequency)
}
/*!
- Returns the current frequency value.
+ Returns the current sample rate in Hertz.
+*/
+
+int QAudioFormat::sampleRate() const
+{
+ return d->frequency;
+}
+
+/*!
+ \internal
*/
int QAudioFormat::frequency() const
@@ -242,7 +260,16 @@ int QAudioFormat::frequency() const
}
/*!
- Sets the channels to \a channels.
+ Sets the channel count to \a channels.
+*/
+
+void QAudioFormat::setChannelCount(int channels)
+{
+ d->channels = channels;
+}
+
+/*!
+ \internal
*/
void QAudioFormat::setChannels(int channels)
@@ -251,7 +278,16 @@ void QAudioFormat::setChannels(int channels)
}
/*!
- Returns the current channel value.
+ Returns the current channel count value.
+*/
+
+int QAudioFormat::channelCount() const
+{
+ return d->channels;
+}
+
+/*!
+ \internal
*/
int QAudioFormat::channels() const
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
index 7e92c2f..efc247f 100644
--- a/src/multimedia/audio/qaudioformat.h
+++ b/src/multimedia/audio/qaudioformat.h
@@ -76,6 +76,12 @@ public:
void setFrequency(int frequency);
int frequency() const;
+ void setSampleRate(int samplerate);
+ int sampleRate() const;
+
+ void setChannelCount(int channels);
+ int channelCount() const;
+
void setChannels(int channels);
int channels() const;
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index d81df7a..733ff4e 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -88,8 +88,8 @@ QT_BEGIN_NAMESPACE
QAudioFormat format;
// set up the format you want, eg.
- format.setFrequency(8000);
- format.setChannels(1);
+ format.setSampleRate(8000);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
index 3dbe66c..fc612fe 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp
@@ -256,7 +256,7 @@ bool QAudioInputPrivate::open()
int dir;
int err=-1;
int count=0;
- unsigned int freakuency=settings.frequency();
+ unsigned int freakuency=settings.sampleRate();
QString dev = QString(QLatin1String(m_device.constData()));
QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput);
@@ -332,7 +332,7 @@ bool QAudioInputPrivate::open()
}
}
if ( !fatal ) {
- err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
+ err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channelCount() );
if ( err < 0 ) {
fatal = true;
errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
@@ -505,7 +505,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
errorState = QAudio::NoError;
deviceState = QAudio::IdleState;
} else {
- totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.frequency();
+ totalTimeValue += snd_pcm_bytes_to_frames(handle, err)*1000000/settings.sampleRate();
resuming = false;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
@@ -534,7 +534,7 @@ void QAudioInputPrivate::resume()
resuming = true;
deviceState = QAudio::ActiveState;
int chunks = buffer_size/period_size;
- timer->start(buffer_time*chunks/2000);
+ timer->start(period_time*chunks/2000);
emit stateChanged(deviceState);
}
}
@@ -702,7 +702,7 @@ qint64 InputPrivate::readData( char* data, qint64 len)
count++;
}
if(err > 0 && readFrames > 0) {
- audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.frequency()*1000;
+ audioDevice->totalTimeValue += readFrames*1000/audioDevice->settings.sampleRate()*1000;
audioDevice->deviceState = QAudio::ActiveState;
return err;
}
diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
index d63045f..7c856f4 100644
--- a/src/multimedia/audio/qaudioinput_mac_p.cpp
+++ b/src/multimedia/audio/qaudioinput_mac_p.cpp
@@ -814,7 +814,7 @@ int QAudioInputPrivate::notifyInterval() const
qint64 QAudioInputPrivate::processedUSecs() const
{
- return totalFrames * 1000000 / audioFormat.frequency();
+ return totalFrames * 1000000 / audioFormat.sampleRate();
}
qint64 QAudioInputPrivate::elapsedUSecs() const
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index f50a547..f98ecc6 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -225,16 +225,16 @@ bool QAudioInputPrivate::open()
header = 0;
if(buffer_size == 0) {
// Default buffer size, 100ms, default period size is 20ms
- buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.1;
+ buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.1;
period_size = buffer_size/5;
} else {
period_size = buffer_size/5;
}
timeStamp.restart();
elapsedTimeOffset = 0;
- wfx.nSamplesPerSec = settings.frequency();
+ wfx.nSamplesPerSec = settings.sampleRate();
wfx.wBitsPerSample = settings.sampleSize();
- wfx.nChannels = settings.channels();
+ wfx.nChannels = settings.channelCount();
wfx.cbSize = 0;
wfx.wFormatTag = WAVE_FORMAT_PCM;
@@ -374,8 +374,8 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
} else {
totalTimeValue += waveBlocks[header].dwBytesRecorded
- /((settings.channels()*settings.sampleSize()/8))
- *10000/settings.frequency()*100;
+ /((settings.channelCount()*settings.sampleSize()/8))
+ *10000/settings.sampleRate()*100;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
resuming = false;
@@ -388,8 +388,8 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
#endif
totalTimeValue += waveBlocks[header].dwBytesRecorded
- /((settings.channels()*settings.sampleSize()/8))
- *10000/settings.frequency()*100;
+ /((settings.channelCount()*settings.sampleSize()/8))
+ *10000/settings.sampleRate()*100;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
resuming = false;
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
index 1c7b617..6633308 100644
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -83,8 +83,8 @@ QT_BEGIN_NAMESPACE
QAudioFormat format;
// Set up the format, eg.
- format.setFrequency(8000);
- format.setChannels(1);
+ format.setSampleRate(8000);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
index 020a104..d5963c9 100644
--- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
@@ -279,7 +279,7 @@ bool QAudioOutputPrivate::open()
int dir;
int err=-1;
int count=0;
- unsigned int freakuency=settings.frequency();
+ unsigned int freakuency=settings.sampleRate();
QString dev = QLatin1String(m_device.constData());
QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
@@ -354,7 +354,7 @@ bool QAudioOutputPrivate::open()
}
}
if ( !fatal ) {
- err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
+ err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channelCount() );
if ( err < 0 ) {
fatal = true;
errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
@@ -494,7 +494,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
err = snd_pcm_writei( handle, data, frames );
}
if(err > 0) {
- totalTimeValue += err*1000000/settings.frequency();
+ totalTimeValue += err*1000000/settings.sampleRate();
resuming = false;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
index e0651bf..2dec43d 100644
--- a/src/multimedia/audio/qaudiooutput_mac_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_mac_p.cpp
@@ -87,8 +87,8 @@ public:
m_device(0)
{
m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
- m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channels();
- m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.frequency();
+ m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channelCount();
+ m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.sampleRate();
m_fillTimer = new QTimer(this);
connect(m_fillTimer, SIGNAL(timeout()), SLOT(fillBuffer()));
@@ -546,7 +546,7 @@ int QAudioOutputPrivate::notifyInterval() const
qint64 QAudioOutputPrivate::processedUSecs() const
{
- return totalFrames * 1000000 / audioFormat.frequency();
+ return totalFrames * 1000000 / audioFormat.sampleRate();
}
qint64 QAudioOutputPrivate::elapsedUSecs() const
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index 02c8cfe..389aef9 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -213,7 +213,7 @@ bool QAudioOutputPrivate::open()
#endif
if(buffer_size == 0) {
// Default buffer size, 200ms, default period size is 40ms
- buffer_size = settings.frequency()*settings.channels()*(settings.sampleSize()/8)*0.2;
+ buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.2;
period_size = buffer_size/5;
} else {
period_size = buffer_size/5;
@@ -232,9 +232,9 @@ bool QAudioOutputPrivate::open()
timeStamp.restart();
elapsedTimeOffset = 0;
- wfx.nSamplesPerSec = settings.frequency();
+ wfx.nSamplesPerSec = settings.sampleRate();
wfx.wBitsPerSample = settings.sampleSize();
- wfx.nChannels = settings.channels();
+ wfx.nChannels = settings.channelCount();
wfx.cbSize = 0;
wfx.wFormatTag = WAVE_FORMAT_PCM;
@@ -289,8 +289,8 @@ void QAudioOutputPrivate::close()
return;
deviceState = QAudio::StoppedState;
- int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
- *settings.channels()*(settings.sampleSize()/8));
+ int delay = (buffer_size-bytesFree())*1000/(settings.sampleRate()
+ *settings.channelCount()*(settings.sampleSize()/8));
waveOutReset(hWaveOut);
Sleep(delay+10);
@@ -386,8 +386,8 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
LeaveCriticalSection(&waveOutCriticalSection);
#endif
totalTimeValue += current->dwBufferLength
- /(settings.channels()*(settings.sampleSize()/8))
- *1000000/settings.frequency();;
+ /(settings.channelCount()*(settings.sampleSize()/8))
+ *1000000/settings.sampleRate();;
waveCurrentBlock++;
waveCurrentBlock %= buffer_size/period_size;
current = &waveBlocks[waveCurrentBlock];