在 C++ 中使用 WASAPI 录制时如何访问音频波形缓冲区?
How to access audio waveform buffer when recording using WASAPI in c++?
我之前使用 winmm 库访问波形信息,语法如下 waveInAddBuffer(hwi, &wh[i], sizeof(WAVEHDR));
所以我必须传递指向我想要的内存块 (&wh[i]) 的指针存储波形数据,为了访问它,我只需要这样做 wh[i].lpData
WASAPI中有类似的功能吗?
这是IAudioCaptureClient::GetBuffer
方法:
Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
[…]
BYTE **ppData
Pointer to a pointer variable into which the method writes the starting address of the next data packet that is available for the client to read.
另请参阅:
For a code example that calls the GetBuffer method, see Capturing a Stream.
我之前使用 winmm 库访问波形信息,语法如下 waveInAddBuffer(hwi, &wh[i], sizeof(WAVEHDR));
所以我必须传递指向我想要的内存块 (&wh[i]) 的指针存储波形数据,为了访问它,我只需要这样做 wh[i].lpData
WASAPI中有类似的功能吗?
这是IAudioCaptureClient::GetBuffer
方法:
Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
[…]
BYTE **ppData
Pointer to a pointer variable into which the method writes the starting address of the next data packet that is available for the client to read.
另请参阅:
For a code example that calls the GetBuffer method, see Capturing a Stream.