equal
deleted
inserted
replaced
76 |
76 |
77 QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) |
77 QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode) |
78 { |
78 { |
79 device = QLatin1String(dev); |
79 device = QLatin1String(dev); |
80 this->mode = mode; |
80 this->mode = mode; |
|
81 |
|
82 updateLists(); |
81 } |
83 } |
82 |
84 |
83 QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() |
85 QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal() |
84 { |
86 { |
85 close(); |
87 close(); |
174 { |
176 { |
175 // Set nearest to closest settings that do work. |
177 // Set nearest to closest settings that do work. |
176 // See if what is in settings will work (return value). |
178 // See if what is in settings will work (return value). |
177 |
179 |
178 bool failed = false; |
180 bool failed = false; |
179 |
181 bool match = false; |
180 // For now, just accept only audio/pcm codec |
182 |
181 if(!format.codec().startsWith(QLatin1String("audio/pcm"))) |
183 // check codec |
182 failed = true; |
184 for( int i = 0; i < codecz.count(); i++) { |
183 |
185 if (format.codec() == codecz.at(i)) |
184 if(!failed && !(format.channels() == 1 || format.channels() == 2)) |
186 match = true; |
185 failed = true; |
187 } |
186 |
188 if (!match) failed = true; |
187 if(!failed) { |
189 |
188 if(!(format.frequency() == 8000 || format.frequency() == 11025 || format.frequency() == 22050 || |
190 // check channel |
189 format.frequency() == 44100 || format.frequency() == 48000 || format.frequency() == 96000)) |
191 match = false; |
190 failed = true; |
192 if (!failed) { |
191 } |
193 for( int i = 0; i < channelz.count(); i++) { |
192 |
194 if (format.channels() == channelz.at(i)) { |
193 if(!failed && !(format.sampleSize() == 8 || format.sampleSize() == 16)) |
195 match = true; |
194 failed = true; |
196 break; |
|
197 } |
|
198 } |
|
199 } |
|
200 if (!match) failed = true; |
|
201 |
|
202 // check frequency |
|
203 match = false; |
|
204 if (!failed) { |
|
205 for( int i = 0; i < freqz.count(); i++) { |
|
206 if (format.frequency() == freqz.at(i)) { |
|
207 match = true; |
|
208 break; |
|
209 } |
|
210 } |
|
211 } |
|
212 |
|
213 // check sample size |
|
214 match = false; |
|
215 if (!failed) { |
|
216 for( int i = 0; i < sizez.count(); i++) { |
|
217 if (format.sampleSize() == sizez.at(i)) { |
|
218 match = true; |
|
219 break; |
|
220 } |
|
221 } |
|
222 } |
|
223 |
|
224 // check byte order |
|
225 match = false; |
|
226 if (!failed) { |
|
227 for( int i = 0; i < byteOrderz.count(); i++) { |
|
228 if (format.byteOrder() == byteOrderz.at(i)) { |
|
229 match = true; |
|
230 break; |
|
231 } |
|
232 } |
|
233 } |
|
234 |
|
235 // check sample type |
|
236 match = false; |
|
237 if (!failed) { |
|
238 for( int i = 0; i < typez.count(); i++) { |
|
239 if (format.sampleType() == typez.at(i)) { |
|
240 match = true; |
|
241 break; |
|
242 } |
|
243 } |
|
244 } |
195 |
245 |
196 if(!failed) { |
246 if(!failed) { |
197 // settings work |
247 // settings work |
198 return true; |
248 return true; |
199 } |
249 } |
330 typez.append(QAudioFormat::SignedInt); |
380 typez.append(QAudioFormat::SignedInt); |
331 typez.append(QAudioFormat::UnSignedInt); |
381 typez.append(QAudioFormat::UnSignedInt); |
332 |
382 |
333 codecz.append(QLatin1String("audio/pcm")); |
383 codecz.append(QLatin1String("audio/pcm")); |
334 } |
384 } |
|
385 if (freqz.count() > 0) |
|
386 freqz.prepend(8000); |
335 } |
387 } |
336 |
388 |
337 QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) |
389 QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) |
338 { |
390 { |
339 Q_UNUSED(mode) |
391 Q_UNUSED(mode) |