I’m using VB6 on WinXP. I’m trying to get setendcallback to call a function when an OGG file ends (a music track). The music file plays just fine, and while it’s playing I always get streamChannel = 4096 and stream = 0. When the track ends, I STILL get streamChannel = 4096 and stream = 0. I expected for stream <> 0 while the track is playing, changing to 0 when it ends, but that’s not the case. And likewise I expected streamchannel = 4096 (or something) while playing and 0 when ended, but also not so. My function is a routine to start another track playing, but it never gets executed. I’ve put a breakpoint on the first line of my routine and program execution never gets to that point. It seems to me that this doesn’t work because stream and streamChannel never change, even when the track ends. Can anybody help shed some light on this? Am I missing something obvious?
BTW: I have not compiled to test exe, this is all happening in the IDE.
LOADS of THANKS in advance to anyone who can help me with this!
(new fmod user)
Here’s how I set it up:
declaration (in fmod.bas):
Public Declare Function FSOUND_Stream_SetEndCallback Lib “fmod.dll” _
Alias “_FSOUND_Stream_SetEndCallback@12” (ByVal stream As Long, _
ByVal callback As Long, ByVal userdata As Long) As Byte
stream open, play, and setendcallback (on a form, activated by clicking a label):
‘nothing is currently playing, play track now
If streamChannel = 0 Then
‘open a stream to play OGG
streamHandle = FSOUND_Stream_Open(OGGFile$, FSOUND_NORMAL, 0, 0)
‘start stream playing
streamChannel = FSOUND_Stream_Play(FSOUND_FREE, streamHandle)
‘set fmod to callback at track end
FSOUND_Stream_SetEndCallback stream, AddressOf TrackEnd, 0
‘something is already playing…
‘add track to playlist
- Nemesis asked 13 years ago
Hm, seems you don’t know what you’re doing?
stream_open returns the handle for your stream
stream_play returns the channel on wich your stream is played (needed for some other functions)
SetEndCallBack tells fmod which function (addressof…) to be called when the according stream has ended)
Please login first to submit.