Enhanced sound

From FreeSpace Wiki
Revision as of 22:29, 15 December 2022 by -Joshua- (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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

See this thread for OS X builds that use OpenAL Soft.

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 have low priority.

"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.]"