Difference between revisions of "Sound Commands"

From AGI Wiki
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 32: Line 32:
 
* <code>[[stop.sound]]</code>
 
* <code>[[stop.sound]]</code>
 
* <code>[[discard.sound]]</code>
 
* <code>[[discard.sound]]</code>
* [[Sound Resource]]
+
* [[Sound Resource (AGI)|AGI Sound Resource]]
 
* [[AGI Sound Tutorial]]
 
* [[AGI Sound Tutorial]]
  
 
&nbsp;
 
&nbsp;
  
[[Category:Sound Resources]]
+
[[Category:AGI Sound Resources]]
[[Category:Logic]]
+
[[Category:AGI Logic]]
<!-- [[Category:]]-->
 

Latest revision as of 14:01, 30 January 2024

Sound in AGI are controlled by a handful of flags, variables and commands:



Commands

  • load.sound(n)
  • sound(n, f)
  • stop.sound()
  • discard.sound(n) - only on Amiga v3 interpreters

Where 'n' is the number of the sound and 'f' is the flag


Flags

The interpreter looks for two flags whenever you play a sound. Flag 9 which defines whether or not to actually play sounds and then the flag you define when you play a sound.

  • Flag 9: If this is set, then sounds will play. If it is not set. then.. hey, sounds won't play.
  • Done flag: Whenever you play a sound, this flag is cleared. This is always done, even if flag 9 is not set. When it gets to playing the sound itself, when the sound is finished, or it discovers flag 9 is set (even whilst in the middle of a song), it will stop the sound and set the done flag. So if sound is disabled, the done flag will appear to have been set instantaneously.



Variables

There are three variables that dictate how the sound works.

  • Sound type (var 22)- defines how many tone channels are available to play. PC interpreters set this to 1. Amiga, Mac and PCjr set this to 3.
  • Sound volume (var 23) - defines the overall volume of games. The volume in agi sounds go from 0 (maximum volume) to 15 (silent). Notice how 0 is the MAXIMUM volume and not 15. It seems like it is in reverse, but just think of it as a value subtracted from the max volume. A lot of fan made games incorrectly set this value wrong, so their music comes out silent on interpreters that properly handle the volume variable.


See Also