0

I use the applicationloopbackaudio-sample to record system audio, it works fine. However, the capture format is hard coded:

 // The app can also call m_AudioClient->GetMixFormat instead to get the capture format.
 // 16 - bit PCM format.
 m_CaptureFormat.wFormatTag = WAVE_FORMAT_PCM;
 m_CaptureFormat.nChannels = 2;
 m_CaptureFormat.nSamplesPerSec = 44100;
 m_CaptureFormat.wBitsPerSample = 16;
 m_CaptureFormat.nBlockAlign = m_CaptureFormat.nChannels * m_CaptureFormat.wBitsPerSample / 8;
 m_CaptureFormat.nAvgBytesPerSec = m_CaptureFormat.nSamplesPerSec * m_CaptureFormat.nBlockAlign;

according to the comment, I can use m_AudioClient->GetMixFormat to get the capture format, but it failed with error code: E_NOTIMPL

 WAVEFORMATEX* pWfxOut = NULL;
 HRESULT hr = m_AudioClient->GetMixFormat(&pWfxOut);
 // hr is E_NOTIMPL, failed to GetMixFormat

I'd like to know:

  1. why does this happen?
  2. how should I get the valid capture format supported by System? Many thanks.

Environment: Visual Studio 2019, Windows SDK20348

TianpingHsu
  • 91
  • 2
  • 5

0 Answers0