SetSoundPaused: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Added Example) |
||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example will allow the user to toggle sounds from paused to playing, and from playing to paused | |||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | theSound = playSound("music/song.mp3", true) | ||
function togglePausedSound() | |||
if(isSoundPaused(theSound)) then --sound is paused, un-pause it | |||
setSoundPaused(theSound, false) | |||
else --sound is not paused, pause it | |||
setSoundPaused(theSound, true) | |||
end | |||
end | |||
addCommandHandler("pausesound", togglePausedSound) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 12:37, 28 November 2009
This function is used to either pause or unpause the playback of the specified sound element.
Syntax
bool setSoundPaused ( element theSound, bool paused )
Required Arguments
- theSound: The sound element which you want to pause/unpause.
- paused: A boolean value representing whether the sound should be paused or not. To pause the sound, use true.
Returns
Returns true if the sound element was successfully paused, false otherwise.
Example
This example will allow the user to toggle sounds from paused to playing, and from playing to paused
Click to collapse [-]
ClienttheSound = playSound("music/song.mp3", true) function togglePausedSound() if(isSoundPaused(theSound)) then --sound is paused, un-pause it setSoundPaused(theSound, false) else --sound is not paused, pause it setSoundPaused(theSound, true) end end addCommandHandler("pausesound", togglePausedSound)
See Also
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX3D
- playSFX
- playSound3D
- playSound
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound
- Shared
- playSoundFrontEnd