Author Topic: MOD Music Position Sync  (Read 2042 times)

Irrational86

  • Posts: 960
MOD Music Position Sync
« on: 15 Jun '03 - 14:15 »
Is there a way to sync a HMUSIC channel to a position in time. For example, I want a sync to trigger 2 seconds before the HMUSIC channel is done playing, how do i manage that??

Ian @ un4seen

  • Administrator
  • Posts: 21987
Re: MOD Music Position Sync
« Reply #1 on: 15 Jun '03 - 19:54 »
You could try something like this...
Code: [Select]
// load music using BASS_MUSIC_CALCLEN flag, and then...
length=BASS_ChannelBytes2Seconds(hmusic,BASS_MusicGetLength(hmusic,TRUE));
BASS_ChannelSetPosition(hmusic,MAKELONG(length-2,0xFFFF));
syncpos=BASS_ChannelGetPosition(hmusic);
hsync=BASS_ChannelSetSync(hmusic,BASS_SYNC_POS,syncpos,...);
BASS_ChannelSetPosition(hmusic,0); // rewind ready for playback

This is unlikely to sync exactly 2 seconds from the end, but it should generally be within a second of that :)

The other option is to use a decoding channel + custom stream, to effectively turn the MOD into a stream.