DirectX callback problem
kmesse_at_lycos.com
Date: 02/11/05
- Next message: Chris P. [MVP]: "Re: SetStartPoint does not work (directmusic)"
- Previous message: john: "SetStartPoint does not work (directmusic)"
- Messages sorted by: [ date ] [ thread ]
Date: 11 Feb 2005 03:24:01 -0800
Conext: Writing a program that will play an array of wav files in
sequence. I use
DSNotification to alert me when one is done. I know very little about
this and am using a tutorial program, but the tutorial writer hasn't
delved this deeply into it.
In the module, this is triggered when a sound stops:
Public Function DXCallback(ByVal eventid As Long) As Integer
'Find the sound that caused this event to be triggered
For iLoop = 4 To 7
If Sound(iLoop).DSNotification = eventid Then
Exit For
End If
Next
DXCallback = iLoop ' Return the ID
End Function
I'm supposed to get the element of the array that triggered it. On the
form:
Private Sub DirectXEvent_DXCallback(ByVal eventid As Long)
Dim RetID As Integer
'This event is triggered when a sound buffer reaches the position
specified
by DSPosition
RetID = DSound.DXCallback(eventid) ' get which sound triggered the
event
If LastSequence = NextSequence Then Exit Sub ' exit if it's same #
DSound.StopSound Sound(LastSequence).SoundID ' stop current sound
DSound.PlaySound Sound(NextSequence).SoundID ' play the next one
LastSequence = NextSequence
End Sub
When I run this, and debug.print the value of retID, it always returns
all 3 elements:
0
1
2
0
1
2
Instead of the one selected.
can anyone help? How does this callback thing work? Are there any
tutorials on the web that go into this depth?
Kevin
- Next message: Chris P. [MVP]: "Re: SetStartPoint does not work (directmusic)"
- Previous message: john: "SetStartPoint does not work (directmusic)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|