WASAPIPROC callback


User defined output/input processing callback function.

DWORD CALLBACK WASAPIPROC(
    void *buffer,
    DWORD length,
    void *user
);

Parameters

bufferPointer to the buffer to put the sample data for an output device, or to get the data from an input device. The sample data is always 32-bit floating-point.
lengthThe number of bytes to process.
userThe user instance data given when BASS_WASAPI_Init was called.

Return value

In the case of an output device, the number of bytes written to the buffer. In the case of an input device, 0 = stop the device, else continue.

Remarks

An output/input processing function should obviously be as quick as possible, to avoid buffer underruns (output) or overruns (input). Using a larger buffer makes that less crucial. BASS_WASAPI_GetData (BASS_DATA_AVAILABLE) can be used to check how much data is buffered.

If an output device has been initialized to use exclusive mode and less data than requested is returned, the remainder of the buffer will be filled with silence.

Do not call BASS_WASAPI_Free from within a callback function.

BASS_WASAPI_GetDevice can be used by the callback function to check which device it is dealing with.

See also

BASS_WASAPI_Init, BASS_WASAPI_PutData