0

I'm hooking into IAudioClient and IAudioRenderClient to retrieve the raw audio buffer. To determine the format I call GetMixFormat on the client before. This works fine for most applications like games or Flash Player in Firefox.

However, audio captured from Google Chrome (Flash) is distorted. I've attached a short sample of the same audio stream captured from Firefox and Google Chrome. GetMixFormat() reports IEEE_FLOAT, 2 channels at 48k for both. But when importing them in Audacity and using those parameters, only the Firefox one plays well. In fact, to get the graph looking correctly on the Chrome one, I have to import it as Signed PCM (still distorted though).

Any ideas why GetMixFormat is wrong or what format the Google Chrome snippet is using?

As a side note, I found out that the Chrome sample contains 1 full frame (0xF00 bytes) and then only half a frame (0x780 bytes) and the rest filled with zeros, even though the functions report to have written 0xF00 bytes. But even when removing that zero data, I can't get anywhere. Is Chrome somehow altering the buffer?

Files:

Any help is much appreciated! Thanks in advance.

1 Answer 1

1

Okay I kind of fixed the issue with GetMixFormat by directly reading the WAVEFORMATEX from the audio client instance. It's version dependent though... This is how it works for Win 8:

        mov     eax, pAudioClient
        mov     eax, [eax + 0x7C]
        mov     eax, [eax + 0x3C]
        mov     edi, eax
        mov     eax, [edi - 50h]
        add     eax, 0xA0
        mov     waveFormatEx, eax

This also got me the correct frame size, which was my core issue when grabbing the buffer. Playing it in 16bit PCM mode works fine now.

I tried to adapt it to Win 7, but the Audioses.dll differs a lot, so this might take some more time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.