Forum

Results 1 to 2 of 2
  1. #1
    Join Date
    March 2010
    Location
    Tacoma
    Posts
    68

    [API] Incongruent data passed to sound buffer functions depending on capture mode.

    So a bit of a confusing bug in the sound buffer API functions.

    Two issues:

    1) In Windows Audio Session (WASAPI) channel speaker mask data returned is unusable, it does not match DirectSound (DS) values for channel speaker masks. As far as I can tell there is no matching system for WASAPI. Correctly initializing XAudio2 mixing systems fails to correctly get speaker mask because of this.

    2) In DS mode sampleCount value appears to be combined for all channels (channels*sampleCount), where as in WASAPI sampleCount value appears to be samples per channel. In DS mode a stereo output is reporting a sample count of 960 per call of the API event, and in WASAPI it is 480. This leads to possible audio corruption when relying on these values. Which value is correct I do not know, from my understanding in the documentation it is supposed to be samples per channel, and if you want to derive the total length of the interleaved PCM data in the samples pointer you multiply it by the number of returned samples.

    These incongruencies have had me chasing my tail on a couple issues and until I can get answer on which is which I don't feel like wasting more of my time.

    Please let me know if a fix or explanation is inbound.

    Thanks!

    Upon looking at timings it appears DS is twice as slow in it's events, which explains the 960 samples vs 480 (and confirming that the mono channel events also are 960 samples long).

    Are WASAPI speaker masks possibly big endian?
    Last edited by Chris; June 16th, 2014 at 08:37 AM. Reason: merged triple post

  2. #2
    Join Date
    June 2002
    Location
    Netherlands
    Posts
    1,049
    1. The speaker mask we use do not map 1 to 1 to wasapi or ds. If you look at public_definitions.h you will see that we use the non standard values:
    #define SPEAKER_HEADPHONES_LEFT 0x10000000
    #define SPEAKER_HEADPHONES_RIGHT 0x20000000
    #define SPEAKER_MONO 0x40000000
    on windows you should be able to map those to
    SPEAKER_FRONT_LEFT
    SPEAKER_FRONT_RIGHT
    SPEAKER_FRONT_LEFT

    I think this will solve your problems.

    2. Wasapi and ds do not necessarily use the same timing. In fact it is likely that wasapi uses a smaller timing than ds. This accounts, as you pointed out later, for the 480 vs 960 sample count. Indeed our api should output sample counts, not samples*channels.

    Did this answer your questions?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [No Bug] Sound issue - sleep mode
    By markgm5 in forum Bug Reports [EN/DE]
    Replies: 13
    Last Post: October 25th, 2011, 01:53 PM
  2. Incorrect microphone/sound functions
    By ivanbin in forum Client Support
    Replies: 0
    Last Post: May 10th, 2011, 09:14 PM
  3. Replies: 8
    Last Post: November 3rd, 2010, 07:56 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •