diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-09-14 12:33:37 +1000 |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2009-09-14 12:33:37 +1000 |
commit | f3e2ccf63de242feeba10e75fd00ffd43fc038b0 (patch) | |
tree | e202fecb0507aafc837ef169605c3389f4649526 | |
parent | 9fe43c999d3d9b21836345522bb67bab38e661af (diff) | |
download | qt4-tools-f3e2ccf63de242feeba10e75fd00ffd43fc038b0.tar.gz |
AudioDevices demo doesn't do anything on Windows
-put example audiodevices in layout.
-added more checking to testSettings() in win32 implementation.
-disabled objects in example audiodevices that are not editable.
-added more checking to alsa implementation for preferredFormat().
-changed internal strings from tr to QLatin1String.
Reviewed-by:Justin Mcpherson
-rw-r--r-- | examples/multimedia/audio/audiodevices/audiodevices.cpp | 12 | ||||
-rw-r--r-- | examples/multimedia/audio/audiodevices/audiodevicesbase.ui | 444 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp | 67 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp | 36 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_alsa_p.cpp | 8 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_alsa_p.cpp | 8 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 2 |
8 files changed, 303 insertions, 276 deletions
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audio/audiodevices/audiodevices.cpp index 52aa4db23e..0d305ff0f3 100644 --- a/examples/multimedia/audio/audiodevices/audiodevices.cpp +++ b/examples/multimedia/audio/audiodevices/audiodevices.cpp @@ -58,6 +58,14 @@ AudioDevicesBase::~AudioDevicesBase() {} AudioTest::AudioTest( QMainWindow *parent, Qt::WFlags f ) : AudioDevicesBase( parent, f ) { + nearestFreq->setDisabled(true); + nearestChannel->setDisabled(true); + nearestCodec->setDisabled(true); + nearestSampleSize->setDisabled(true); + nearestSampleType->setDisabled(true); + nearestEndian->setDisabled(true); + logOutput->setDisabled(true); + mode = QAudio::AudioOutput; modeBox->addItem("Input"); modeBox->addItem("Output"); @@ -87,6 +95,8 @@ AudioTest::~AudioTest() void AudioTest::test() { // tries to set all the settings picked. + logOutput->clear(); + logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); if(device) { if(device->isFormatSupported(settings)) { @@ -179,7 +189,7 @@ void AudioTest::deviceChanged(int idx) if(codecz.size()) settings.setCodec(codecz.at(0)); // Add false to create failed condition! - codecsBox->addItem("audio/mpeg"); + codecsBox->addItem("audio/test"); sampleSizesBox->clear(); QList<int> sampleSizez = device->supportedSampleSizes(); diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui index 674f2014f6..52073389ab 100644 --- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui +++ b/examples/multimedia/audio/audiodevices/audiodevicesbase.ui @@ -1,7 +1,8 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>AudioDevicesBase</class> - <widget class="QMainWindow" name="AudioDevicesBase" > - <property name="geometry" > + <widget class="QMainWindow" name="AudioDevicesBase"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> @@ -9,246 +10,223 @@ <height>702</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>AudioDevicesBase</string> </property> - <widget class="QWidget" name="centralwidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>28</y> - <width>504</width> - <height>653</height> - </rect> - </property> - <widget class="QWidget" name="layoutWidget" > - <property name="geometry" > - <rect> - <x>40</x> - <y>21</y> - <width>321</width> - <height>506</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="deviceLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Device</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLabel" name="modeLabel" > - <property name="text" > - <string>Mode</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QComboBox" name="deviceBox" /> - </item> - <item row="1" column="1" > - <widget class="QComboBox" name="modeBox" /> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="actualLabel" > - <property name="frameShape" > - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="text" > - <string>Actual Settings</string> - </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="QLabel" name="nearestLabel" > - <property name="frameShape" > - <enum>QFrame::Panel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <property name="text" > - <string>Nearest Settings</string> - </property> - <property name="alignment" > - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="3" column="0" > - <widget class="QLabel" name="actualFreqLabel" > - <property name="text" > - <string>Frequency</string> - </property> - </widget> - </item> - <item row="3" column="1" > - <widget class="QLabel" name="nearestFreqLabel" > - <property name="text" > - <string>Frequency</string> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QComboBox" name="frequencyBox" /> - </item> - <item row="4" column="1" > - <widget class="QLineEdit" name="nearestFreq" /> - </item> - <item row="5" column="0" > - <widget class="QLabel" name="actualChannelsLabel" > - <property name="text" > - <string>Channels</string> - </property> - </widget> - </item> - <item row="5" column="1" > - <widget class="QLabel" name="nearestChannelLabel" > - <property name="text" > - <string>Channel</string> - </property> - </widget> - </item> - <item row="6" column="0" > - <widget class="QComboBox" name="channelsBox" /> - </item> - <item row="6" column="1" > - <widget class="QLineEdit" name="nearestChannel" /> - </item> - <item row="7" column="0" > - <widget class="QLabel" name="actualCodecLabel" > - <property name="text" > - <string>Codecs</string> - </property> - </widget> - </item> - <item row="7" column="1" > - <widget class="QLabel" name="nearestCodecLabel" > - <property name="text" > - <string>Codec</string> - </property> - </widget> - </item> - <item row="8" column="0" > - <widget class="QComboBox" name="codecsBox" /> - </item> - <item row="8" column="1" > - <widget class="QLineEdit" name="nearestCodec" /> - </item> - <item row="9" column="0" > - <widget class="QLabel" name="actualSampleSizeLabel" > - <property name="text" > - <string>SampleSize</string> - </property> - </widget> - </item> - <item row="9" column="1" > - <widget class="QLabel" name="nearestSampleSizeLabel" > - <property name="text" > - <string>SampleSize</string> - </property> - </widget> - </item> - <item row="10" column="0" > - <widget class="QComboBox" name="sampleSizesBox" /> - </item> - <item row="10" column="1" > - <widget class="QLineEdit" name="nearestSampleSize" /> - </item> - <item row="11" column="0" > - <widget class="QLabel" name="actualSampleTypeLabel" > - <property name="text" > - <string>SampleType</string> - </property> - </widget> - </item> - <item row="11" column="1" > - <widget class="QLabel" name="nearestSampleTypeLabel" > - <property name="text" > - <string>SampleType</string> - </property> - </widget> - </item> - <item row="12" column="0" > - <widget class="QComboBox" name="sampleTypesBox" /> - </item> - <item row="12" column="1" > - <widget class="QLineEdit" name="nearestSampleType" /> - </item> - <item row="13" column="0" > - <widget class="QLabel" name="actualEndianLabel" > - <property name="text" > - <string>Endianess</string> - </property> - </widget> - </item> - <item row="13" column="1" > - <widget class="QLabel" name="nearestEndianLabel" > - <property name="text" > - <string>Endianess</string> - </property> - </widget> - </item> - <item row="14" column="0" > - <widget class="QComboBox" name="endianBox" /> - </item> - <item row="14" column="1" > - <widget class="QLineEdit" name="nearestEndian" /> - </item> - <item row="15" column="0" colspan="2" > - <widget class="QTextEdit" name="logOutput" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>40</height> - </size> - </property> - </widget> - </item> - <item row="16" column="0" colspan="2" > - <widget class="QPushButton" name="testButton" > - <property name="text" > - <string>Test</string> - </property> - </widget> - </item> - </layout> - </widget> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="deviceLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Device</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="modeLabel"> + <property name="text"> + <string>Mode</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QComboBox" name="deviceBox"/> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="modeBox"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="actualLabel"> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>Actual Settings</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="nearestLabel"> + <property name="frameShape"> + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>Nearest Settings</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="actualFreqLabel"> + <property name="text"> + <string>Frequency</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QLabel" name="nearestFreqLabel"> + <property name="text"> + <string>Frequency</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QComboBox" name="frequencyBox"/> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="nearestFreq"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="actualChannelsLabel"> + <property name="text"> + <string>Channels</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QLabel" name="nearestChannelLabel"> + <property name="text"> + <string>Channel</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QComboBox" name="channelsBox"/> + </item> + <item row="6" column="1"> + <widget class="QLineEdit" name="nearestChannel"/> + </item> + <item row="7" column="0"> + <widget class="QLabel" name="actualCodecLabel"> + <property name="text"> + <string>Codecs</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QLabel" name="nearestCodecLabel"> + <property name="text"> + <string>Codec</string> + </property> + </widget> + </item> + <item row="8" column="0"> + <widget class="QComboBox" name="codecsBox"/> + </item> + <item row="8" column="1"> + <widget class="QLineEdit" name="nearestCodec"/> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="actualSampleSizeLabel"> + <property name="text"> + <string>SampleSize</string> + </property> + </widget> + </item> + <item row="9" column="1"> + <widget class="QLabel" name="nearestSampleSizeLabel"> + <property name="text"> + <string>SampleSize</string> + </property> + </widget> + </item> + <item row="10" column="0"> + <widget class="QComboBox" name="sampleSizesBox"/> + </item> + <item row="10" column="1"> + <widget class="QLineEdit" name="nearestSampleSize"/> + </item> + <item row="11" column="0"> + <widget class="QLabel" name="actualSampleTypeLabel"> + <property name="text"> + <string>SampleType</string> + </property> + </widget> + </item> + <item row="11" column="1"> + <widget class="QLabel" name="nearestSampleTypeLabel"> + <property name="text"> + <string>SampleType</string> + </property> + </widget> + </item> + <item row="12" column="0"> + <widget class="QComboBox" name="sampleTypesBox"/> + </item> + <item row="12" column="1"> + <widget class="QLineEdit" name="nearestSampleType"/> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="actualEndianLabel"> + <property name="text"> + <string>Endianess</string> + </property> + </widget> + </item> + <item row="13" column="1"> + <widget class="QLabel" name="nearestEndianLabel"> + <property name="text"> + <string>Endianess</string> + </property> + </widget> + </item> + <item row="14" column="0"> + <widget class="QComboBox" name="endianBox"/> + </item> + <item row="14" column="1"> + <widget class="QLineEdit" name="nearestEndian"/> + </item> + <item row="15" column="0" colspan="2"> + <widget class="QTextEdit" name="logOutput"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>40</height> + </size> + </property> + </widget> + </item> + <item row="16" column="0" colspan="2"> + <widget class="QPushButton" name="testButton"> + <property name="text"> + <string>Test</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>504</width> - <height>28</height> - </rect> - </property> - </widget> - <widget class="QStatusBar" name="statusbar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>681</y> - <width>504</width> - <height>21</height> + <height>19</height> </rect> </property> </widget> + <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 4ed1b41f46..c944cf0a1d 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -81,13 +81,18 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); - nearest.setCodec(tr("audio/pcm")); + nearest.setCodec(QLatin1String("audio/pcm")); } else { nearest.setFrequency(8000); nearest.setChannels(1); - nearest.setSampleType(QAudioFormat::SignedInt); + nearest.setSampleType(QAudioFormat::UnSignedInt); nearest.setSampleSize(8); - nearest.setCodec(tr("audio/pcm")); + nearest.setCodec(QLatin1String("audio/pcm")); + if(!testSettings(nearest)) { + nearest.setChannels(2); + nearest.setSampleSize(16); + nearest.setSampleType(QAudioFormat::SignedInt); + } } return nearest; } @@ -145,9 +150,9 @@ bool QAudioDeviceInfoPrivate::open() { int err = 0; QString dev = device; - if(!dev.contains(tr("default"))) { + if(!dev.contains(QLatin1String("default"))) { int idx = snd_card_get_index(dev.toLocal8Bit().constData()); - dev = QString(tr("hw:%1,0")).arg(idx); + dev = QString(QLatin1String("hw:%1,0")).arg(idx); } if(mode == QAudio::AudioOutput) { err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0); @@ -172,16 +177,15 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const { // Set nearest to closest settings that do work. // See if what is in settings will work (return value). - int err = 0; snd_pcm_t* handle; snd_pcm_hw_params_t *params; QString dev = device; // open() - if(!dev.contains(tr("default"))) { + if(!dev.contains(QLatin1String("default"))) { int idx = snd_card_get_index(dev.toLocal8Bit().constData()); - dev = QString(tr("hw:%1,0")).arg(idx); + dev = QString(QLatin1String("hw:%1,0")).arg(idx); } if(mode == QAudio::AudioOutput) { err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0); @@ -205,8 +209,45 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const snd_pcm_hw_params_alloca( ¶ms ); 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); + switch(format.sampleSize()) { + case 8: + if(format.sampleType() == QAudioFormat::SignedInt) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8); + else if(format.sampleType() == QAudioFormat::UnSignedInt) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8); + break; + case 16: + if(format.sampleType() == QAudioFormat::SignedInt) { + if(format.byteOrder() == QAudioFormat::LittleEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE); + else if(format.byteOrder() == QAudioFormat::BigEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE); + } else if(format.sampleType() == QAudioFormat::UnSignedInt) { + if(format.byteOrder() == QAudioFormat::LittleEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE); + else if(format.byteOrder() == QAudioFormat::BigEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE); + } + break; + case 32: + if(format.sampleType() == QAudioFormat::SignedInt) { + if(format.byteOrder() == QAudioFormat::LittleEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE); + else if(format.byteOrder() == QAudioFormat::BigEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE); + } else if(format.sampleType() == QAudioFormat::UnSignedInt) { + if(format.byteOrder() == QAudioFormat::LittleEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE); + else if(format.byteOrder() == QAudioFormat::BigEndian) + snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE); + } + } + // For now, just accept only audio/pcm codec - if(!format.codec().startsWith(tr("audio/pcm"))) { + if(!format.codec().startsWith(QLatin1String("audio/pcm"))) { err=-1; } else testCodec = true; @@ -313,7 +354,7 @@ void QAudioDeviceInfoPrivate::updateLists() typez.append(QAudioFormat::SignedInt); typez.append(QAudioFormat::UnSignedInt); typez.append(QAudioFormat::Float); - codecz.append(tr("audio/pcm")); + codecz.append(QLatin1String("audio/pcm")); close(); } @@ -346,10 +387,10 @@ QList<QByteArray> QAudioDeviceInfoPrivate::deviceList(QAudio::Mode mode) if(io == NULL) _m = mode; - QString str = tr(name); + QString str = QLatin1String(name); - if(str.contains(tr("default"))) { - int pos = str.indexOf(tr("="),0); + if(str.contains(QLatin1String("default"))) { + int pos = str.indexOf(QLatin1String("="),0); devices.append(str.mid(pos+1).toLocal8Bit().constData()); } } diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp index 371f442b5d..ba9f5e26da 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp @@ -99,13 +99,13 @@ QAudioFormat QAudioDeviceInfoPrivate::preferredFormat() const nearest.setByteOrder(QAudioFormat::LittleEndian); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(16); - nearest.setCodec(tr("audio/pcm")); + nearest.setCodec(QLatin1String("audio/pcm")); } else { nearest.setFrequency(11025); nearest.setChannels(1); nearest.setSampleType(QAudioFormat::SignedInt); nearest.setSampleSize(8); - nearest.setCodec(tr("audio/pcm")); + nearest.setCodec(QLatin1String("audio/pcm")); } return nearest; } @@ -174,27 +174,25 @@ bool QAudioDeviceInfoPrivate::testSettings(const QAudioFormat& format) const // Set nearest to closest settings that do work. // See if what is in settings will work (return value). - bool testChannel = false; - bool testCodec = false; - bool testFreq = false; - - int err = 0; + bool failed = false; // For now, just accept only audio/pcm codec - if(!format.codec().startsWith(tr("audio/pcm"))) { - err=-1; - } else - testCodec = true; + if(!format.codec().startsWith(QLatin1String("audio/pcm"))) + failed = true; - if(err>=0 && format.channels() != -1) { - testChannel = true; - } + if(!failed && !(format.channels() == 1 || format.channels() == 2)) + failed = true; - if(err>=0 && format.frequency() != -1) { - testFreq = true; + if(!failed) { + if(!(format.frequency() == 8000 || format.frequency() == 11025 || format.frequency() == 22050 || + format.frequency() == 44100 || format.frequency() == 48000 || format.frequency() == 96000)) + failed = true; } - if(err == 0) { + if(!failed && !(format.sampleSize() == 8 || format.sampleSize() == 16)) + failed = true; + + if(!failed) { // settings work return true; } @@ -209,7 +207,7 @@ void QAudioDeviceInfoPrivate::updateLists() DWORD fmt = NULL; QString tmp; - if(device.compare(tr("default")) == 0) + if(device.compare(QLatin1String("default")) == 0) base = true; if(mode == QAudio::AudioOutput) { @@ -331,7 +329,7 @@ void QAudioDeviceInfoPrivate::updateLists() typez.append(QAudioFormat::SignedInt); typez.append(QAudioFormat::UnSignedInt); - codecz.append(tr("audio/pcm")); + codecz.append(QLatin1String("audio/pcm")); } } diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index c98102c69c..f36ffc853b 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -78,7 +78,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor pullMode = true; resuming = false; - QStringList list1 = QString(tr(device)).split(tr(":")); + QStringList list1 = QString(QLatin1String(device)).split(QLatin1String(":")); m_device = QByteArray(list1.at(0).toLocal8Bit().constData()); timer = new QTimer(this); @@ -254,9 +254,9 @@ bool QAudioInputPrivate::open() int count=0; unsigned int freakuency=settings.frequency(); - QString dev = QString(tr(m_device.constData())); - if(!dev.contains(tr("default"))) { - dev = QString(tr("default:CARD=%1")).arg(tr(m_device.constData())); + QString dev = QString(QLatin1String(m_device.constData())); + if(!dev.contains(QLatin1String("default"))) { + dev = QString(QLatin1String("default:CARD=%1")).arg(QLatin1String(m_device.constData())); } // Step 1: try and open the device diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index 315a59bf07..31441ae360 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -245,7 +245,7 @@ bool QAudioInputPrivate::open() == MMSYSERR_NOERROR) { QString tmp; tmp = QString::fromUtf16((const unsigned short*)wic.szPname); - if(tmp.compare(tr(m_device)) == 0) { + if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; } diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index 45ff115fa0..e8a3f5c97c 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -81,7 +81,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioF resuming = false; opened = false; - QStringList list1 = QString(tr(device)).split(tr(":")); + QStringList list1 = QString(QLatin1String(device)).split(QLatin1String(":")); m_device = QByteArray(list1.at(0).toLocal8Bit().constData()); timer = new QTimer(this); @@ -277,9 +277,9 @@ bool QAudioOutputPrivate::open() int count=0; unsigned int freakuency=settings.frequency(); - QString dev = tr(m_device.constData()); - if(!dev.contains(tr("default"))) { - dev = QString(tr("default:CARD=%1")).arg(tr(m_device.constData())); + QString dev = QLatin1String(m_device.constData()); + if(!dev.contains(QLatin1String("default"))) { + dev = QString(QLatin1String("default:CARD=%1")).arg(QLatin1String(m_device.constData())); } // Step 1: try and open the device while((count < 5) && (err < 0)) { diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index fae680c0f5..aea3a3f63e 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -241,7 +241,7 @@ bool QAudioOutputPrivate::open() == MMSYSERR_NOERROR) { QString tmp; tmp = QString::fromUtf16((const unsigned short*)woc.szPname); - if(tmp.compare(tr(m_device)) == 0) { + if(tmp.compare(QLatin1String(m_device)) == 0) { devId = ii; break; } |