BASS_Mixer_ChannelSetSync
Sets up a synchronizer on a mixer source channel.
HSYNC BASS_Mixer_ChannelSetSync( DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user );
Parameters
handle | The channel handle. |
type | The 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. |
param | The sync parameter. |
proc | The callback function. |
user | User instance data to pass to the callback function. |
Sync types, with param and SYNCPROC data definitions.
BASS_SYNC_MIXER_ENVELOPE | Sync 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_NODE | Sync 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_STALL | Sync 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_HANDLE | The channel is not plugged into a mixer. |
BASS_ERROR_ILLTYPE | An illegal type was specified. |
BASS_ERROR_ILLPARAM | An illegal param was specified. |
Remarks
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.