SYNCPROC callback

User defined synchronizer callback function.

void CALLBACK SyncProc(
    HSYNC handle,
    DWORD channel,
    DWORD data,
    void *user
);

Parameters

handleThe sync that has occurred.
channelThe channel that the sync occurred on.
dataAdditional data associated with the sync's occurrence.
userThe user instance data given when BASS_ChannelSetSync was called.

Remarks

BASS creates a single thread dedicated to executing sync callback functions, so a callback function should be quick as other syncs cannot be processed until it has finished. Attribute slides (initiated with BASS_ChannelSlideAttribute) are also performed by the sync thread, so are also affected if a sync callback takes a long time.

"Mixtime" syncs are usually not executed in the sync thread (unless the BASS_SYNC_THREAD flag is used) but rather immediately in whichever thread triggers them. In most cases that will be an update thread, and so the same restrictions that apply to stream callbacks (STREAMPROC) also apply here, except that BASS_ChannelStop can be used in a BASS_SYNC_POS sync's callback to stop a channel at a particular position. Other exceptions are that the channel can be freed in a BASS_SYNC_DEV_FAIL or BASS_SYNC_DEV_FORMAT or BASS_SYNC_SLIDE sync's callback.

BASS_ChannelSetPosition can be used in a mixtime sync (without BASS_SYNC_THREAD set) to implement custom looping, eg. set a BASS_SYNC_POS sync at the loop end position and seek to the loop start position in the callback.

See also

BASS_ChannelSetSync