]> git.mxchange.org Git - flightgear.git/blobdiff - docs-mini/README.xmlsound
Updates for newest scenery build.
[flightgear.git] / docs-mini / README.xmlsound
index b63899951f33b2c623b3a36c6d50e2f568852603..eb506103450ff73e94ff50c55eb0c9ef96e225a3 100644 (file)
@@ -1,24 +1,9 @@
 Users Guide to FlightGear sound configuration
-Version 0.7.10, Mar 02 2002
-Author: Erik Hofman <erik@ehofman.com>
+Version 0.9.8, October 30, 2005
+Author: Erik Hofman <erik at ehofman dot com>
 
 This document is an attempt to describe the configuration of
-FlightGear flight simulator's aircraft sound via XML.
-
-Some History:
-------------
-Older versions of FGFS had a hard coded audio layer.  This was a
-than ideal state of affairs due to FGFS ability to use different
-aircraft models. Being primarily developed on UNIX type systems, a
-modular approach is taken towards the simulation. To date, most
-alternatives to the default Cessna 172 aircraft are the product
-of research institutions interested in the flight characteristics and
-not cosmetics.  The result of this was that one could fly the X-15 or
-a Boeing 747 but be limited to C172 sounds.
-
-A rewrite of the sound code was done around v0.7.10 by Erik Hofman
-allowing for configuration of the sounds via XML to address this
-limitation.
+FlightGear flight simulator's aircraft sound in XML.
 
 Sound Architecture:
 ------------------
@@ -33,8 +18,8 @@ The top level sound configuration file is composed of a <fx>, a
 <name>, a <path> sound file and zero or more <volume> and/or <pitch>
 definitions.
 
-[ Paths are relative to $FG_ROOT (the installed location of FGFS data files.) ]
-[ Absolute paths may be used.Comments are bracketed with <!-- -->.            ]
+[ Paths are relative to $FG_ROOT (the root of the installed base package .) ]
+[ Absolute paths may be used. Comments are bracketed with <!-- -->.         ]
 
 A limited sound configuration file would look something like this:
 
@@ -44,7 +29,9 @@ A limited sound configuration file would look something like this:
    <name>engine</name>
    <path>Sounds/wasp.wav</path>
    <mode>looped</mode>
-   <property>/engines/engine/running</property>
+   <condition>
+    <property>/engines/engine/running</property>
+   </condition>
    <volume>
     <property>/engines/engine/mp-osi</property>
     <factor>0.005</factor>
@@ -69,8 +56,8 @@ and is named wasp.wav. The event is started when the property
 /engines/engine/running becomes non zero. 
 
 When that happens, the sound will be played looped (see <mode>) until the
-property returns zero again. As you can see the volume is mp-osi dependant,
-and the pitch of the sound depents on the engine rpm.
+property returns zero again. As you can see the volume is mp-osi dependent,
+and the pitch of the sound depends on the engine rpm.
 
 Configuration description:
 -------------------------
@@ -79,9 +66,9 @@ Configuration description:
        Named FX subtree living under /sim/sound
  
  < ... >
-       This is the event seperator. The text inside the brackets
-       can be anything. Bit it is adviced to give it a meaningfull name
-        like: crank, engine, rumble, gear, squeal, flap, wind or stall
+       This is the event separator. The text inside the brackets
+       can be anything. Bit it is advised to give it a meaningful name
+       like: crank, engine, rumble, gear, squeal, flap, wind or stall
  
        The value can be defined multiple times, thus anything which is
        related may have the same name (grouping them together).
@@ -89,12 +76,12 @@ Configuration description:
    <name>
        This defines the name of the event. This name is used internally
        and, although it can me defined multiple times in the same file,
-        should normally have an unique value.
+       should normally have an unique value.
  
        Multiple definitions of the same name will allow multiple sections
        to interfere in the starting and stopping of the sample.
 
-       This method can't be used to controll the pitch or volume of the 
+       This method can't be used to control the pitch or volume of the 
        sample, but instead multiple volume or pitch section should be
        included inside the same event.
 
@@ -104,7 +91,7 @@ Configuration description:
        Using the type "fall" will stop playback when the event turns true.
 
        IMPORTANT:
-        If the trigger is used for anything else but stopping the sound
+       If the trigger is used for anything else but stopping the sound
        at a certain event, all sections with the same name *should* have
        exactly the same sections for everything but property and type.
 
@@ -114,43 +101,21 @@ Configuration description:
    <path>
        This defined th path to the sound file. The path is relative to the
        FlightGear root directory but could be specified absolute.
-   <property>
-       Define which property triggers the event, and reffers to a node
-       in the FlightGear property tree.
-        
-       The value is converted to an integer value (anything less than 0.5 is
-       is considered to be 0) and handled if it were a boolean value
-       (0 = false, anything else = true).
-       The triger depends on the value of <type>.
-   <type>
-       This specifies how the event is triggered. When an event is triggered
-       the sample will start playing. Since the effects scheduler can have
-       multiple events controll a single sound event, it depends on the
-       situation if an event actually stops playing the sound.
 
-       Basically the following is true:
-               The first event requesting to start playback, triggers playback.
-               The last event requesting to stop playback, will stop playback.
+   <condition>
+       Define a condition that triggers the event.
+       For a complete description of the FlightGear conditions,
+       please read docs-mini/README.conditions
 
-       There are multiple options:
+       An event should define either a condition or a property.
  
-       level:          events are active if the value is true.
-                       this is the default behaviour.
-       inverted:       events are active if the value is false.
-       flipflop:       events are triggered on state changes.
-                       this is only usefull for samples which are played
-                       once.
-
-       raise:          start playing at the raise of the event.
-                       explicitly stop playing when the event turns false.
+   <property>
+       Define which property triggers the event, and refers to a node
+       in the FlightGear property tree. Action is taken when the property
+       is non zero.
 
-       fall:           start playing at the fall of the event.
-                       explicitly stop playing when the event turns true.
+       A more sophisticated mechanism to trigger the event is described
+       in <condition>
  
    <mode>
        This defines how the sample should be played:
@@ -160,7 +125,9 @@ Configuration description:
  
        looped:         the sample plays continuesly,
                        until the event turns false.
+
+       in-transit:     the sample plays continuesly,
+                       while the property is changing its value.
    
    <volume> / <pitch>
        Volume or Pitch definition. Currently there may be up to 5
@@ -172,23 +139,35 @@ Configuration description:
        but instead will be used in the multiplication section.
  
      <property>
-       Defins which property supplies the value for the calculation.
-       The value is treatened as a floating point number.
+       Defines which property supplies the value for the calculation.
+       Either a <property> or an <internal> should be defined.
+       The value is threated as a floating point number.
+
+     <internal>
+       Defines which internal variable should be used for the calculation.
+       The value is threated as a floating point number.
+       The following internals are available at this time:
+
+       dt_play:        the number of seconds since the sound started playing.
+
+       dt_stop:        the number of seconds after the sound has stopped.
  
      <type>
        Defines the function that should be used upon the property
        before it is used for calculating the net result:
 
-       lin:            lineair handling of the property value.
+       lin:            linear handling of the property value.
                        this is the default.
  
        ln:             convert the property value to a natural logarithmic
-                       value before scaling it.
+                       value before scaling it. Anything below 1 will return
+                       zero.
  
        log:            convert the property value to a true logarithmic
-                       value before scaling it.
+                       value before scaling it. Anything below 1 will return
+                       zero.
 
-       inv:            inverse lineair handling (1/x).
+       inv:            inverse linear handling (1/x).
 
        abs:            absolute handling of the value (always positive).
 
@@ -203,23 +182,75 @@ Configuration description:
  
      <offset>
        The initial value for this sound. This value is also used as an
-       offset value for calulating the end result.
+       offset value for calculating the end result.
  
      <min>
        Minimum allowed value.
-       This is usefull if sounds start to sound funny. Anything lower
+       This is useful if sounds start to sound funny. Anything lower
        will be truncated to this value.
  
      <max>
        Maximum allowed value.
-       This is usefull if sounds gets to loud. Anything higher will be
+       This is useful if sounds gets to loud. Anything higher will be
        truncated to this value.
 
-Creating a configrationfile:
----------------------------
+   <position>
+        Specify the position of the sounds source relative to the
+        pilot's ears.  The coordinate system used is a right hand
+        coordinate system where -X = left, +X = right, -Y = down, +Y =
+        up, -Z = forward, +Z = aft.  Distances are in meters.
+
+     <x>
+        X dimension offset
+
+     <y>
+        Y dimension offset
+
+     <z>
+        Z dimension offset
+
+
+   <orientation>
+        Specify the orientation of the sounds source.
+
+        The zero vector is default, indicating that a Source is not directional.
+        Specifying a non-zero vector will make the Source directional.
+
+     <x>
+        X dimension angle (0.0 - 360.0)
+
+     <y>
+        Y dimension angle (0.0 - 360.0)
+
+     <z>
+        Z dimension angle (0.0 - 360.0)
+
+     <inner-cone>
+        The inner edge of the audio cone in degrees (0.0 - 360.0).
+        Any sound withing that angle will be played at the current gain.
+
+     <outer-cone>
+        The outer edge of the audio cone in degrees (0.0 - 360.0).
+        Any sound beyond the outer cone will be played at "outer-gain" volume.
+
+     <outer-gain>
+        The gain at the outer edge of the cone.
+
+
+   <reference-dist>
+        Set a reference distance of sound in meters.  This is the
+        distance where the gain/volume will be halved.  This can be
+        useful for limiting cockpit sounds to the cockpit.
+
+   <max-dist>
+        Set the maximum audible distance for the sound in meters.
+        This can be useful for limiting cockpit sounds to the cockpit.
+
+
+Creating a configration file:
+----------------------------
 
-To make things easy, there is a default falue for most entries to allow a
+To make things easy, there is a default value for most entries to allow a
 sane configuration when a certain entry is omitted.
 
 Default values are:
@@ -227,7 +258,7 @@ Default values are:
 type:  lin
 factor:        1.0
 offset:        0.0 for volume, 1.0 for pitch
-min:   0.0 (don't check)
+min:   0.0
 max:   0.0 (don't check)
 
  
@@ -240,12 +271,12 @@ Calculations are made the following way (for both pitch and volume):
    for (n = 0;  n < max; n++) {
       if (factor < 0)
       {
-         value += offset[n] - abs(factor[n]) * function(property[n]);
+        value += offset[n] - abs(factor[n]) * function(property[n]);
       }
       else
       {
-         value += factor[n] * function(property[n]);
-         offs += offset[n];
+        value += factor[n] * function(property[n]);
+        offs += offset[n];
       }
    }