locked
What are supported sample rates for WASAPI Initialize

    Question

  • Hi....

    MSDN (http://msdn.microsoft.com/en-us/library/windows/desktop/dd390970(v=vs.85).aspx) says below sample rates are supported for PCM

    "If wFormatTag is WAVE_FORMAT_PCM, then common values for nSamplesPerSec are 8.0 kHz, 11.025 kHz, 22.05 kHz, and 44.1 kHz. "

    When I tried the below code, with sample rate 8.0kHz,  Initialize returns 0x88890008

    11.025 kHz, 22.05 kHz, and 44.1 kHz also gives error!!

    Only 48 KHz is working for me..Please help me to understand the scenario.

    m_MixFormat->nSamplesPerSec = 8000;
    m_MixFormat->wFormatTag = WAVE_FORMAT_PCM;
    m_MixFormat->wBitsPerSample = 16;
    MixFormat->nBlockAlign = m_MixFormat->nChannels * 2;    
    m_MixFormat->nAvgBytesPerSec = m_MixFormat->nSamplesPerSec * m_MixFormat->nBlockAlign;
    m_MixFormat->cbSize = 0;
    
         
    hr = m_AudioClient->Initialize( AUDCLNT_SHAREMODE_SHARED,
                                            AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
                               200000,
                               0,
                               m_MixFormat,
                               nullptr );

    Thanks.


    a

    Monday, December 3, 2012 4:27 AM

All replies

  • Hello,
     
    Thanks for your feedback, I will involve more experts to investigate it.
     
    Best regards,
    Jesse

    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 5, 2012 11:27 AM
  • Hi Jesse Jiang,

    Thanks a lot for your reply. Please update on investigation..


    a

    Wednesday, December 5, 2012 1:41 PM
  • Hi,

    The return values for IAudioClient->Initialize are listed here http://msdn2.microsoft.com/en-us/library/ms678736.aspx

    The constants are defined in audioclient.h

    0x88890008 is AUDCLNT_E_UNSUPPORTED_FORMAT

    Perhaps your hardware or driver not support it. And you can use IAudioClient::IsFormatSupported method to discover whether the audio engine or audio endpoint device supports a particular format in that mode.


    Regards,
    Christian HL
    Microsoft Online Community Support


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Proposed as answer by Jesse Jiang Tuesday, December 11, 2012 2:20 AM
    Thursday, December 6, 2012 7:10 AM
  • Hi,

    IAudioClient::IsFormatSupported is giving not supported error code.

    Is it not possible to use sample rate of 8000Hz with WASAPI shared mode implementation???

    8000Hz is very basic and its needed for my project and I am interested to know the reason behind not supporting this?

    Waiting for response..

    Thanks


    a

    Wednesday, January 9, 2013 4:11 AM