AR/setSoundProperties: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
Line 8: Line 8:
<syntaxhighlight lang="lua">bool setSoundProperties(element sound, float fSampleRate, float fTempo, float fPitch, bool bReverse )</syntaxhighlight>  
<syntaxhighlight lang="lua">bool setSoundProperties(element sound, float fSampleRate, float fTempo, float fPitch, bool bReverse )</syntaxhighlight>  


===Required Arguments===  
===العناصر المطلوبة===  
*'''sound:''' A sound element that is created using [[playSound]] or [[playSound3D]]
*'''sound:''' A sound element that is created using [[playSound]] or [[playSound3D]]



Latest revision as of 01:52, 20 July 2018

This function edit's the properties of a specific sound.

شرح الوظيفة

bool setSoundProperties(element sound, float fSampleRate, float fTempo, float fPitch, bool bReverse )

العناصر المطلوبة

  • fSampleRate: A float that defines the new sound's sample rate
  • fTempo: A float that defines the new sound tempo
  • fPitch: A float that defines the new sound pitch
  • bReverse: A boolean representing whether the sound will be reversed or not.

أستعادة

Returns true if the properties sucessfully set, false otherwise.

مثال

Click to collapse [-]
Client
function editSongSound()
	local sound = playSound("song.wav", false) -- Play the file 'song.wav' and make it play only once
	setSoundProperties(sound, 48000.0, 128.00, 440.0, false) -- Set its samplerate to 48,000 Hz, tempo to 128.00, pitch to 440 Hz and not reversed
end
addEventHandler("onClientResourceStart", resourceRoot, editSongSound) -- Execute the function when the resource is started

أنظر أيضاً