Hi all,
I have a music player with a Seek slider. It uses a SYNCPROC (BASS_SYNC_END) callback when the song ends naturally and in that callback delegate the player is stopped and the Seek slider is reset etc.
This works fine 99% of the time, but every now and then the SyncEnd callback is never given, i.e. Sub SyncEndCallback (see code below) is never called, making the player appear to "hang", and the next playlist song never starts.
It is not a problem with any specific song file (MP3) because if you play that same file 10 times after that, it ends correctly. It appears to happen randomly.
I use a BassMix mixer stream for final output.
Does anybody have any ideas or advice perhaps, or maybe see an error in my code below?
Thanks a lot
'-module level
Public gMixer As Integer '-global BassMix MIXER channel
'-form level
Private strm As Integer
Private SyncEnd As SYNCPROC
'''
'-init strm and plug into mixer (gMixer has already been started)
strm = Bass.BASS_StreamCreateFile(CurrentSongPath, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT)
strm = BassFx.BASS_FX_TempoCreate(strm, BASSFlag.BASS_STREAM_DECODE Or BASSFlag.BASS_FX_FREESOURCE)
BassMix.BASS_Mixer_StreamAddChannel(gMixer, strm, BASSFlag.BASS_STREAM_AUTOFREE Or BASSFlag.BASS_MIXER_FILTER)
'-set up synchronizer callback
SyncEnd = New SYNCPROC(AddressOf SyncEndCallback)
BassMix.BASS_Mixer_ChannelSetSync(strm, BASSSync.BASS_SYNC_END Or BASSSync.BASS_SYNC_ONETIME, 0, SyncEnd, IntPtr.Zero)
...
Private Sub SyncEndCallback(ByVal handle As Integer, ByVal channel As Integer, ByVal data As Integer, ByVal user As IntPtr)
Player_Stop() '-stop player and reset slider etc
End Sub '-SyncEndCallback