<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
  SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
  <func>
    <title>Sound</title>
    <category>Effects</category>
    <version>5.1 OC</version>
    <syntax>
      <rtype>bool</rtype>
      <params>
        <param>
          <type>string</type>
          <name>name</name>
          <desc>Name of the sound effect (without .wav/.ogg extension). Wildcards as used by <funclink>WildcardMatch</funclink> are used.</desc>
        </param>
        <param>
          <type>bool</type>
          <name>global</name>
          <desc>Specifies wether the sound is played globally, i.e. independently of the object position always with the same loudness.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>volume</name>
          <desc>0-100: volume for playback of the sound. A volume value of <code>nil</code> means playback at 100.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>player</name>
          <desc>Player number of the player for which the sound is to be played. In network games, the sound will thus not be audible for the other players. If <code>nil</code> (or not specified), the sound will be played for all players.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>loop_count</name>
          <desc>Increases or decreases the number of sounds running in a continuous loop. Value +1 will play this sound indefinitely until it is stopped by calling this function again with value -1. Value 0 will play the sound once normally.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>custom_falloff_distance</name>
          <desc>The further away the sound effect from the player, the more quiet it is played. By default, the sound will not be hearable anymore in a distance of 700 pixels. A custom distance can be specified here.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>pitch</name>
          <desc>Pitch modification between -90 and 1000. Values larger than zero let the sound play the faster and at a higher pitch. The resulting speed multiplication factor is (pitch + 100) / 100.</desc>
          <optional />
        </param>
        <param>
          <type>proplist</type>
          <name>modifier</name>
          <desc>Sound modifier for special effects such as reverb or echo. See <emlink href="script/SoundModifiers.html">Sound modifiers</emlink>.</desc>
          <optional />
        </param>
	</params>
    </syntax>
    <desc>Plays a sound. The specified sound file has to be available in the group Sound.ocg, in the active scenario file, or in any loaded object definition. The audibility of object local sounds will depend on the position of the object relative to the visible viewports.</desc>
    <remark>When a sound effect is already played in the same context (calling object or globally), it is not played again. Instead, only the volume and pitch parameters are updated. This feature can be used to adjust sound parameters live e.g. to tune the pitch of a motor sound based on its speed.</remark>
    <examples>
      <example>
        <code><funclink>FindObject</funclink>(<funclink>Find_ID</funclink>(WindGenerator))-&gt;Sound(&quot;Fanfare&quot;, false, 50);</code>
        <text>Plays a 'Fanfare' sound next to the first found wind generator at half volume.</text>
      </example>
    </examples>
    <related><funclink>SoundAt</funclink></related>
    <related><funclink>Music</funclink></related>
    <related><emlink href="script/SoundModifiers.html">Sound modifiers</emlink></related>
  </func>
  <author>Sven2</author><date>2002-08</date>
</funcs>
