XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Streaming AC3 over SPDIF using DirectSound primary buffer.

Last post 01-10-2008 8:31 PM by yoedhana. 1 replies.
  • 11-21-2007 6:35 PM

    Streaming AC3 over SPDIF using DirectSound primary buffer.

    Hi,

    I have posted a similar question in the Audio forum, but received no response. Perhaps I have posted my question in the wrong forum.

    I am running Vista pro, and trying to stream an AC3 data from a file to my digital speakers using DirectSound. I created a DirectSound primary buffer for playing the AC3 stream over SPDIF. I can successfully call SetFormat with the following wave format definition:

    waveFormat.dwChannelMask 3
    waveFormat.Format.nAvgBytesPerSec 176400
    waveFormat.Format.cbSize 22
    waveFormat.Format.nBlockAlign 4
    waveFormat.Format.nChannels 2
    waveFormat.Format.nSamplesPerSec 44100
    waveFormat.Format.wBitsPerSample 16
    waveFormat.Format.wFormatTag 146
    waveFormat.SubFormat MEDIASUBTYPE_DOLBY_AC3_SPDIF

    I also called GetCaps on the primary buffer, and noticed that DSBCAPS_LOCHARDWARE is not part of the dwFlags of the buffer. However, I can lock the primary buffer successfully, obtained a pointer to the buffer byte, copy my AC3 byte array to the buffer pointer, and unlocked the buffer. There are 2 problems with my code:

    1.  The DirectSound documentation says that I should not be able to lock the buffer. But I succeeded anyway.
    2.  I can't hear anything from my digital speaker, and the speaker controller does not indicate that it is receiving any data.

    Media player can play my AC3 test file, so the file is not the problem. SPDIF endpoint device is the default playback device, and I created a DirectSound instance with DSDEVID_DEFAULTPLAYBACK.

    Clearly I am doing something wrong. Can anyone help me point out the obvious mistake please?

    Thanks,
  • 01-10-2008 8:31 PM In reply to

    Re: Streaming AC3 over SPDIF using DirectSound primary buffer.

    Answer
    I have solved the playback problem using DirectShow.
Page 1 of 1 (2 items) Previous Next