Difference between revisions of "Discard.sound"
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
This command unloads [[Sound Resource (AGI)|sound]] '''A''' from [[memory]]. | This command unloads [[Sound Resource (AGI)|sound]] '''A''' from [[memory]]. | ||
− | + | Early versions of AGI did not include a command to unload [[Sound Resource (AGI)|sound]] resources. Since sounds were usually small and only used in limited circumstances, this was not usually a problem. Beginning with [[version]] 2.938, Sierra added this command to allow sounds to be unloaded once they were no longer needed, but ONLY in non-PC versions. | |
− | |||
− | Early versions of AGI did not include a command to unload [[Sound Resource (AGI)|sound]] resources. Since sounds were usually small and only used in limited circumstances, this was not usually a problem. Beginning with [[version]] 2.938, Sierra added this command to allow sounds to be unloaded once they were no longer needed | ||
== Possible Errors == | == Possible Errors == | ||
Presumably, attempting to discard a [[Sound Resource (AGI)|sound]] that hasn't been loaded will cause errors and crash AGI. | Presumably, attempting to discard a [[Sound Resource (AGI)|sound]] that hasn't been loaded will cause errors and crash AGI. | ||
+ | |||
+ | '''NOTE:''' In the PC version of AGI, this command points to a null function, but the null function does not accept arguments. If you use this command on a PC, AGI will treat the argument value intended for this command as the byte value for the next command, which will almost always crash AGI. Do '''NOT''' use this command if you intend to run your game on a PC platform. | ||
== Example == | == Example == | ||
Line 21: | Line 21: | ||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
<syntaxhighlight lang="agi"> | <syntaxhighlight lang="agi"> | ||
− | discard.sound(12); [ | + | discard.sound(12); [ this will crash AGI on a PC system |
[ on non-PC system, sound #12 is unloaded | [ on non-PC system, sound #12 is unloaded | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 29: | Line 29: | ||
{| border="1" cellpadding="2" | {| border="1" cellpadding="2" | ||
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:''' | | style="background-color: #efefef" width="200" | '''Required Interpreter Version:''' | ||
− | | width="175" | Available in version 2.936 and above | + | | width="175" | Available in version 2.936 and above. |
|- | |- | ||
| style="background-color: #efefef" | '''Byte-Code Value:''' | | style="background-color: #efefef" | '''Byte-Code Value:''' | ||
| 175 (0xAF hex) | | 175 (0xAF hex) | ||
|} | |} | ||
+ | '''NOTE:''' This command is only available on non-PC interpreters. | ||
== See Also == | == See Also == |
Latest revision as of 16:52, 30 March 2019
The discard.sound command unloads a sound resource from the memory heap.
Syntax
discard.sound(byt A);
Remarks
This command unloads sound A from memory.
Early versions of AGI did not include a command to unload sound resources. Since sounds were usually small and only used in limited circumstances, this was not usually a problem. Beginning with version 2.938, Sierra added this command to allow sounds to be unloaded once they were no longer needed, but ONLY in non-PC versions.
Possible Errors
Presumably, attempting to discard a sound that hasn't been loaded will cause errors and crash AGI.
NOTE: In the PC version of AGI, this command points to a null function, but the null function does not accept arguments. If you use this command on a PC, AGI will treat the argument value intended for this command as the byte value for the next command, which will almost always crash AGI. Do NOT use this command if you intend to run your game on a PC platform.
Example
<syntaxhighlight lang="agi"> discard.sound(12); [ this will crash AGI on a PC system
[ on non-PC system, sound #12 is unloaded
</syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in version 2.936 and above. |
Byte-Code Value: | 175 (0xAF hex) |
NOTE: This command is only available on non-PC interpreters.