summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2010-01-06 00:16:02 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2010-01-06 00:16:02 (GMT)
commitf124538ef4840c3d24b4c7e9e7221adb52bdee2c (patch)
tree22e96b25c3780fb849d4f833ef1e17331128dc36
parenta4550c49e982aa0218ab7097b814678505f8482c (diff)
downloadQt-f124538ef4840c3d24b4c7e9e7221adb52bdee2c.zip
Qt-f124538ef4840c3d24b4c7e9e7221adb52bdee2c.tar.gz
Qt-f124538ef4840c3d24b4c7e9e7221adb52bdee2c.tar.bz2
Added setChannelCount() to QAudioFormat.
Added setChannelCount() and updated docs/examples/tests to use it instead of setChannels(). Reviewed-by:Justin McPherson
-rw-r--r--doc/src/snippets/audio/main.cpp2
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp4
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp2
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp2
-rw-r--r--src/multimedia/audio/qaudio_mac.cpp2
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp6
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp2
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp4
-rw-r--r--src/multimedia/audio/qaudioformat.cpp9
-rw-r--r--src/multimedia/audio/qaudioformat.h1
-rw-r--r--src/multimedia/audio/qaudioinput.cpp2
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp2
-rw-r--r--tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp2
-rw-r--r--tests/auto/qaudioformat/tst_qaudioformat.cpp10
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp2
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp2
16 files changed, 32 insertions, 22 deletions
diff --git a/doc/src/snippets/audio/main.cpp b/doc/src/snippets/audio/main.cpp
index 0910865..1e6242d 100644
--- a/doc/src/snippets/audio/main.cpp
+++ b/doc/src/snippets/audio/main.cpp
@@ -91,7 +91,7 @@ private:
QAudioFormat format;
format.setFrequency(44100);
//![1]
- format.setChannels(2);
+ format.setChannelCount(2);
format.setSampleSize(16);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/examples/multimedia/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index e205e03..4f4a95f 100644
--- a/examples/multimedia/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
@@ -172,7 +172,7 @@ void AudioTest::deviceChanged(int idx)
for(int i = 0; i < chz.size(); ++i)
channelsBox->addItem(QString("%1").arg(chz.at(i)));
if(chz.size())
- settings.setChannels(chz.at(0));
+ settings.setChannelCount(chz.at(0));
codecsBox->clear();
QStringList codecz = deviceInfo.supportedCodecs();
@@ -234,7 +234,7 @@ void AudioTest::freqChanged(int idx)
void AudioTest::channelChanged(int idx)
{
- settings.setChannels(channelsBox->itemText(idx).toInt());
+ settings.setChannelCount(channelsBox->itemText(idx).toInt());
}
void AudioTest::codecChanged(int idx)
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 75bddd6..e6ebe95 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -196,7 +196,7 @@ InputTest::InputTest()
pullMode = true;
format.setFrequency(8000);
- format.setChannels(1);
+ format.setChannelCount(1);
format.setSampleSize(16);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index b6047db..e822064 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -165,7 +165,7 @@ AudioTest::AudioTest()
gen->start();
settings.setFrequency(SYSTEM_FREQ);
- settings.setChannels(1);
+ settings.setChannelCount(1);
settings.setSampleSize(16);
settings.setCodec("audio/pcm");
settings.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
index 1cd9225..635377c 100644
--- a/src/multimedia/audio/qaudio_mac.cpp
+++ b/src/multimedia/audio/qaudio_mac.cpp
@@ -65,7 +65,7 @@ QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
QAudioFormat audioFormat;
audioFormat.setFrequency(sf.mSampleRate);
- audioFormat.setChannels(sf.mChannelsPerFrame);
+ audioFormat.setChannelCount(sf.mChannelsPerFrame);
audioFormat.setSampleSize(sf.mBitsPerChannel);
audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
audioFormat.setByteOrder(sf.mFormatFlags & kLinearPCMFormatFlagIsBigEndian != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
index f58f5be..3bcf05b 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
@@ -79,19 +79,19 @@ 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(8000);
- nearest.setChannels(1);
+ 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);
}
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
index 8905119..c8b0196 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
@@ -147,7 +147,7 @@ QAudioFormat QAudioDeviceInfoInternal::nearestFormat(const QAudioFormat& format)
if (rc.frequency() != target.frequency())
rc.setFrequency(target.frequency());
if (rc.channels() != target.channels())
- rc.setChannels(target.channels());
+ rc.setChannelCount(target.channels());
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..3c5b129 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 b2bbe14..b8e0851 100644
--- a/src/multimedia/audio/qaudioformat.cpp
+++ b/src/multimedia/audio/qaudioformat.cpp
@@ -245,6 +245,15 @@ int QAudioFormat::frequency() const
Sets the channels to \a channels.
*/
+void QAudioFormat::setChannelCount(int channels)
+{
+ d->channels = channels;
+}
+
+/*!
+ \internal
+*/
+
void QAudioFormat::setChannels(int channels)
{
d->channels = channels;
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
index 7e92c2f..88241df 100644
--- a/src/multimedia/audio/qaudioformat.h
+++ b/src/multimedia/audio/qaudioformat.h
@@ -76,6 +76,7 @@ public:
void setFrequency(int frequency);
int frequency() const;
+ void setChannelCount(int channels);
void setChannels(int channels);
int channels() const;
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index d81df7a..0d43ce4 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
QAudioFormat format;
// set up the format you want, eg.
format.setFrequency(8000);
- format.setChannels(1);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
index 1c7b617..2f1ad3b 100644
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
QAudioFormat format;
// Set up the format, eg.
format.setFrequency(8000);
- format.setChannels(1);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
index 715f219..14cf6b3 100644
--- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
+++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
@@ -170,7 +170,7 @@ void tst_QAudioDeviceInfo::isformat()
if(available) {
QAudioFormat format;
format.setFrequency(44100);
- format.setChannels(2);
+ format.setChannelCount(2);
format.setSampleType(QAudioFormat::SignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleSize(16);
diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp
index 0778a8e..2742dd7 100644
--- a/tests/auto/qaudioformat/tst_qaudioformat.cpp
+++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp
@@ -78,7 +78,7 @@ void tst_QAudioFormat::checkNull()
QVERIFY(!audioFormat1.isValid());
audioFormat0.setFrequency(44100);
- audioFormat0.setChannels(2);
+ audioFormat0.setChannelCount(2);
audioFormat0.setSampleSize(16);
audioFormat0.setCodec("audio/pcm");
audioFormat0.setSampleType(QAudioFormat::SignedInt);
@@ -95,7 +95,7 @@ void tst_QAudioFormat::checkFrequency()
void tst_QAudioFormat::checkChannels()
{
QAudioFormat audioFormat;
- audioFormat.setChannels(2);
+ audioFormat.setChannelCount(2);
QVERIFY(audioFormat.channels() == 2);
}
@@ -138,14 +138,14 @@ void tst_QAudioFormat::checkEquality()
// on filled formats
audioFormat0.setFrequency(8000);
- audioFormat0.setChannels(1);
+ audioFormat0.setChannelCount(1);
audioFormat0.setSampleSize(8);
audioFormat0.setCodec("audio/pcm");
audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
audioFormat0.setSampleType(QAudioFormat::UnSignedInt);
audioFormat1.setFrequency(8000);
- audioFormat1.setChannels(1);
+ audioFormat1.setChannelCount(1);
audioFormat1.setSampleSize(8);
audioFormat1.setCodec("audio/pcm");
audioFormat1.setByteOrder(QAudioFormat::LittleEndian);
@@ -165,7 +165,7 @@ void tst_QAudioFormat::checkAssignment()
QAudioFormat audioFormat1;
audioFormat0.setFrequency(8000);
- audioFormat0.setChannels(1);
+ audioFormat0.setChannelCount(1);
audioFormat0.setSampleSize(8);
audioFormat0.setCodec("audio/pcm");
audioFormat0.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 744ce38..40bf01f 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -69,7 +69,7 @@ private:
void tst_QAudioInput::initTestCase()
{
format.setFrequency(8000);
- format.setChannels(1);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
index 26694cc..f3feec1 100644
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -72,7 +72,7 @@ private:
void tst_QAudioOutput::initTestCase()
{
format.setFrequency(8000);
- format.setChannels(1);
+ format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setByteOrder(QAudioFormat::LittleEndian);