tModLoader  0.12 Alpha
A mod to make and play Terraria mods
Terraria.ModLoader.SoundLoader Class Reference

This class is used to keep track of and support the existence of custom sounds that have been added to the game. More...

Static Public Member Functions

static void AddSound (Mod mod, string soundPath, ModSound modSound=null)
 Adds the given sound file to the game as the given type of sound and with the given custom sound playing. If no ModSound instance is provided, the custom sound will play in a similar manner as the default vanilla ones. More...
 
static LegacySoundStyle GetLegacySoundSlot (Mod mod, string soundPath)
 Returns a LegacySoundStyle object which encapsulates both a sound type and a sound style (This is the new way to do sounds in 1.3.4) Returns null if there is no corresponding style. More...
 
static LegacySoundStyle GetLegacySoundSlot (string sound)
 Returns a LegacySoundStyle object which encapsulates both a sound type and a sound style (This is the new way to do sounds in 1.3.4) Returns null if there is no corresponding style. More...
 
static int GetSoundSlot (Mod mod, string soundPath)
 Returns the style (last parameter passed to Main.PlaySound) of the sound corresponding to the given sound file path. Returns 0 if there is no corresponding style. More...
 
static int GetSoundSlot (string fullSoundPath)
 Returns the style (last parameter passed to Main.PlaySound) of the sound corresponding to the given full sound file path. Returns 0 if there is no corresponding style. More...
 

Static Public Attributes

static readonly int CustomSoundType = 500
 This value should be passed as the first parameter to Main.PlaySound whenever you want to play a custom sound that is not an item, npcHit, or npcKilled sound. More...
 

Properties

static int SoundCount [get, set]
 

Detailed Description

This class is used to keep track of and support the existence of custom sounds that have been added to the game.

Member Function Documentation

◆ AddSound()

static void Terraria.ModLoader.SoundLoader.AddSound ( Mod  mod,
string  soundPath,
ModSound  modSound = null 
)
static

Adds the given sound file to the game as the given type of sound and with the given custom sound playing. If no ModSound instance is provided, the custom sound will play in a similar manner as the default vanilla ones.

Parameters
ModThe mod.
soundPathThe sound path.
modSoundThe mod sound.

◆ GetLegacySoundSlot() [1/2]

static LegacySoundStyle Terraria.ModLoader.SoundLoader.GetLegacySoundSlot ( Mod  mod,
string  soundPath 
)
static

Returns a LegacySoundStyle object which encapsulates both a sound type and a sound style (This is the new way to do sounds in 1.3.4) Returns null if there is no corresponding style.

◆ GetLegacySoundSlot() [2/2]

static LegacySoundStyle Terraria.ModLoader.SoundLoader.GetLegacySoundSlot ( string  sound)
static

Returns a LegacySoundStyle object which encapsulates both a sound type and a sound style (This is the new way to do sounds in 1.3.4) Returns null if there is no corresponding style.

◆ GetSoundSlot() [1/2]

static int Terraria.ModLoader.SoundLoader.GetSoundSlot ( Mod  mod,
string  soundPath 
)
static

Returns the style (last parameter passed to Main.PlaySound) of the sound corresponding to the given sound file path. Returns 0 if there is no corresponding style.

◆ GetSoundSlot() [2/2]

static int Terraria.ModLoader.SoundLoader.GetSoundSlot ( string  fullSoundPath)
static

Returns the style (last parameter passed to Main.PlaySound) of the sound corresponding to the given full sound file path. Returns 0 if there is no corresponding style.

Member Data Documentation

◆ CustomSoundType

readonly int Terraria.ModLoader.SoundLoader.CustomSoundType = 500
static

This value should be passed as the first parameter to Main.PlaySound whenever you want to play a custom sound that is not an item, npcHit, or npcKilled sound.