DemoGL::Reference::Functions::DEMOGL_SoundSystemSyncCreate

DEMOGL_SoundSystemSyncCreate

DEMOGL_SoundSystemSyncCreate creates a synchronize object on a given channel that will send a WM_DEMOGL_SOUNDSYSTEMSYNC message to all effect objects which Message handler is enabled. DemoGL supports synchronize objects on channels which data is owned by elements of type DGL_SS_MODELEMENT and DGL_SS_MP3ELEMENT.

int
DEMOGL_SoundSystemSyncCreate(
	const int iChannelCodeID,
	const DWORD dwSyncType, 
	const DWORD dwSyncParam,
	const DWORD dwSyncFlag
);
	
Parameters.
iChannelCodeID
Specifies the ChannelCodeID of the channel on which the new synchronize object should be created.
dwSyncType
Specificies the type of the synchronize object. The legal values for dwSyncType are explained with the dwSyncParam explanation below.
dwSyncParam
Specifies the parameter for the dwSyncType. Below are the different sync types and what dwSyncParam means with that particular sync type.

Sync type Description dwSyncParam meaning
BASS_SYNC_MUSICPOS Synchronize object that will be triggered when the channel playing the DGL_SS_MODELEMENT data reaches a given position. This position is passed in dwSyncParam. The WM_DEMOGL_SOUNDSYSTEMSYNC message send when the synchronize object is triggered will have the position stored as the LPARAM value, in the format: LOWORD = pattern order, HIWORD = row in that pattern. LOWORD = pattern order (0=first, -1=all), HIWORD = row in pattern (0=first, -1=all).
BASS_SYNC_POS Synchronize object that will be triggered when the channel playing the DGL_SS_MP3ELEMENT data reaches a given position. This position is passed in dwSyncParam. The WM_DEMOGL_SOUNDSYSTEMSYNC message send when the synchronize object is triggered will have the position stored as the LPARAM value, with the position in bytes. Position in bytes.
BASS_SYNC_MUSICINST Synchronize object that will be triggered when the channel playing the DGL_SS_MODELEMENT data plays a certain instrument (sample for the MOD/S3M/MTM formats) music (retrigs of samples / instruments not included). This instrument is passed in dwSyncParam. The WM_DEMOGL_SOUNDSYSTEMSYNC message send when the synchronize object is triggered will have the instrument plus volume stored as the LPARAM value, in the format: LOWORD = note, HIWORD = volume of that note (0-64) LOWORD = instrument (1=first), HIWORD = note (0=c0...119=b9, -1=all).
BASS_SYNC_END Synchronize object that will be triggered when the channel playing the DGL_SS_MODELEMENT data reaches the end. Note that some MOD/S3M/IT/XM/MTM musics never reach the end, they may jump to another position first. Not used, can be 0.
BASS_SYNC_MUSICFX Synchronize object that will be triggered when the channel playing the DGL_SS_MODELEMENT data plays the sync effect in a MOD/S3M/XM/IT/MTM music. The sync effect is E8x for the XM/MTM/MOD formats, and S0x for the IT/S3M formats (where x = a value in the range [0,F], hexadecimal). dwSyncParam specifies what to return as LPARAM parameter in the WM_DEMOGL_SOUNDSYSTEMSYNC message. dwSyncParam can have 2 values, 0 or 1. 0 means: the position is passed back as LPARAM parameter in the WM_DEMOGL_SOUNDSYSTEMSYNC message. Format of that position is: LOWORD = pattern order, HIWORD = row in that pattern)
1 means: the value of x is passed back as LPARAM parameter in the WM_DEMOGL_SOUNDSYSTEMSYNC message.

dwSyncFlag
Specifies a DWORD value that will be passed back as WPARAM of the WM_DEMOGL_SOUNDSYSTEMSYNC message when the synchronize object is triggered. You can check which synchronize object did send the received WM_DEMOGL_SOUNDSYSTEMSYNC message by testing on the dwSyncFlag.

Return values.
If the function succeeds, it returns the SyncID, which is the unique ID a synchronize object can be referenced by in other DemoGL API functions concerning synchronize objects.
If the function fails, it returns one of the following error codes:

Error code Description
DGL_SS_ERR_COULDNTCREATESYNC The synchronize object could not be created, possibly because the underlying lower level sound library reported an error or the type of the element which owns the data played through the channel given is not compatible with synchronizers.
DGL_SS_ERR_CHANNELNOTINUSE The iChannelCodeID value is not found as an active channel.

Remarks.
DemoGL supports synchronizer objects on channels which are playing data owned by elements of type DGL_SS_MODELEMENT and DGL_SS_MP3ELEMENT. When an effect object wants to use a trigger, it should enable its Message Handler by calling DEMOGL_MessageHandlerEnable otherwise the message sent by the synchronize object executor, WM_DEMOGL_SOUNDSYSTEMSYNC will not be posted to the effect object. All active effect objects, thus currently running on visible layers, with enabled message handlers will receive this message, even if they didn't create the synchronize object. When the user switches off music, there is no playing of any sound element is performed, thus there are no sound channels, and thus there will be no synchronize objects.

Example.

Requirements.
DemoGL v1.3 (build 0112 or higher). When using syncing on DGL_SS_MP3ELEMENTs, you need DemoGL v1.31.923 or higher.

See also.
DEMOGL_MessageHandlerEnable, WM_DEMOGL_SOUNDSYSTEMSYNC, _SOUNDSYSTEM commands

Last changed on 23-sep-2001

©1999-2001 Solutions Design