<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=GetGameSoundState</id>
	<title>GetGameSoundState - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=GetGameSoundState"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=GetGameSoundState&amp;action=history"/>
	<updated>2026-10-01T14:28:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=GetGameSoundState&amp;diff=1180&amp;oldid=prev</id>
		<title>QCherry: Document upcoming 0.1.7 game audio: 11 client APIs, result event, limits and complete dialogue catalog; not a release</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=GetGameSoundState&amp;diff=1180&amp;oldid=prev"/>
		<updated>2026-10-01T10:20:32Z</updated>

		<summary type="html">&lt;p&gt;Document upcoming 0.1.7 game audio: 11 client APIs, result event, limits and complete dialogue catalog; not a release&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= getGameSoundState =&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; font-weight:bold; letter-spacing:0.04em;&amp;quot;&amp;gt;PLANNED FOR UPDATE 0.1.7&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; margin-top:0.25rem;&amp;quot;&amp;gt;This function is planned for G1R:MP 0.1.7. It is not included in the public 0.1.6 release.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Reads the latest cached state of a game sound owned by the current client resource.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table|false getGameSoundState(number handle)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Required !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;handle&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; || yes || Positive integer handle returned by [[playSoundFromGame]] or [[playSound3DFromGame]], owned by the current resource. Valid IDs do not exceed 9007199254740991.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Returns a Lua table, or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; if the handle is unknown, belongs to another resource, was removed by lifecycle cleanup, or its terminal history record has been evicted. Reading state does not submit a native query.&lt;br /&gt;
&lt;br /&gt;
The initial table contains &amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt; (number), &amp;lt;code&amp;gt;key&amp;lt;/code&amp;gt; (string), &amp;lt;code&amp;gt;spatial&amp;lt;/code&amp;gt; (bool), &amp;lt;code&amp;gt;state = &amp;quot;loading&amp;quot;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;confirmed = false&amp;lt;/code&amp;gt;. Later result fields are merged into this table; fields may be absent until supplied.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;state&amp;lt;/code&amp;gt; || string || &amp;lt;code&amp;gt;loading&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;starting&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;playing&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;paused&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;finished&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stopped&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;failed&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;confirmed&amp;lt;/code&amp;gt; || bool || Playback observations set this to whether playing has been observed. Successful stopping of an existing instance also sets it to true; cancellation before start leaves it false. It never proves audibility.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mode&amp;lt;/code&amp;gt; || string || When supplied: &amp;lt;code&amp;gt;world-3d&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;listener-relative&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;authored-2d&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;reason&amp;lt;/code&amp;gt; || string || When supplied: a failure reason or an empty string.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;operation&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;accepted&amp;lt;/code&amp;gt; || string, bool || Most recent merged control acknowledgement. Operations are &amp;lt;code&amp;gt;volume&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pause&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;distance&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;nativeMs&amp;lt;/code&amp;gt; || number || When supplied: native processing time in milliseconds for the result that last supplied this field; not total loading time or sound duration.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Native playback replies can also add the capability and dialogue diagnostic fields described in [[getGameSoundInfo]]. The state table does not automatically include that function&amp;#039;s &amp;lt;code&amp;gt;speaker&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;verifiedInGame&amp;lt;/code&amp;gt; fields.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Read a sound&amp;#039;s cached state when a result refers to its handle:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; line&amp;gt;&lt;br /&gt;
local sound&lt;br /&gt;
addEventHandler(&amp;quot;onClientGameSoundResult&amp;quot;, resourceRoot,&lt;br /&gt;
    function(requestId, ok, reason, dataJson)&lt;br /&gt;
        local data = fromJSON(dataJson)&lt;br /&gt;
        if sound and type(data) == &amp;quot;table&amp;quot; and data.id == sound then&lt;br /&gt;
            local state = getGameSoundState(sound)&lt;br /&gt;
            if state then outputDebugString(&amp;quot;Game sound state: &amp;quot; .. state.state) end&lt;br /&gt;
        end&lt;br /&gt;
    end)&lt;br /&gt;
sound = playSoundFromGame(&amp;quot;event:/SFX/UI/SFX_UI_Jingle_LevelUp&amp;quot;, {volume = 0.5})&lt;br /&gt;
if not sound then outputDebugString(&amp;quot;Game sound request rejected&amp;quot;) end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* Planned for update 0.1.7; not included in public 0.1.6.&lt;br /&gt;
* Available only in client-side resource scripts. See [[Game audio]] for ownership, lifecycle, limits and server-triggered playback.&lt;br /&gt;
* States are asynchronous observations. Do not assume every intermediate state will be reported or that a fixed sequence is guaranteed.&lt;br /&gt;
* &amp;lt;code&amp;gt;finished&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;stopped&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;failed&amp;lt;/code&amp;gt; are terminal. Terminal handles cannot be controlled, and late updates do not revive them.&lt;br /&gt;
* The client retains up to 512 sound records across resources, evicting terminal history as new plays are accepted. Resource cleanup and world resets remove records immediately.&lt;br /&gt;
* State is accumulated metadata, so optional fields can describe earlier results. It is not a live property snapshot and has no volume, position or distance getter.&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua Functions]]&lt;br /&gt;
[[Category:Client Functions]]&lt;br /&gt;
[[Category:Audio Functions]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>