Howto:Add sound effects to aircraft: Difference between revisions

Jump to navigation Jump to search
m
→‎Creating a configuration file: Table, indentation, syntaxhighlight (lang="cpp", because source language is in C++)
m (Grammar)
m (→‎Creating a configuration file: Table, indentation, syntaxhighlight (lang="cpp", because source language is in C++))
Line 280: Line 280:
sane configuration when a certain entry is omitted.
sane configuration when a certain entry is omitted.


Default values are:
{| class="wikitable"
 
! Tag !! Default value
<source>
|-
typelin
| '''&lt;type&gt;''' || lin
factor: 1.0
|-
offset: 0.0 for volume, 1.0 for pitch
| '''&lt;factor&gt;''' || 1.0
min:    0.0
|-
max:    0.0 (don't check)
| '''&lt;offset&gt;''' || 0.0 for volume, 1.0 for pitch
</source>
|-
| '''&lt;min&gt;''' || 0.0
|-
| '''&lt;max&gt;''' || 0.0 (don't check)
|}
   
   
Calculations are made the following way (for both pitch and volume):
Calculations are made the following way (for both pitch and volume):
<source>  
<syntaxhighlight lang="cpp">
  value = 0;
value = 0;
  offs = 0;
offs = 0;


  for (n = 0; n < max; n++) {
for (n = 0; n < max; n++) {
      if (factor < 0)
    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]);
      else
        offs += offset[n];
      {
    }
          value += factor[n] * function(property[n]);
}
          offs += offset[n];
      }
  }


  volume = offs + value;
volume = offs + value;
</source>
</syntaxhighlight>
where function can be one of: lin, ln, log, inv, abs or sqrt
where function can be one of: lin, ln, log, inv, abs or sqrt


Navigation menu