Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[WIN32][AE] fixed: DirectSound supports more than 2 channels.

  • Loading branch information...
commit 04314035eff13e7e6805eb482fecb5bfd05be055 1 parent abb9a90
wsoltys authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
2  xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
View
@@ -603,7 +603,7 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo
if (SUCCEEDED(hr) && varName.blob.cbSize > 0)
{
WAVEFORMATEX* smpwfxex = (WAVEFORMATEX*)varName.blob.pBlobData;
- deviceInfo.m_channels = layoutsByChCount[std::min(smpwfxex->nChannels, (WORD) 2)];
+ deviceInfo.m_channels = layoutsByChCount[std::min(smpwfxex->nChannels, (WORD) 8)];
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_FLOAT));
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));
deviceInfo.m_sampleRates.push_back(std::min(smpwfxex->nSamplesPerSec, (DWORD) 96000));

3 comments on commit 0431403

Karlson2k
Collaborator

@wsoltys Nice catch! But it should be fixed as "std::max( ... , 2)"
This is intended to use mono devices and devices with unknown number of channels as stereo devices.

wsoltys
Collaborator

I have to admit that video/audio isn't my terrain and I just try to dig into it. PKEY_AudioEngine_DeviceFormat returns us what the user has selected not what the hw is capable of. Since the layoutsByChCount array is limited to 9 entries it should be guarded. As layoutsByChCount has a valid entry for 1 channel (AE_CH_FC) I thought it would be okay.
@DDDamian: thoughts?

Damian Huckle
Collaborator

You're both right:

  • it should be guarded to protect against layouts greater than the layoutByChCount array
  • it should never be mono (the channel remapper will force mono -> stereo regardless, so having a mono output here would be bad).
Please sign in to comment.
Something went wrong with that request. Please try again.