95 QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const |
95 QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const |
96 { |
96 { |
97 QAudioFormat nearest; |
97 QAudioFormat nearest; |
98 if(mode == QAudio::AudioOutput) { |
98 if(mode == QAudio::AudioOutput) { |
99 nearest.setFrequency(44100); |
99 nearest.setFrequency(44100); |
100 nearest.setChannels(2); |
100 nearest.setChannelCount(2); |
101 nearest.setByteOrder(QAudioFormat::LittleEndian); |
101 nearest.setByteOrder(QAudioFormat::LittleEndian); |
102 nearest.setSampleType(QAudioFormat::SignedInt); |
102 nearest.setSampleType(QAudioFormat::SignedInt); |
103 nearest.setSampleSize(16); |
103 nearest.setSampleSize(16); |
104 nearest.setCodec(QLatin1String("audio/pcm")); |
104 nearest.setCodec(QLatin1String("audio/pcm")); |
105 } else { |
105 } else { |
106 nearest.setFrequency(11025); |
106 nearest.setFrequency(11025); |
107 nearest.setChannels(1); |
107 nearest.setChannelCount(1); |
108 nearest.setByteOrder(QAudioFormat::LittleEndian); |
108 nearest.setByteOrder(QAudioFormat::LittleEndian); |
109 nearest.setSampleType(QAudioFormat::SignedInt); |
109 nearest.setSampleType(QAudioFormat::SignedInt); |
110 nearest.setSampleSize(8); |
110 nearest.setSampleSize(8); |
111 nearest.setCodec(QLatin1String("audio/pcm")); |
111 nearest.setCodec(QLatin1String("audio/pcm")); |
112 } |
112 } |
266 unsigned long iNumDevs,i; |
266 unsigned long iNumDevs,i; |
267 iNumDevs = waveOutGetNumDevs(); |
267 iNumDevs = waveOutGetNumDevs(); |
268 for(i=0;i<iNumDevs;i++) { |
268 for(i=0;i<iNumDevs;i++) { |
269 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
269 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
270 == MMSYSERR_NOERROR) { |
270 == MMSYSERR_NOERROR) { |
271 tmp = QString::fromUtf16((const unsigned short*)woc.szPname); |
271 tmp = QString((const QChar *)woc.szPname); |
272 if(tmp.compare(device) == 0) { |
272 if(tmp.compare(device) == 0) { |
273 match = true; |
273 match = true; |
274 fmt = woc.dwFormats; |
274 fmt = woc.dwFormats; |
275 break; |
275 break; |
276 } |
276 } |
286 unsigned long iNumDevs,i; |
286 unsigned long iNumDevs,i; |
287 iNumDevs = waveInGetNumDevs(); |
287 iNumDevs = waveInGetNumDevs(); |
288 for(i=0;i<iNumDevs;i++) { |
288 for(i=0;i<iNumDevs;i++) { |
289 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
289 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
290 == MMSYSERR_NOERROR) { |
290 == MMSYSERR_NOERROR) { |
291 tmp = QString::fromUtf16((const unsigned short*)woc.szPname); |
291 tmp = QString((const QChar *)woc.szPname); |
292 if(tmp.compare(device) == 0) { |
292 if(tmp.compare(device) == 0) { |
293 match = true; |
293 match = true; |
294 fmt = woc.dwFormats; |
294 fmt = woc.dwFormats; |
295 break; |
295 break; |
296 } |
296 } |
397 unsigned long iNumDevs,i; |
397 unsigned long iNumDevs,i; |
398 iNumDevs = waveOutGetNumDevs(); |
398 iNumDevs = waveOutGetNumDevs(); |
399 for(i=0;i<iNumDevs;i++) { |
399 for(i=0;i<iNumDevs;i++) { |
400 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
400 if(waveOutGetDevCaps(i, &woc, sizeof(WAVEOUTCAPS)) |
401 == MMSYSERR_NOERROR) { |
401 == MMSYSERR_NOERROR) { |
402 devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); |
402 devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); |
403 } |
403 } |
404 } |
404 } |
405 } else { |
405 } else { |
406 WAVEINCAPS woc; |
406 WAVEINCAPS woc; |
407 unsigned long iNumDevs,i; |
407 unsigned long iNumDevs,i; |
408 iNumDevs = waveInGetNumDevs(); |
408 iNumDevs = waveInGetNumDevs(); |
409 for(i=0;i<iNumDevs;i++) { |
409 for(i=0;i<iNumDevs;i++) { |
410 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
410 if(waveInGetDevCaps(i, &woc, sizeof(WAVEINCAPS)) |
411 == MMSYSERR_NOERROR) { |
411 == MMSYSERR_NOERROR) { |
412 devices.append(QString::fromUtf16((const unsigned short*)woc.szPname).toLocal8Bit().constData()); |
412 devices.append(QString((const QChar *)woc.szPname).toLocal8Bit().constData()); |
413 } |
413 } |
414 } |
414 } |
415 |
415 |
416 } |
416 } |
417 if(devices.count() > 0) |
417 if(devices.count() > 0) |