Table of Contents

Class AudioUtils

Namespace
Nautilus.Utility
Assembly
Nautilus.dll
Utilities pertaining to the use and creation of custom FMOD.Sound objects, alongside other audio-specific functionality. Also see the CustomSoundHandler.
public static class AudioUtils
Inheritance
AudioUtils
Inherited Members

Fields

StandardSoundModes_2D

2D sounds
public const MODE StandardSoundModes_2D = _2D | ACCURATETIME

Field Value

MODE

StandardSoundModes_3D

3D sounds
public const MODE StandardSoundModes_3D = _3D | ACCURATETIME | _3D_LINEARSQUAREROLLOFF

Field Value

MODE

StandardSoundModes_Stream

For music, PDA voices and any 2D sounds that can have more than one instance at a time.
public const MODE StandardSoundModes_Stream = _2D | CREATESTREAM | ACCURATETIME

Field Value

MODE

Methods

CreateSound(string, MODE)

Creates a FMOD.Sound instance from a path. Can be stored and later used with TryPlaySound(Sound, Bus, out Channel)
public static Sound CreateSound(string path, MODE mode = MODE.DEFAULT)

Parameters

path string
The path of the sound. Relative to the base game folder.
mode MODE

Returns

Sound
The FMOD.Sound instance

CreateSound(AudioClip, MODE)

Creates a FMOD.Sound instance from an UnityEngine.AudioClip. Can be stored and later used with TryPlaySound(Sound, Bus, out Channel)
public static Sound CreateSound(AudioClip audio, MODE mode = MODE.DEFAULT)

Parameters

audio AudioClip
the AudioClip to make a Sound instance of.
mode MODE

Returns

Sound
The FMOD.Sound instance.

CreateSounds(IEnumerable<string>, MODE)

Converts a sound paths collection to an FMOD FMOD.Sound collection.
public static IEnumerable<Sound> CreateSounds(IEnumerable<string> soundPaths, MODE mode = MODE.DEFAULT)

Parameters

soundPaths IEnumerable<string>
Sound paths to create from. Relative to the base game folder
mode MODE
The mode to set the sound to

Returns

IEnumerable<Sound>
A collection of FMOD Sounds.

CreateSounds(IEnumerable<AudioClip>, MODE)

Creates an FMOD FMOD.Sound collection from an UnityEngine.AudioClip collection.
public static IEnumerable<Sound> CreateSounds(IEnumerable<AudioClip> clips, MODE mode = MODE.DEFAULT)

Parameters

clips IEnumerable<AudioClip>
AudioClips to create from.
mode MODE
The mode to set the sound to

Returns

IEnumerable<Sound>
A collection of FMOD Sounds.

GetFmodAsset(string, string)

Returns a new FMODAsset with the given parameters. An FMODAsset is a data object that is required for various audio-related classes and methods, since it holds references to internal sound IDs.

A list of vanilla sound paths for SN1 can also be viewed at this URL: https://github.com/SubnauticaModding/Nautilus/tree/master/Nautilus/Documentation/resources/SN1-FMODEvents.txt.

The best way to assign a "path" to a custom sound asset is through RegisterCustomSound(string, Sound, string).

public static FMODAsset GetFmodAsset(string path, string id = null)

Parameters

path string

An FMOD Event's 'path' is the part read by most audio systems within Subnautica.

For custom sounds, should be identical to the ID passed into the methods when creating sounds with the CustomSoundHandler class.

For vanilla sounds, please refer to the list of all sound events.

id string
The internal sound ID, typically unused but occasionally required. Will be set as path if unassigned.

Returns

FMODAsset

TryPlaySound(Sound, Bus, out Channel)

Plays a FMOD.Sound on the specified FMOD.Studio.Bus.
public static bool TryPlaySound(Sound sound, Bus bus, out Channel channel)

Parameters

sound Sound
The sound which should be played.
bus Bus
The bus to play the sound on.
channel Channel
The channel on which the sound was created.

Returns

bool
If the sound was reported as played.

TryPlaySound(Sound, string, out Channel)

Plays a FMOD.Sound on the specified FMOD.Studio.Bus.
public static bool TryPlaySound(Sound sound, string busPath, out Channel channel)

Parameters

sound Sound
The sound which should be played.
busPath string
The path to the bus to play the sound on.
channel Channel
The channel on which the sound was created.

Returns

bool
If the sound was reported as played.