Skip to content
This repository
Browse code

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

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

3 notes 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.