AR/getSoundBPM: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(getSoundBPM)
 
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
{{New feature/item|3.0131|1.3.0|4145|
{{New feature/item|3.0131|1.3.0|4145|
This function gets the beats per minute of a specific [[sound]] element.
This function gets the beats per minute of a specific [[sound]] element.
{{AR/warning|This function is expensive to call and will freeze the client about 1-3 seconds. Also, trying to get the BPM from a sound directly after creation will not work. You need a
[[setTimer]] to do this.}}
}}
}}


==Syntax==  
==تركيب الوظيفة==  
<syntaxhighlight lang="lua">int getSoundBPM( element sound )</syntaxhighlight>  
<syntaxhighlight lang="lua">int getSoundBPM( element sound )</syntaxhighlight>  


===Required Arguments===  
===الفراغات المطلوبة===  
*'''sound:''' A sound element that is created using [[playSound]] or [[playSound3D]]
*'''sound:''' الصوت المحدد يمكنك استخدام الاصوات  [[playSound]] او [[playSound3D]]


===Returns===
===المعطيات===
Returns the beats per minute of the given sound.
لعرض الاصوات في الدقيقة من الصوت المحدد


==Example==  
==مثال==  
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 30: Line 32:
</section>
</section>


==Requirements==
==المتطلبات==
{{Requirements|n/a|1.3.0-9.04162|}}
{{AR/Requirements|n/a|1.3.0-9.04162|}}


==أنظر أيضاً==
==أنظر أيضاً==
{{AR/Audio_functions}}
{{AR/Audio_functions}}
[[EN:getSoundBPM]]
[[HU:getSoundBPM]]
[[RU:getSoundBPM]]
[[RO:getSoundBPM]]
[[PT-BR:getSoundBPM]]

Latest revision as of 18:12, 15 August 2021

This function gets the beats per minute of a specific sound element.

[[|link=|]] تحذير: This function is expensive to call and will freeze the client about 1-3 seconds. Also, trying to get the BPM from a sound directly after creation will not work. You need a

setTimer to do this.

تركيب الوظيفة

int getSoundBPM( element sound )

الفراغات المطلوبة

المعطيات

لعرض الاصوات في الدقيقة من الصوت المحدد

مثال

Click to collapse [-]
Client
function bpm ()
    -- Long version (might be more understandable as example)
    sound = playSound ( "song.mp3" ) -- Play the song
    beats = getSoundBPM ( sound ) -- Get the beats per minute of the song
    outputChatBox ( "Long code version: " .. beats ) -- Output the beats to the chat box

    -- Short version + Would save some memory
    outputChatBox ( "Short code version: " .. getSoundBPM ( playSound ( "song.mp3" ) ) )
end
addCommandHandler ( "bpm", bpm )

المتطلبات

الحد الأدنى من الخادم المدعوم n/a
العميل المدعوم الحد الأدنى 1.3.0-9.04162

ملحوظة: يتطلب استخدام هذه الوظيفة أن يكون للمود إصدار الحد الأدنى المذكور أعلاه في meta.xml <min_mta_version> قسم. e.g. <min_mta_version عميل="1.3.0-9.04162" />

أنظر أيضاً