FPC_SetSoundListener
Syntax
typedef HRESULT (WINAPI *PSOUNDLISTENER)(
HFPC hFPC,
LPARAM lParam,
PWAVEFORMATEX pWaveFormat,
LPWAVEHDR pWaveHeader,
UINT nHeaderSize
);
DWORD WINAPI FPC_SetSoundListener(
HFPC hFPC,
PSOUNDLISTENER pSoundListener,
LPARAM lParam
);
Description
The FPC_SetSoundListener
function registers a handler that is invoked every time Flash produces audio output.
The callback receives:
pWaveFormat
— a pointer to a WAVEFORMATEX structure describing the audio format (sample rate, channels, etc.).pWaveHeader
— a pointer to a WAVEHDR buffer containing raw sound data.nHeaderSize
— the size of the buffer.
This enables capturing, processing, or redirecting Flash audio in real time.
Example
// Example: simple sound listener
HRESULT WINAPI MySoundListener(
HFPC hFPC,
LPARAM lParam,
PWAVEFORMATEX pWaveFormat,
LPWAVEHDR pWaveHeader,
UINT nHeaderSize)
{
// Inspect format
printf("Channels: %d, Samples per sec: %lu\n",
pWaveFormat->nChannels,
pWaveFormat->nSamplesPerSec);
// Access audio buffer
BYTE* pData = (BYTE*)pWaveHeader->lpData;
DWORD dwLength = pWaveHeader->dwBufferLength;
// Example: mute by zeroing out data
ZeroMemory(pData, dwLength);
return S_OK;
}
...
// Register the listener
DWORD cookie = FPC_SetSoundListener(hFPC, &MySoundListener, 0);