Skip to content

Loading…

[AE][DS] fixed: set the right subtype and channelmask. #2399

Closed
wants to merge 1 commit into from

4 participants

@wsoltys
Team Kodi member

I tried to copy some of daniela's directsound changes to the recent ae but can't test unfortunately. @DDDamian: could you comment (and test)? Does it need more to support hd audio?

@DDDamian

@Wiso - sure. DS and bitstreaming aren't usually friends as much depends on the shared format set by Windows and other programs, which may force resampling etc, so didn't even try to incorporate (sorry XP folks), but will review/test.

@wiso

@DDDamian: wrong person

@DDDamian

@wiso - sorry :) small world!

@wsoltys
Team Kodi member

well it seems to have worked for daniela's build and since AE already delivers those formats to ds why not trying to support it. But still I live an learn here :)

@DDDamian

@wsoltys - actually it didn't (kinda as expected) and we had a discussion about it, but it's buried in that thread somewhere. Will play around this evening and report back, but the issue has always been getting data thru DS untouched - simple in WASAPI, but a house of cards in DS.

@DDDamian

@wsoltys - I played around with DS a little further but the basic issues keep rearing their ugly heads (mostly that you can't really enforce what gets out the other side of DS). Here's some of the previous chat on attempting it (goes on for a few pages): http://forum.xbmc.org/showthread.php?tid=121877&pid=1043015#pid1043015

@wsoltys
Team Kodi member

@DDDamian - I didn't read the whole thread but what I got is that it works good when exclusive mode is checked. But I'll rephase my question:
Does this change make the DirectSound sink:

1) working better in some circumstances than before?
2) working worse than the current implementation?
3) no change?

So if you opt for 1) I'm still fine with implementing it as currently it doesn't work at all when ae is sending hd audio to the ds sink.

@DDDamian

@wsoltys - not so much an exclusive mode thing (DS treats DSSCL_EXLUSIVE the same as DSSCL_PRIORITY since DX8) as keeping the Kernal Mixer out of the equation.

I've got this to work on Win8 (has some improvements over Win7/Vista in the Kernal Mixer that messed about by dithering the audio even when volume is 1.0f), but you'll want to remove:

  • line 371
  • lines 376-378 inclusive
  • line 365 change " const u_int numTests = 6;" to "const u_int numTests = 5;"

My ATI cards & receiver didn't balk at the channel counts, but some might. Probably safer to set them.

Haven't tested on Win7 yet, but will in a day or so with the above changes.

Can throw together a patch with the above if you like.

@wsoltys
Team Kodi member

@DDDamian - please do so. Thanks.

@jmarshallnz
Team Kodi member

Any ETA on that patch/testing?

@wsoltys
Team Kodi member

obsolete

@wsoltys wsoltys closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 9, 2013
  1. @wsoltys
This page is out of date. Refresh to see the latest.
Showing with 33 additions and 3 deletions.
  1. +33 −3 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
View
36 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
@@ -41,6 +41,9 @@ extern HWND g_hWnd;
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
+DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_MLP, 0x0000000c, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DTS_HD, 0x0000000b, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
+DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_DIGITAL_PLUS, 0x0000000a, 0x0cea, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
#define EXIT_ON_FAILURE(hr, reason, ...) if(FAILED(hr)) {CLog::Log(LOGERROR, reason " - %s", __VA_ARGS__, WASAPIErrToStr(hr)); goto failed;}
@@ -202,11 +205,38 @@ bool CAESinkDirectSound::Initialize(AEAudioFormat &format, std::string &device)
wfxex.Format.nSamplesPerSec = format.m_sampleRate;
if (AE_IS_RAW(format.m_dataFormat))
{
+ wfxex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfxex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- wfxex.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
- wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
wfxex.Format.wBitsPerSample = 16;
- wfxex.Format.nChannels = 2;
+
+ switch(format.m_dataFormat)
+ {
+ case AE_FMT_TRUEHD:
+ wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_MLP;
+ wfxex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY |
+ SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT |
+ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
+ break;
+
+ case AE_FMT_DTSHD:
+ wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DTS_HD;
+ wfxex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY |
+ SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT |
+ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
+ break;
+
+ case AE_FMT_EAC3:
+ wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_DIGITAL_PLUS;
+ break;
+
+ case AE_FMT_AC3:
+ case AE_FMT_DTS:
+ default:
+ wfxex.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF;
+ wfxex.SubFormat = _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF;
+ wfxex.Format.nChannels = 2;
+ break;
+ }
}
else
{
Something went wrong with that request. Please try again.