Class AudioUtils
public static class AudioUtils
- Inheritance
-
AudioUtils
- Inherited Members
Fields
StandardSoundModes_2D
public const MODE StandardSoundModes_2D = _2D | ACCURATETIME
Field Value
- MODE
StandardSoundModes_3D
public const MODE StandardSoundModes_3D = _3D | ACCURATETIME | _3D_LINEARSQUAREROLLOFF
Field Value
- MODE
StandardSoundModes_Stream
public const MODE StandardSoundModes_Stream = _2D | CREATESTREAM | ACCURATETIME
Field Value
- MODE
Methods
CreateSound(string, MODE)
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)
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)
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)
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
stringAn 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)
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)
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.