setSoundPosition
Client-side
Server-side
Shared
Pair: getSoundPosition
This function is used to change the seek position of the specified sound element. Use a player element to control a players voice with this function.
Note
To set position of a remote audio file, you must pause the sound within an onClientSoundStream event after creation, set the sound position and then unpause it again. The sound can also not be throttled (see playSound arguments).
OOP Syntax Help! I don't understand this!
- Method: sound:setPlaybackPosition(...)
- Variable: .playbackPosition
Syntax
bool setSoundPosition ( sound/player theSound, float pos )
Required Arguments
- theSound: The sound element which seek position you want to modify.
- pos: A float value representing the new seek position of the sound element in seconds.
Returns
- bool: result
Returns true if the sound element's seek position was successfully changed, false otherwise.
Code Examples
client
This example allows the player to set how many milliseconds into the song he wants it to play from
local theSound = playSound("music/song.mp3")function setSongPos(cmd, tm) tm = tonumber(tm) local ssp = setSoundPosition(theSound,tm) if ssp then outputChatBox("Sound is now playing from: "..tostring(tm)) else outputChatBox("An error has occured.") endendaddCommandHandler("skipsong", setSongPos)
Changelog
See Also
Audio Functions
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundFFTData
- getSoundEffects
- getSoundLength
- getSoundMaxDistance
- getSoundLevelData
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundSpeed
- getSoundWaveData
- getSoundVolume
- isSoundPaused
- isSoundPanningEnabled
- playSFX
- isSoundLooped
- getSoundProperties
- playSound
- playSFX3D
- setRadioChannel
- playSound3D
- setSoundEffectParameter
- setSoundEffectEnabled
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPaused
- setSoundPanningEnabled
- setSoundSpeed
- setSoundPosition
- setSoundProperties
- setSoundVolume
- stopSound