Re: 5.1 Surround Sound with WMVHD files

Tech-Archive recommends: Fix windows errors by optimizing your registry



I just noticed that SetSpeakerConfig is a global setting that an application
shouldn't touch. Does this mean the system should automatically know that it
is a 5.1 stream and handle it (which doesn't happen with AudioBox but does
happen with MediaPlayer)?

What method to you think MediaPlayer is using to play the audio?

I'm using a Creative Labs USB external 5.1 sound system if that matters.

David

"David" wrote:

Thanks for your reply Chris. I've taken a look at the AudioBox code which is
DirectShow based. It doesn't, by default, handle 5.1 audio and I've looked at
all the interfaces created with the filtergraph and there are no references
to 5.1 audio. In fact the only audio interface seems to be IBasicAudio which
only allows volume and balance adjustments.

Should I try to implement a solution around IDirectSound8 which has the
SetSpeakerConfig function? Do you know of any code samples that use
IDirectSound8? I also need to play back the video in the WMV file -- how
would you suggest that be handled?

David

"Chris P. [MVP]" wrote:

On Fri, 10 Feb 2006 17:37:03 -0500, Chris P. [MVP] wrote:

On Fri, 10 Feb 2006 07:47:30 -0800, David wrote:

I'm running into a lot of dead-ends regard 5.1 playback and hoping someone
can help. Here's what I've tried so far:

1) I've used DirectSoundCreate8 to get an interface pointer and then used
SetSpeakerConfig(DSSPEAKER_5POINT1); to set 5.1 and then let my video
playback code (based on PlayWnd) to play the video/audio and I only get
output from the front speakers. If there's something else I need to do
before playing back the video, please let me know what it is. Is there some
DirectShow call to enable discrete output that I'm missing? Do I need to
talk to the sound output devices through the FilterGraphs?

2) I've tried using the AudioPlay sample code in the SDK and dropping in the
high resolution audio code from MSDN to play 5.1 audio and I still get audio
primarily from the front but it seems to put some of it in the back but not
as it is in the original file. It seems to try to reallocate the sound mix
and I only get a faint mixed version of the real audio in the rear with most
of the rear audio coming out of the front speakers. Even if I get this
working, I don't know if I can render video using the Reader interface that
AudioPlay is based around. I modified AudioPlay code using SetOutputSetting
to set g_wszEnableDiscreteOutput to TRUE and g_wszSpeakerConfig to
DSSPEAKER_5POINT1.

My WMA/WMV files play perfectly under Windows Media Player with the audio
distributed as in our original mix and with the WMVHD video playing
perfectly. If it can be done by WMP then I would think I should be able to
do it somehow. Some example code would be very welcome.

If you are referring to the AudioPlayer sample in the Windows Media SDK it
does not use DirectSound at all, it uses the legacy winMM API. Sound cards
like SoundBlaster do not support multi-channel output with the winMM API.
You would have to modify all the waveout code in audioplay.cpp so that it
used DirectSound.

You can get a DirectSound reference code from an older DXSDK (Dec 2004) for
the StreamData sample or from my web site. You will have to change the
code that declares the WAVEFORMATEX so that it uses a WAVEFORMATEXTENSIBLE
instead when creating the secondary buffer, in addition to the
SetSpeakerConfig().

After further review of that AudioPlayer sample in the Format SDK it is
just a very bad sample and I would stay away. I think you would get
further with the AudioBox DirectShow sample, should be easier too if you
know a little DirectShow. DirectShow is part of the Platform SDK but for
easy reference to the samples you need the project files from here:

http://tmhare.mvps.org/downloads.htm


--
http://www.chrisnet.net/code.htm
http://www.avdevforum.com/AV

.



Relevant Pages

  • RE: Green Screen/ Full Screen Issue
    ... DirectShow Filters ... Indeo® video 5.10 Decompression ... MainConcept MPEG Audio ... Realtek HD Front Green Jack,0x00200000,1,1,,5.03.2600.2180 ...
    (microsoft.public.windowsmedia)
  • Synchronize and PushSource filter
    ... I have a directshow client/server application using a custom video ... ** Video Stream ... ** Audio Stream ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Microsoft game; Age of Empires II...
    ... DirectShow Filters ... MainConcept DV Video ... MainConcept MPEG Audio ... SB Audigy DirectMusic Synthesizer,0x00200000,1,1,,5.03.2600.2180 ...
    (microsoft.public.windowsxp.games)
  • Re: Microsoft game; Age of Empires II...
    ... DirectShow Filters ... MainConcept DV Video ... MainConcept MPEG Audio ... SB Audigy DirectMusic Synthesizer,0x00200000,1,1,,5.03.2600.2180 ...
    (microsoft.public.windowsxp.games)
  • Re: Microsoft game; Age of Empires II...
    ... DirectShow Filters ... MainConcept DV Video ... MainConcept MPEG Audio ... SB Audigy DirectMusic Synthesizer,0x00200000,1,1,,5.03.2600.2180 ...
    (microsoft.public.windowsxp.games)