BASS.NET API for the Un4seen BASS Audio Library

BassMixBASS_Mixer_ChannelSetSync Method

BASS.NET API for the Un4seen BASS Audio Library
Sets up a synchronizer on a mixer source channel.

Namespace:  Un4seen.Bass.AddOn.Mix
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[DllImportAttribute("bassmix")]
public static int BASS_Mixer_ChannelSetSync(
	int handle,
	BASSSync type,
	long param,
	SYNCPROC proc,
	IntPtr user
)

Parameters

handle
Type: SystemInt32
The mixer source channel handle (which was add via BASS_Mixer_StreamAddChannel(Int32, Int32, BASSFlag) or BASS_Mixer_StreamAddChannelEx(Int32, Int32, BASSFlag, Int64, Int64)) beforehand).
type
Type: Un4seen.BassBASSSync
The type of sync (see BASSSync for details). This can be one of the standard sync types, as available via BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr), or one of the mixer specific sync types listed below plus one of the following flags:
BASS_SYNC_ONETIMECall the sync only once, and then remove it from the channel.
BASS_SYNC_MIXTIMECall the sync function when the sync occurs during decoding/mixing, instead of delaying the call until the sync is actually heard. This is automatically applied with decoding channels, as they can not be played/heard.
param
Type: SystemInt64
The sync parameters, depends on the sync type (see BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) or BASSSync for details).
proc
Type: Un4seen.BassSYNCPROC
The callback function which should be invoked with the sync.
user
Type: SystemIntPtr
User instance data to pass to the callback function.

Return Value

Type: Int32
If succesful, then the new synchronizer's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

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.

data : LOWORD = envelope type, HIWORD = node number.

BASS_SYNC_STALLThis is like the standard BASS_SYNC_STALL sync, except it can be either mixtime or not.

param : not used.

data : 0 = stalled, 1 = resumed.

When used on a decoding channel (eg. a mixer source channel), syncs set with BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) are automatically "mixtime", which means that they will be triggered as soon as the sync event is encountered during decoding. 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. 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(Int32, BASSSync, Int64, SYNCPROC, IntPtr). One sync type that is slightly different is the BASS_SYNC_STALL sync, which can be either mixtime or not.

Sync types that would automatically be mixtime when using BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) are not so when using this function. The BASS_SYNC_MIXTIME flag should be specified in those cases, or BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) 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(Int32, BASSSync, Int64, SYNCPROC, IntPtr) are unaffected.

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

Examples

See SYNCPROC for an example on how to use synchronizers.
See Also

Reference