mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-30 19:01:43 +02:00
On Windows, set audio format to match the internal mix format.
This works around multichannel bugs in the Qt audio framework.
This commit is contained in:
parent
30c189e624
commit
b19a44e046
1 changed files with 17 additions and 1 deletions
|
@ -379,7 +379,23 @@ bool adjustedFormatForAudioDevice(const QAudioDeviceInfo& audioDevice,
|
||||||
|
|
||||||
adjustedAudioFormat = desiredAudioFormat;
|
adjustedAudioFormat = desiredAudioFormat;
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#if defined(Q_OS_WIN)
|
||||||
|
|
||||||
|
// NOTE: On Windows, testing for supported formats is unreliable for channels > 2,
|
||||||
|
// due to WAVEFORMATEX based implementation. To work around, the sample rate and
|
||||||
|
// channel count are directly set to the WASAPI shared-mode mix format.
|
||||||
|
|
||||||
|
adjustedAudioFormat = audioDevice.preferredFormat(); // returns mixFormat
|
||||||
|
|
||||||
|
adjustedAudioFormat.setCodec("audio/pcm");
|
||||||
|
adjustedAudioFormat.setSampleSize(16);
|
||||||
|
adjustedAudioFormat.setSampleType(QAudioFormat::SignedInt);
|
||||||
|
adjustedAudioFormat.setByteOrder(QAudioFormat::LittleEndian);
|
||||||
|
|
||||||
|
// resampling should produce an integral number of samples
|
||||||
|
return (adjustedAudioFormat.sampleRate() * AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL % AudioConstants::SAMPLE_RATE == 0);
|
||||||
|
|
||||||
|
#elif defined(Q_OS_ANDROID)
|
||||||
// FIXME: query the native sample rate of the device?
|
// FIXME: query the native sample rate of the device?
|
||||||
adjustedAudioFormat.setSampleRate(48000);
|
adjustedAudioFormat.setSampleRate(48000);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue