User defined output/input processing callback function.
DWORD CALLBACK WasapiProc( void *buffer, DWORD length, void *user );
buffer | Pointer 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. |
length | The number of bytes to process. |
user | The user instance data given when BASS_WASAPI_Init was called. |
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.
DWORD CALLBACK OutputWasapiProc(void *buffer, DWORD length, void *user) { int c=BASS_ChannelGetData(decoder, buffer, length); if (c<0) { // at the end if (!BASS_WASAPI_GetData(NULL, BASS_DATA_AVAILABLE)) // check no buffered data remaining BASS_WASAPI_Stop(FALSE); // stop the output return 0; } return c; }