locked
how can i capure just one channel buffer use WSAPI (WinRT)? RRS feed

  • Question

  • WAVEFORMATEX* pwfx = new WAVEFORMATEX();
    pwfx->wFormatTag = WAVE_FORMAT_PCM;
    pwfx->nSamplesPerSec = 44100;
    pwfx->wBitsPerSample = 16;
    pwfx->nChannels = 1;
    pwfx->nBlockAlign = pwfx->nChannels * pwfx->wBitsPerSample / 8;
    pwfx->nAvgBytesPerSec = pwfx->nBlockAlign * pwfx->nSamplesPerSec;
    pwfx->cbSize = 0;
            hr = m_AudioClient->Initialize( AUDCLNT_SHAREMODE_SHARED,
                                            AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
                                            200000,
                                            0,
                                            pwfx,
                                            nullptr );

    the code can't work if my audio device only have 1channel, m_AudioClient->Initialize get error 0x88890008

    it gets ok if my audio device has 2 channels.

    now i only want to get 1 channel buffer event the audio device has 2 channels, how can i do this?


    "waveInOpen" can do this use the same parameters, but the API can't use in Metro app

    Friday, October 19, 2012 3:58 PM

Answers