Changeset 769 for trunk/examples/multimedia/audiodevices/audiodevices.cpp
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/examples/multimedia/audiodevices/audiodevices.cpp
r651 r769 44 44 45 45 #include "audiodevices.h" 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 46 80 47 81 AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f) … … 68 102 connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int))); 69 103 connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int))); 104 70 105 71 106 modeBox->setCurrentIndex(0); … … 82 117 { 83 118 // tries to set all the settings picked. 84 logOutput->clear(); 85 logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition."); 119 testResult->clear(); 86 120 87 121 if (!deviceInfo.isNull()) { 88 122 if (deviceInfo.isFormatSupported(settings)) { 89 logOutput->append(tr("Success"));123 (tr("Success")); 90 124 nearestFreq->setText(""); 91 125 nearestChannel->setText(""); … … 96 130 } else { 97 131 QAudioFormat nearest = deviceInfo.nearestFormat(settings); 98 logOutput->append(tr("Failed"));132 (tr("Failed")); 99 133 nearestFreq->setText(QString("%1").arg(nearest.frequency())); 100 134 nearestChannel->setText(QString("%1").arg(nearest.channels())); 101 135 nearestCodec->setText(nearest.codec()); 102 136 nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize())); 103 104 switch(nearest.sampleType()) { 105 case QAudioFormat::SignedInt: 106 nearestSampleType->setText("SignedInt"); 107 break; 108 case QAudioFormat::UnSignedInt: 109 nearestSampleType->setText("UnSignedInt"); 110 break; 111 case QAudioFormat::Float: 112 nearestSampleType->setText("Float"); 113 break; 114 case QAudioFormat::Unknown: 115 nearestSampleType->setText("Unknown"); 116 } 117 switch(nearest.byteOrder()) { 118 case QAudioFormat::LittleEndian: 119 nearestEndian->setText("LittleEndian"); 120 break; 121 case QAudioFormat::BigEndian: 122 nearestEndian->setText("BigEndian"); 123 } 137 nearestSampleType->setText(toString(nearest.sampleType())); 138 nearestEndian->setText(toString(nearest.byteOrder())); 124 139 } 125 140 } 126 141 else 127 logOutput->append(tr("No Device"));142 (tr("No Device")); 128 143 } 129 144 130 145 void AudioTest::modeChanged(int idx) 131 146 { 147 148 132 149 // mode has changed 133 150 if (idx == 0) … … 139 156 foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode)) 140 157 deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo)); 158 159 160 141 161 } 142 162 143 163 void AudioTest::deviceChanged(int idx) 144 164 { 165 166 145 167 if (deviceBox->count() == 0) 146 168 return; … … 181 203 sampleTypesBox->clear(); 182 204 QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes(); 183 for (int i = 0; i < sampleTypez.size(); ++i) { 184 switch(sampleTypez.at(i)) { 185 case QAudioFormat::SignedInt: 186 sampleTypesBox->addItem("SignedInt"); 187 break; 188 case QAudioFormat::UnSignedInt: 189 sampleTypesBox->addItem("UnSignedInt"); 190 break; 191 case QAudioFormat::Float: 192 sampleTypesBox->addItem("Float"); 193 break; 194 case QAudioFormat::Unknown: 195 sampleTypesBox->addItem("Unknown"); 196 } 197 if (sampleTypez.size()) 198 settings.setSampleType(sampleTypez.at(0)); 199 } 205 206 for (int i = 0; i < sampleTypez.size(); ++i) 207 sampleTypesBox->addItem(toString(sampleTypez.at(i))); 208 if (sampleTypez.size()) 209 settings.setSampleType(sampleTypez.at(0)); 200 210 201 211 endianBox->clear(); 202 212 QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders(); 203 for (int i = 0; i < endianz.size(); ++i) { 204 switch (endianz.at(i)) { 205 case QAudioFormat::LittleEndian: 206 endianBox->addItem("Little Endian"); 207 break; 208 case QAudioFormat::BigEndian: 209 endianBox->addItem("Big Endian"); 210 break; 211 } 212 } 213 for (int i = 0; i < endianz.size(); ++i) 214 endianBox->addItem(toString(endianz.at(i))); 213 215 if (endianz.size()) 214 216 settings.setByteOrder(endianz.at(0)); 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 215 267 } 216 268
Note:
See TracChangeset
for help on using the changeset viewer.