Sets up a synchronizer on a MOD music or file stream channel.
HSYNC WINAPI BASS_ChannelSetSync( |
Parameters
handle | The channel handle... a HMUSIC or HSTREAM. | ||||
type | The type of sync (see the table below), you may also use these flags.
| ||||
param | The sync parameters, depends on the sync type... see the table below. | ||||
proc | The callback function. | ||||
user | User instance data to pass to the callback function. |
Sync types, with param and SYNCPROC data definitions.
BASS_SYNC_MUSICPOS | Sync when a MOD music reaches a position. param : LOWORD = order (0=first, -1=all), HIWORD = row (0=first, -1=all). data : LOWORD = order, HIWORD = row. |
BASS_SYNC_MUSICINST | Sync when an instrument (sample for the MOD/S3M/MTM formats) is played in a MOD music (not including retrigs). param : LOWORD = instrument (1=first), HIWORD = note (0=c0...119=b9, -1=all). data : LOWORD = note, HIWORD = volume (0-64). |
BASS_SYNC_END | Sync when a MOD music or file stream reaches the end. Note that some MOD musics never reach the end, they may jump to another position first. param : not used. data : not used. |
BASS_SYNC_MUSICFX | Sync when the sync effect is used in a MOD music. The sync effect is E8x for the XM/MTM/MOD formats, and S0x for the IT/S3M formats (where x = any value).param : 0 = the position is passed to the callback (data : LOWORD = order, HIWORD = row), 1 = the value of x is passed to the callback (data : x value).
|
Return value
If succesful, then the new synchronizer's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_NOSYNC | Synchronizers have been disabled... the BASS_DEVICE_NOSYNC flag was used with BASS_Init. |
BASS_ERROR_HANDLE | handle is not a valid channel. |
BASS_ERROR_ILLPARAM | An illegal param was specified. |
BASS_ERROR_ILLTYPE | An illegal type was specified. |
Remarks
Multiple synchronizers may be used per channel. Use BASS_ChannelRemoveSync to remove a synchronizer. If the BASS_SYNC_ONETIME flag is used, then the sync is automatically removed after it's occured (ie. there's no need to remove it manually).
The channel does not have to be playing to set a synchronizer, you can set synchronizers before or while playing. There is only one case where you can not set a synchronizer, and that is from within a callback function. But you can remove synchronizers at any time, including from inside a callback function.
The BASS_SYNC_MIXTIME flag is only really useful for using a sync to switch DSP functions on/off. You could, for example, use a BASS_SYNC_MUSICFX sync to switch a reverb effect on/off on a MOD music.
Example
To do some processing until a MOD music reaches the 10th order.
BOOL order10=FALSE; // the order 10 flag |
See also
BASS_ChannelRemoveSync, SYNCPROC callback