GetSoundPosition()
Syntax
Result = GetSoundPosition(#Sound [, Mode [, Channel]])Description
Get the current sound position.
Parameters
#Sound The sound to use. Mode (optional) The mode used to get the position. It can be one of the following value: #PB_Sound_Frame : the position is returned in frame (default). #PB_Sound_Millisecond: the position is returned in milliseconds.Channel (optional) The channel to get the position. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag.
Return value
The current sound position or -1 if an error occurred.
Remarks
Sounds loaded with the #PB_Sound_Streaming flag are not supported.
Example
InitSound() ; Initialize Sound system
UseOGGSoundDecoder() ; Use ogg files
; Loads 2 sounds
LoadSound(0, #PB_Compiler_Home +"Examples\3D\Data\Siren.ogg")
LoadSound(1, #PB_Compiler_Home +"Examples\3D\Data\Roar.ogg")
; The siren is playing
PlaySound(0)
; Display the position
Repeat
Pos=GetSoundPosition(0, #PB_Sound_Millisecond)
Delay(100) ; Wait 100 ms
Debug Pos ; Display the position
If Pos>1000 ; Stop after 1 second
Break
EndIf
ForEver
; Then 2 sounds are playing together
PlaySound(1)
MessageRequester("Info", "Ok to stop.")
End
See Also
SetSoundPosition()
Supported OS
All