GetSoundMetaTags: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Reverted edits by Ameir (talk) to last revision by Alvesvin)
Tag: Rollback
 
(12 intermediate revisions by 12 users not shown)
Line 2: Line 2:
{{Client function}}
{{Client function}}
Used to get the meta tags attached to a sound. These provide information about the sound, for instance the title or the artist.
Used to get the meta tags attached to a sound. These provide information about the sound, for instance the title or the artist.
{{Note|
*This function does not work on remote WAV files
}}


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">table getSoundMetaTags ( element sound )</syntaxhighlight>  
<syntaxhighlight lang="lua">table getSoundMetaTags ( element sound [, string format = "" ] )</syntaxhighlight>  
 
{{OOP||[[sound]]:getMetaTags}}
===Required Arguments===  
===Required Arguments===  
*'''sound:''' a [[sound]] element.
*'''sound:''' a [[sound]] element.
===Optional Arguments===
{{OptionalArg}}
*'''format:''' a filter [[string]] to get a specific meta tag.


===Returns===
===Returns===
Returns a [[table]] with all data available (keys are listed below) for the sound if successful, ''false'' otherwise.
Returns a [[table]], but only a [[string]] if '''format''' is given, with all data available (keys are listed below) for the sound if successful, ''false'' otherwise. If any data is unavailable then the associated key is not written to the table.


{{Sound_Meta_Tags}}
{{Sound_Meta_Tags}}


==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">addEventHandler("onClientSoundFinishedDownload",root,function(length)
-- TODO
local meta = getSoundMetaTags(source)
outputChatBox("The sound: "..(meta.title).." has finished in :"..length.."ms.")
        outputChatBox("The sound meta tags: Artist:"..(meta.artist).." Album:"..(meta.album).." Genre:"..(meta.genre).." Year:"..(meta.year).." Comment:"..(meta.comment).." Track:"..(meta.track).." Composer:"..(meta.composer).." Copyright:"..(meta.copyright).." SubTitle:"..(meta.subtitle).." Album Artist:"..(meta.album_artist)..".")
end)
</syntaxhighlight>
</syntaxhighlight>


Line 22: Line 33:
{{Client_audio_functions}}
{{Client_audio_functions}}


[[Category:Needs_Example]]
[[HU:getSoundMetaTags]]
[[AR:getSoundMetaTags]]
[[RO:getSoundMetaTags]]
[[PT-BR:getSoundMetaTags]]

Latest revision as of 16:36, 26 September 2021

Used to get the meta tags attached to a sound. These provide information about the sound, for instance the title or the artist.


[[{{{image}}}|link=|]] Note:
  • This function does not work on remote WAV files

Syntax

table getSoundMetaTags ( element sound [, string format = "" ] )

OOP Syntax Help! I don't understand this!

Method: sound:getMetaTags(...)


Required Arguments

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • format: a filter string to get a specific meta tag.

Returns

Returns a table, but only a string if format is given, with all data available (keys are listed below) for the sound if successful, false otherwise. If any data is unavailable then the associated key is not written to the table.

  • title
  • artist
  • album
  • genre
  • year
  • comment
  • track
  • composer
  • copyright
  • subtitle
  • album_artist
  • stream_name
  • stream_title

Example

addEventHandler("onClientSoundFinishedDownload",root,function(length)
	local meta = getSoundMetaTags(source)
	outputChatBox("The sound: "..(meta.title).." has finished in :"..length.."ms.")
        outputChatBox("The sound meta tags: Artist:"..(meta.artist).." Album:"..(meta.album).." Genre:"..(meta.genre).." Year:"..(meta.year).." Comment:"..(meta.comment).." Track:"..(meta.track).." Composer:"..(meta.composer).." Copyright:"..(meta.copyright).." SubTitle:"..(meta.subtitle).." Album Artist:"..(meta.album_artist)..".")
end)

See Also