delay question

BlitzMax Forums/BlitzMax Programming/delay question

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Klepto2's example should have worked. Are you sure you implemented it correctly?

Here's a more complete example...
Strict

Graphics 800, 600, 0

Local MaxPath$ = getenv_("BMXPATH")
Local Channel:TChannel
Local SoundStarted = False
Local Counter
Local Sound:TSound = LoadSound(MaxPath$ + "/samples/digesteroids/sounds/teleport.wav")
Local scale#
 
Repeat
    Cls
    
    If KeyHit(Key_Tab) And (Not SoundStarted)
         Channel = PlaySound(Sound)
        SoundStarted = True
    EndIf

    If SoundStarted And (Not ChannelPlaying(Channel))
        Counter :+ 1
        SetColor Rand(255), Rand(255), Rand(255)
        SoundStarted = False
    EndIf
    
    DrawCentredText "Sound played " + Counter + " times", 400, 250
    DrawCentredText "Millisecs = " + MilliSecs(), 400, 350
    
    Flip
    FlushMem
Until KeyHit(KEY_ESCAPE)

End


Function DrawCentredText(text$, x, y)
    DrawText text$, x - (TextWidth(text$) / 2.0), y - (TextHeight(text$) / 2.0)
End Function