Class CustomSoundHandler
A handler class for adding and overriding Sounds. Also see the AudioUtils class.
public static class CustomSoundHandler
- Inheritance
-
CustomSoundHandler
- Inherited Members
Methods
RegisterCustomSound(string, Sound, Bus)
Register a Custom sound that has been loaded using AudioUtils. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static void RegisterCustomSound(string id, Sound sound, Bus bus)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
sound
Sound- The pre loaded sound
bus
Bus- The bus to play the sound on.
RegisterCustomSound(string, Sound, string)
Register a Custom sound that has been loaded using AudioUtils. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static void RegisterCustomSound(string id, Sound sound, string busPath)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
sound
Sound- The pre loaded sound
busPath
string- The bus path to play the sound on.
RegisterCustomSound(string, IFModSound)
Registers a Custom sound by an IFModSound instance. IFModSound instances have custom logic for playing sounds.
public static void RegisterCustomSound(string id, IFModSound fModSound)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
fModSound
IFModSound- The sound IFModSound object to register.
RegisterCustomSound(string, string, Bus, MODE)
Register a Custom sound by file path. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static Sound RegisterCustomSound(string id, string filePath, Bus bus, MODE mode = MODE.DEFAULT)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
filePath
string- The file path on disk of the sound file to load.
bus
Bus- The bus to play the sound on.
mode
MODE- The audio MODE of the sound. Standard values of this property can be found in the AudioUtils class (i.e. StandardSoundModes_3D).
Returns
- Sound
- the FMOD.Sound loaded
RegisterCustomSound(string, string, string, MODE)
Register a Custom sound by file path. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static Sound RegisterCustomSound(string id, string filePath, string busPath, MODE mode = MODE.DEFAULT)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
filePath
string- The file path on disk of the sound file to load.
busPath
string- The bus path to play the sound on.
mode
MODE- The audio MODE of the sound. Standard values of this property can be found in the AudioUtils class (i.e. StandardSoundModes_3D).
Returns
- Sound
- the FMOD.Sound loaded
RegisterCustomSound(string, AudioClip, Bus, MODE)
Register a custom sound by an UnityEngine.AudioClip instance. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static Sound RegisterCustomSound(string id, AudioClip audio, Bus bus, MODE mode = MODE.DEFAULT)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
audio
AudioClip- The AudioClip to register.
bus
Bus- The bus to play the sound on.
mode
MODE- The audio MODE of the sound. Standard values of this property can be found in the AudioUtils class (i.e. StandardSoundModes_3D).
Returns
- Sound
- the FMOD.Sound loaded
RegisterCustomSound(string, AudioClip, string, MODE)
Register a custom sound by an UnityEngine.AudioClip instance. Some vanilla game sounds can be overridden by matching the id to the FMODAsset.path.
public static Sound RegisterCustomSound(string id, AudioClip audio, string busPath, MODE mode = MODE.DEFAULT)
Parameters
id
string- The Id of your custom sound which is used when checking which sounds to play.
audio
AudioClip- The AudioClip to register.
busPath
string- The bus path to play the sound on.
mode
MODE- The audio MODE of the sound. Standard values of this property can be found in the AudioUtils class (i.e. StandardSoundModes_3D).
Returns
- Sound
- the FMOD.Sound loaded
TryGetCustomSound(string, out Sound)
Try to get a registered custom FMOD.Sound.
public static bool TryGetCustomSound(string id, out Sound sound)
Parameters
id
string- The Id of the custom sound
sound
Sound- Outputs the FMOD.Sound if found and null if not found.
Returns
- bool
- true or false depending on if the id was found
TryGetCustomSoundChannel(int, out Channel)
Try to get a playing custom sound channel for an emitter
public static bool TryGetCustomSoundChannel(int id, out Channel channel)
Parameters
id
int- The emitter's ID, can be retrieved by calling
object.GetInstanceID()
. channel
Channel- Outputs the FMOD.Channel.
Returns
- bool
- True if found, otherwise false.
TryPlayCustomSound(string, out Channel)
Try to find and play a custom FMOD.Sound that has been registered.
public static bool TryPlayCustomSound(string id, out Channel channel)
Parameters
id
string- The Id of the custom sound
channel
Channel- the FMOD.Channel the sound is playing on.