DirectX callback problem

kmesse_at_lycos.com
Date: 02/11/05


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



Relevant Pages

  • Re: What other MMORPGs do you guys and gals play?
    ... tutorials, a help system I couldn't figure out how to access on my own, ... I like Eve, personally. ... to play to gain rep and money to make your character more powerful. ...
    (alt.games.warcraft)
  • Re: Delay in execution when Button is clicked.
    ... When I click the play button, my program Reads the WAV file in chunks ... of 1024bytes and stores them in a static array. ... On clicking the Pause button the file being played should be Paused. ... You have a loop for reading the file, and you have a loop for refilling the array. ...
    (microsoft.public.vc.mfc)
  • Re: Delay in execution when Button is clicked.
    ... When I click the play button, my program Reads the WAV file in chunks ... of 1024bytes and stores them in a static array. ... On clicking the Pause button the file being played should be Paused. ... because as long as this loop is running in the main GUI thread, ...
    (microsoft.public.vc.mfc)
  • Re: Using arrays to herd PC choice
    ... maybe you have a campaign in mind where certain races and classes would ... Sure, players could still play Dwarves, Gnomes, Halflings, and various ... Use a PC Array: ... If you wish to play a character with a higher ECL than starting level ...
    (rec.games.frp.dnd)
  • Re: WEIRD problem with CD player
    ... This assy appears to have the Laser and photodiode array swapped ... It will only START in the tilted position, but will continue to play ...
    (sci.electronics.repair)