Sets up a synchronizer on a mixer source channel.

HSYNC BASS_Mixer_ChannelSetSync(
    DWORD handle,
    DWORD type,
    QWORD param,
    SYNCPROC *proc,
    void *user


handleThe channel handle.
typeThe type of sync. This can be one of the standard sync types, as available via BASS_ChannelSetSync, or one of the mixer specific sync types listed below.
paramThe sync parameter.
procThe callback function.
userUser instance data to pass to the callback function.

Sync types, with param and SYNCPROC data definitions.

BASS_SYNC_MIXER_ENVELOPESync when an envelope ends. This is not triggered by looping envelopes.
param : envelope type to sync on, 0 = all types. data : envelope type.
BASS_SYNC_MIXER_ENVELOPE_NODESync when an envelope reaches a new node.
param : envelope type to sync on, 0 = all types. data : LOWORD = envelope type, HIWORD = node number.
BASS_SYNC_STALLSync when mixing of the channel is stalled/resumed. This is like the standard BASS_SYNC_STALL sync, except it can be either mixtime or not.
param : not used. data : 0 = stalled, 1 = resumed.

Return value

If successful, then the new synchronizer's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEThe channel is not plugged into a mixer.
BASS_ERROR_ILLTYPEAn illegal type was specified.
BASS_ERROR_ILLPARAMAn illegal param was specified.


When used on a decoding channel (eg. a mixer source channel), syncs set with BASS_ChannelSetSync are automatically "mixtime", which means that they will be triggered as soon as the sync event is encountered. But if the mixer output is being played, then there is a playback buffer involved, which will delay the hearing of the sync event. This function compensates for that, delaying the triggering of the sync until the event is actually heard.

Sync types that would automatically be mixtime when using BASS_ChannelSetSync are not so when using this function. The BASS_SYNC_MIXTIME flag should be specified in those cases, or BASS_ChannelSetSync used instead.

If the mixer itself is a decoding channel, or the BASS_SYNC_MIXTIME flag is used, then there is effectively no real difference between this function and BASS_ChannelSetSync, except for the mixer specific sync types listed above.

When a source is removed from a mixer, any syncs that have been set on it via this function are automatically removed. If the channel is subsequently plugged back into a mixer, the previous syncs will not still be set on it. Syncs set via BASS_ChannelSetSync are unaffected.

See also


BASS_ChannelSetSync, SYNCPROC callback