Difference between revisions of "Enhanced sound"

From FreeSpace Wiki
Jump to: navigation, search
(Aded placeholder)
 
(First draft of enhanced sound page)
Line 1: Line 1:
Coming soon...
+
{{Note|Enhanced sound requires the [http://kcat.strangesoft.net/openal.html OpenAL Soft] driver. See [[#How to get OpenAL Soft|How to get OpenAL Soft]] below.}}
 +
 
 +
 
 +
Enhanced sound was merged into master on June 1, 2015, as of Git commit d7f54dd.
 +
 
 +
Enhanced sound adds
 +
*Support for 128 audio channels instead of 32
 +
*Support for more control over how the game prioritizes sounds in a mission
 +
 
 +
Enhanced sound is enabled by default, but it's disabled if you are not using [http://kcat.strangesoft.net/openal.html OpenAL Soft]. See [[#How to get OpenAL Soft|How to get OpenAL Soft]] below.
 +
 
 +
You can also manually disable enhanced sound with the "Disable enhanced sound" launcher flag under the "Audio" flags.
 +
 
 +
==How to get OpenAL Soft==
 +
===Windows===
 +
#First, you need to get the OpenAL32.dll file. You can download version 1.16.0 [http://www.mediafire.com/download/csdkp5psozmq2b1/OpenAL32.dll here].
 +
#Alternatively, to get OpenAL32.dll from its original source:
 +
##Download from the [http://kcat.strangesoft.net/openal.html#download OpenAL Soft site] the file whose name ends with "-bin.zip", such as openal-soft-1.16.0-bin.zip.
 +
##Open the .zip file and rename  soft_oal.dll found in the bin\Win32\ folder to OpenAL32.dll.
 +
#Once you have OpenAL32.dll:
 +
#Copy it to your FreeSpace 2 or TC folder.
 +
#Make sure to put a copy of OpenAL32.dll in both your FreeSpace 2 folder and the root folders of any TCs you have.
 +
 
 +
===Linux===
 +
Linux uses OpenAL Soft, so you don't need to do anything.
 +
 
 +
However, you may wish to build from source either the most recent stable release from the [http://kcat.strangesoft.net/openal.html#download OpenAL Soft site] or even the latest commit from their Git repository.
 +
 
 +
===OS X===
 +
OS X requires special FSO builds that use OpenAL Soft.
 +
 
 +
At this time, no such builds are available. The SCP is working on it.
 +
 
 +
 
 +
==For modders==
 +
===Overview===
 +
Enhanced sound provides control through two values that you can set through extensions of sounds.tbl:
 +
*'''Priority''': how important the sound is
 +
*'''Limit''': how many instances of the sound can  be playing at hte same time
 +
 
 +
The engine has hardcoded default priorities and limits, as described [[#More on default prioritiies/limits|below]].
 +
 
 +
You can set custom values for priorities limits using a .tbm file extending sounds.tbl. The [[Sounds.tbl]] page has details on how to specify custom [[Sounds.tbl#+Priority:|priorities]] and [[Sounds.tbl#+Limit:|limits]].
 +
 
 +
{{Warning|If you create a TC and want to use enhanced sound, then you '''MUST''' set custom priorities/limits for your TC's gameplay sounds. Otherwise the game may sound strange, because the game will use the default values for FS2 retail.}}
 +
 
 +
 
 +
{{Note|If you create an FS2 mod that adds new gameplay sounds, then it is '''strongly''' recommended that you specify priorities/limits for those sounds.
 +
}}
 +
 
 +
 
 +
===More on default prioritiies/limits===
 +
The FSO engine has hardcoded default priorities limits for the 192 gameplay sound entries in the FS2 retail sounds.tbl. You can see the current list in the source code's [https://github.com/scp-fs2open/fs2open.github.com/blob/master/code/gamesnd/gamesnd.cpp code\gamesnd\gamesnd.cpp] file.
 +
Look for the line starting with
 +
<pre>
 +
static EnhancedSoundData Default_sound_priorities[NUM_RETAIL_GAMEPLAY_SOUNDS] =
 +
</pre>
 +
 
 +
Sounds outside this range are assigned a generic default priority of Medium-High and limit 1.
 +
 
 +
 
 +
===Tips on selecting priorities/limits===
 +
 
 +
The first answer in [http://gamedev.stackexchange.com/questions/2253/audio-design-and-xaudio2-performance-issues this thread] has some details:
 +
 
 +
"The methods to prioritise [sounds] can include :
 +
 
 +
"a) Volume - the lowest being the least important.
 +
[''FSO already takes volume into account when deciding whether to replace a currently playing sound.'']
 +
 
 +
"b) Priority - a value you set yourself based on the importance of the sound and the likely hood that the user will notice the sound dropping out. Background music, for example, should be set to never be dropped. A random cricket sound for ambience should be high on the list.
 +
 
 +
"c) Grouping [or ''limit''] - If you have gunshot sounds for example, once they have hit a hard limit (say 15) you would stop adding new gunshot sounds as they wouldn't add to the overall mix.
 +
[''Grouping/limits is also needed to prevent clipping, which is why in FSO, the warp-in sound has a low limit of 2. The super-loud  warp-ins were occurring because this limit wasn't being enforced, meaning there was no limit at all.'']"

Revision as of 22:34, 3 June 2015

Note: Enhanced sound requires the OpenAL Soft driver. See How to get OpenAL Soft below.


Enhanced sound was merged into master on June 1, 2015, as of Git commit d7f54dd.

Enhanced sound adds

  • Support for 128 audio channels instead of 32
  • Support for more control over how the game prioritizes sounds in a mission

Enhanced sound is enabled by default, but it's disabled if you are not using OpenAL Soft. See How to get OpenAL Soft below.

You can also manually disable enhanced sound with the "Disable enhanced sound" launcher flag under the "Audio" flags.

How to get OpenAL Soft

Windows

  1. First, you need to get the OpenAL32.dll file. You can download version 1.16.0 here.
  2. Alternatively, to get OpenAL32.dll from its original source:
    1. Download from the OpenAL Soft site the file whose name ends with "-bin.zip", such as openal-soft-1.16.0-bin.zip.
    2. Open the .zip file and rename soft_oal.dll found in the bin\Win32\ folder to OpenAL32.dll.
  3. Once you have OpenAL32.dll:
  4. Copy it to your FreeSpace 2 or TC folder.
  5. Make sure to put a copy of OpenAL32.dll in both your FreeSpace 2 folder and the root folders of any TCs you have.

Linux

Linux uses OpenAL Soft, so you don't need to do anything.

However, you may wish to build from source either the most recent stable release from the OpenAL Soft site or even the latest commit from their Git repository.

OS X

OS X requires special FSO builds that use OpenAL Soft.

At this time, no such builds are available. The SCP is working on it.


For modders

Overview

Enhanced sound provides control through two values that you can set through extensions of sounds.tbl:

  • Priority: how important the sound is
  • Limit: how many instances of the sound can be playing at hte same time

The engine has hardcoded default priorities and limits, as described below.

You can set custom values for priorities limits using a .tbm file extending sounds.tbl. The Sounds.tbl page has details on how to specify custom priorities and limits.


Warning: If you create a TC and want to use enhanced sound, then you MUST set custom priorities/limits for your TC's gameplay sounds. Otherwise the game may sound strange, because the game will use the default values for FS2 retail.


Note: If you create an FS2 mod that adds new gameplay sounds, then it is strongly recommended that you specify priorities/limits for those sounds.


More on default prioritiies/limits

The FSO engine has hardcoded default priorities limits for the 192 gameplay sound entries in the FS2 retail sounds.tbl. You can see the current list in the source code's code\gamesnd\gamesnd.cpp file. Look for the line starting with

static EnhancedSoundData Default_sound_priorities[NUM_RETAIL_GAMEPLAY_SOUNDS] =

Sounds outside this range are assigned a generic default priority of Medium-High and limit 1.


Tips on selecting priorities/limits

The first answer in this thread has some details:

"The methods to prioritise [sounds] can include :

"a) Volume - the lowest being the least important. [FSO already takes volume into account when deciding whether to replace a currently playing sound.]

"b) Priority - a value you set yourself based on the importance of the sound and the likely hood that the user will notice the sound dropping out. Background music, for example, should be set to never be dropped. A random cricket sound for ambience should be high on the list.

"c) Grouping [or limit] - If you have gunshot sounds for example, once they have hit a hard limit (say 15) you would stop adding new gunshot sounds as they wouldn't add to the overall mix. [Grouping/limits is also needed to prevent clipping, which is why in FSO, the warp-in sound has a low limit of 2. The super-loud warp-ins were occurring because this limit wasn't being enforced, meaning there was no limit at all.]"