Namespace: Un4seen.Bass.AddOn.Mix
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
public delegate void SYNCPROCEX( int handle, int channel, int data, IntPtr user, long offset )
Parameters
- handle
- Type: SystemInt32
The sync handle that has occured (as returned by BASS_Mixer_ChannelSetSyncEx(Int32, BASSSync, Int64, SYNCPROCEX, IntPtr)). - channel
- Type: SystemInt32
The channel that the sync occured on (the mixer source channel). - data
- Type: SystemInt32
Additional data associated with the sync's occurance. - user
- Type: SystemIntPtr
The user instance data given when BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) was called. - offset
- Type: SystemInt64
The offset in bytes containing the position of the sync occurrence within the update cycle converted to the mixer stream.
A sync callback function should be very quick as other syncs can't be processed until it has finished. Attribute slides (BASS_ChannelSlideAttribute(Int32, BASSAttribute, Single, Int32)) are also performed by the sync thread, so are also affected if a sync callback takes a long time.
If the sync is a "mixtime" sync (BASS_SYNC_MIXTIME), then depending on the sync type, the callback will be executed in the update thread. The offset specifies the position of the sync within the update buffer converted to the mixer stream position. Note that the offset is based on the mixer's sample format, so you'll need to convert that to the source's format if using the sync to trigger things on the source.
The usual restrictions on which BASS functions can be called that apply to stream callbacks (STREAMPROC) also apply here. It is also unsafe to call BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) on the same channel from a mixtime sync callback. BASS_ChannelSetPosition(Int32, Int64, BASSMode) can be used in a mixtime sync 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.