BASS

RECORDPROC callback


User defined callback function to process recorded sample data.

BOOL CALLBACK RecordProc(
    HRECORD handle,
    const void *buffer,
    DWORD length,
    void *user
);

Parameters

handleThe recording that the data is from.
bufferPointer to the recorded sample data. The sample data is in standard Windows PCM format, that is 8-bit samples are unsigned, 16-bit samples are signed, 32-bit floating-point samples range from -1 to +1.
lengthThe number of bytes in the buffer.
userThe user instance data given when BASS_RecordStart was called.

Return value

Return FALSE to stop recording, and anything else to continue recording.

Remarks

BASS_RecordFree should not be used to free the recording device within a recording callback function. Nor should BASS_ChannelStop be used to stop the recording; return FALSE to do that instead.

Example

A callback function to write the recorded data to disk.
BOOL CALLBACK MyRecordProc(HRECORD handle, const void *buffer, DWORD length, void *user)
{
    fwrite(buffer, 1, length, (FILE*)user); // write the buffer to the file
    return TRUE; // continue recording
}
...
HRECORD record=BASS_RecordStart(44100, 2, 0, MyRecordProc, file); // start recording

See also

BASS_RecordStart