diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-01 02:17:47 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-01 02:17:47 (GMT) |
commit | 3733ee3ca9fdc964f2453089ca18c9179839846e (patch) | |
tree | 95cb7a51eb51f612611f48b44a51c23bcd0f8727 /src/multimedia/audio | |
parent | a16a6e6fb3cf9d9c70515d2361bc06c598c27f3f (diff) | |
parent | 8a2f4988afa8af09e4e8ed39d76c8eac0ba30390 (diff) | |
download | Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.zip Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.tar.gz Qt-3733ee3ca9fdc964f2453089ca18c9179839846e.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src/multimedia/audio')
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo.cpp | 30 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo.h | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 4 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioformat.cpp | 58 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioformat.h | 4 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 5 |
6 files changed, 90 insertions, 13 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index 092efc5..19b4669 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -105,8 +105,8 @@ public: The values supported by the the device for each of these parameters can be fetched with - supportedByteOrders(), supportedChannels(), supportedCodecs(), - supportedFrequencies(), supportedSampleSizes(), and + supportedByteOrders(), supportedChannelCounts(), supportedCodecs(), + 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,18 @@ QStringList QAudioDeviceInfo::supportedCodecs() const } /*! - Returns a list of supported frequencies. + Returns a list of supported sample rates. +*/ + +QList<int> QAudioDeviceInfo::supportedSampleRates() const +{ + return supportedFrequencies(); +} + +/*! + \obsolete + + Use supportedSampleRates() instead. */ QList<int> QAudioDeviceInfo::supportedFrequencies() const @@ -268,7 +279,18 @@ 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(); +} + +/*! + \obsolete + + Use supportedChannelCount() instead. */ QList<int> QAudioDeviceInfo::supportedChannels() const diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h index 62dc8a2..1cc0731 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_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index f6b8154..955a880 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -95,14 +95,14 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const QAudioFormat nearest; if(mode == QAudio::AudioOutput) { nearest.setFrequency(44100); - nearest.setChannels(2); + 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.setChannelCount(1); nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp index 89ae0ff..e349b9e 100644 --- a/src/multimedia/audio/qaudioformat.cpp +++ b/src/multimedia/audio/qaudioformat.cpp @@ -111,7 +111,7 @@ public: \o Parameter \o Description \row - \o Frequency + \o Sample Rate \o Samples per second of audio data in Hertz. \row \o Number of channels @@ -143,8 +143,8 @@ public: Values are initialized as follows: \list - \o frequency() = -1 - \o channels() = -1 + \o sampleRate() = -1 + \o channelCount() = -1 \o sampleSize() = -1 \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder) \o sampleType() = QAudioFormat::Unknown @@ -224,7 +224,18 @@ 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; +} + +/*! + \obsolete + + Use setSampleRate() instead. */ void QAudioFormat::setFrequency(int frequency) @@ -233,7 +244,18 @@ void QAudioFormat::setFrequency(int frequency) } /*! - Returns the current frequency value. + Returns the current sample rate in Hertz. +*/ + +int QAudioFormat::sampleRate() const +{ + return d->frequency; +} + +/*! + \obsolete + + Use sampleRate() instead. */ int QAudioFormat::frequency() const @@ -242,7 +264,18 @@ 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; +} + +/*! + \obsolete + + Use setChannelCount() instead. */ void QAudioFormat::setChannels(int channels) @@ -251,7 +284,18 @@ void QAudioFormat::setChannels(int channels) } /*! - Returns the current channel value. + Returns the current channel count value. +*/ + +int QAudioFormat::channelCount() const +{ + return d->channels; +} + +/*! + \obsolete + + Use channelCount() instead. */ int QAudioFormat::channels() const diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h index cb58d1c..6c835b7 100644 --- a/src/multimedia/audio/qaudioformat.h +++ b/src/multimedia/audio/qaudioformat.h @@ -75,9 +75,13 @@ public: void setFrequency(int frequency); int frequency() const; + void setSampleRate(int sampleRate); + int sampleRate() const; void setChannels(int channels); int channels() const; + void setChannelCount(int channelCount); + int channelCount() const; void setSampleSize(int sampleSize); int sampleSize() const; diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 17e8bfb..84fd2a5 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -230,6 +230,11 @@ bool QAudioInputPrivate::open() } else { period_size = buffer_size/5; } +#ifdef Q_OS_WINCE + // For wince reduce size to 40ms for buffer size and 20ms period + buffer_size = settings.sampleRate()*settings.channelCount()*(settings.sampleSize()/8)*0.04; + period_size = buffer_size/2; +#endif timeStamp.restart(); elapsedTimeOffset = 0; wfx.nSamplesPerSec = settings.frequency(); |