SetSoundPosition()

Syntax

SetSoundPosition(#Sound, Position, [, Mode [, Channel]])
Description
Set the current sound position.

Parameters

#Sound The sound to use.
Position The new position to set.
Mode (optional) The mode used to set the position. It can be one of the following value:
  #PB_Sound_Frame      : the position is specified in frame (default). 
  #PB_Sound_Millisecond: the position is specified in milliseconds.
Channel (optional) The channel to set the position. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag.

Return value

None.

Remarks

Sounds loaded with the #PB_Sound_Streaming flag are not supported.

Example

  If InitSound()           ; Initialize Sound system
    UseOGGSoundDecoder()   ; Use ogg files
    
    ; Loads a sound from a file
    If LoadSound(0, #PB_Compiler_Home + "Examples/3D/Data/Siren.ogg")
      
      ; The siren is playing
      PlaySound(0)
      
      ; Change the position at 2 seconds
      SetSoundPosition(0, 2000, #PB_Sound_Millisecond)
      
      MessageRequester("Info", "Ok to stop.") 
      End 
    EndIf
  Else
    Debug "Warning! The sound environment couldn't be initialized. So no sound commands can be used..."
  EndIf

See Also

GetSoundPosition()

Supported OS

All

<- SetSoundFrequency() - Sound Index - SoundLength() ->