How to access audio waveform buffer when recording using WASAPI in c++?

302 views Asked by At

I've used winmm library to access the waveform information before with syntax like this waveInAddBuffer(hwi, &wh[i], sizeof(WAVEHDR)); So I've to pass the pointer that point to the memory block (&wh[i]) where I want to store the waveform data, In order to access it I just have do this wh[i].lpData
Are there a similar function like this in WASAPI?

1

There are 1 answers

0
Roman Ryltsov On BEST ANSWER

It's IAudioCaptureClient::GetBuffer method:

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.

See also:

For a code example that calls the GetBuffer method, see Capturing a Stream.