GetSoundSpeed: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Improve example.) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 15: | Line 15: | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function outputSpeed( | function outputSpeed(soundName) | ||
if soundName then | |||
local soundElement = playSound("sounds/"..soundName..".mp3") -- Play the sound from the sounds folder | |||
setSoundSpeed(soundElement, 0.5) -- Set the sound speed to 50% | |||
local soundSpeed = getSoundSpeed(soundElement) -- Get current sound speed | |||
outputChatBox("Sound speed: "..soundSpeed) -- Output the sound speed | |||
end | |||
end | end | ||
addCommandHandler("soundspeed",outputSpeed) | addCommandHandler("soundspeed", outputSpeed) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> | ||
Line 29: | Line 35: | ||
[[hu:getSoundSpeed]] | [[hu:getSoundSpeed]] | ||
[[ar:getSoundSpeed]] | [[ar:getSoundSpeed]] | ||
[[RO:getSoundSpeed]] | |||
[[PT-BR:getSoundSpeed]] |
Latest revision as of 16:00, 21 December 2021
This function is used to return the playback speed of the specified sound element.
Syntax
float getSoundSpeed ( element theSound )
OOP Syntax Help! I don't understand this!
- Method: sound:getSpeed(...)
- Variable: .speed
- Counterpart: setSoundSpeed
Required Arguments
Returns
Returns an float value indicating the playback speed of the sound element. Default sound playback speed is 1.0.
Example
Click to collapse [-]
Clientfunction outputSpeed(soundName) if soundName then local soundElement = playSound("sounds/"..soundName..".mp3") -- Play the sound from the sounds folder setSoundSpeed(soundElement, 0.5) -- Set the sound speed to 50% local soundSpeed = getSoundSpeed(soundElement) -- Get current sound speed outputChatBox("Sound speed: "..soundSpeed) -- Output the sound speed end end addCommandHandler("soundspeed", outputSpeed)
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