SetSoundSpeed: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
This function can be used to change the playback speed of the specified [[sound]] element.
This function can be used to change the playback speed of the specified [[sound]] [[element]].


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setSoundSpeed ( element theSound, float speed )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setSoundSpeed ( element theSound, float speed )</syntaxhighlight>  
 
{{OOP||[[sound]]:setSpeed|speed|getSoundSpeed}}
===Required Arguments===  
===Required Arguments===  
*'''theSound:''' The [[sound]] element which volume you want to modify.
*'''theSound:''' the [[sound]] [[element]] which volume you want to modify.
*'''speed:''' A [[float]]ing point number representing the desired sound playback speed.
*'''speed:''' a [[float]]ing point number representing the desired sound playback speed.


===Returns===
===Returns===
Line 14: Line 14:


==Example==  
==Example==  
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function sound()
function soundFunc()
sound = playSound ( "/sounds/jizzy.mp3",true)
sound = playSound ( "/sounds/jizzy.mp3",true) -- Let's play a sound
setSoundSpeed ( sound, 1.2 )
setSoundSpeed ( sound, 1.2 ) -- And it will be a little bit faster !
end
end
addCommandHandler("play",sound)
addCommandHandler("play",soundFunc)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client_audio_functions}}
{{Client_audio_functions}}
[[Category:Needs_Example]]
 
[[hu:setSoundSpeed]]
[[ar:setSoundSpeed]]
[[RO:setSoundSpeed]]

Latest revision as of 19:55, 30 January 2019

This function can be used to change the playback speed of the specified sound element.

Syntax

bool setSoundSpeed ( element theSound, float speed )

OOP Syntax Help! I don't understand this!

Method: sound:setSpeed(...)
Variable: .speed
Counterpart: getSoundSpeed


Required Arguments

  • theSound: the sound element which volume you want to modify.
  • speed: a floating point number representing the desired sound playback speed.

Returns

Returns true if the sound element playback speed was successfully changed, false otherwise.

Example

function soundFunc()
sound = playSound ( "/sounds/jizzy.mp3",true) -- Let's play a sound
setSoundSpeed ( sound, 1.2 ) -- And it will be a little bit faster !
end
addCommandHandler("play",soundFunc)

See Also