since this is my first post, let me thank you for this piece of SW that you give away for free, for us to play around with it, thanks! 😀
That said, let's get to my problem, I'm trying to write a small Alarm to wake me up in the morning with a song I like, I'm doing that on a WIN2K machine, with VB6(SP5) and FMOD 3.63.
I’m trying to use the STREAM END callback, but when the song finishes my application crashes and returns me an Access Violation error in MSVBVM60.DLL, as anyone had the same problem?
– Am I doing something wrong in the code?
– Do I need to create an in-memory stream to attach a callback to it or can I just use the stream returned from Stream_OpenFile() ?
– Do I have to do anything more then calling Stream_SetSynchCallback?
Below you’ll find the code of the 2 procs…they both reside in the same module.
Public Function END_STREAMCALLBACK(ByVal FSOUND_STREAM As Long, ByVal buf As Long, ByVal lenght As Long, ByVal param As Long) As Long
Public Sub playAlarm2(songfile As String)
Dim x As Byte
hdFileToPlay = FSOUND_Stream_OpenFile(songfile, FSOUND_2D, 0)
x = FSOUND_Stream_SetEndCallback(hdFileToPlay, AddressOf END_STREAMCALLBACK, 0) If (CBool(x)) = False Then MsgBox "Error setting end callback..." & vbCrLf End If MsgBox "END callback set." & CBool(x) If hdFileToPlay = 0 Then MsgBox "Error while opening file" & vbCrLf & FSOUND_GetErrorString(FSOUND_GetError) End If intChannel = FSOUND_Stream_Play(FSOUND_FREE, hdFileToPlay) 'MsgBox "After song starts playing..." If (intChannel = -1) Then MsgBox "An error occurred playing the file!", , "Error..." End If
P.S. Am I allowed a little criticism? A little more work on the Docs?
<- Riki ->
- Riki asked 13 years ago
I’m not shure what it is. When using a stop statement at the beginning of the callback functions, it works till that point, but Visual Basic crashes as soon I continue.
When using without stop statement, the same error occurs, but my player reacts and even loads the next song.
- Anonymous answered 13 years ago
I´m not sure what happen, but my program work nice in VB. When build an .exe and test it crashes when call FSOUND_Stream_SetEndCallback.
It only happen in .exe, not in VB. Any suggestion?
Other question, when use FSOUND_Stream_Close, it call FSOUND_Stream_SetEndCallback?
Please login first to submit.