tModLoader v0.11.8.9
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...

+ Collaboration diagram for Terraria.ModLoader.SoundLoader:

Static Public Member Functions

static int GetSoundSlot (SoundType type, string sound)
 Returns the style (last parameter passed to Main.PlaySound) of the sound corresponding to the given SoundType and the given sound file path. Returns 0 if there is no corresponding style. More...
 
static int SoundCount (SoundType type)
 

Static Public Attributes

const int customSoundType = 50
 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...
 

Static Private Member Functions

static SoundLoader ()
 

Static Private Attributes

static readonly IDictionary< SoundType, int > nextSound = new Dictionary<SoundType, int>()
 

Detailed Description

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

Definition at line 11 of file SoundLoader.cs.

Constructor & Destructor Documentation

◆ SoundLoader()

static Terraria.ModLoader.SoundLoader.SoundLoader ( )
staticprivate

Definition at line 26 of file SoundLoader.cs.

26 {
27 foreach (SoundType type in Enum.GetValues(typeof(SoundType))) {
28 nextSound[type] = GetNumVanilla(type);
29 sounds[type] = new Dictionary<string, int>();
30 modSounds[type] = new Dictionary<int, ModSound>();
31 }
32 }
static readonly IDictionary< SoundType, int > nextSound
Definition: SoundLoader.cs:13
SoundType
This is an enum of the types of sound you can add to the game. This is used for determining whether a...
Definition: SoundType.cs:13

References Terraria.ModLoader.SoundLoader.nextSound.

Member Function Documentation

◆ GetSoundSlot()

static int Terraria.ModLoader.SoundLoader.GetSoundSlot ( SoundType  type,
string  sound 
)
static

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

Definition at line 47 of file SoundLoader.cs.

47 {
48 if (sounds[type].ContainsKey(sound)) {
49 return sounds[type][sound];
50 }
51 else {
52 return 0;
53 }
54 }

◆ SoundCount()

static int Terraria.ModLoader.SoundLoader.SoundCount ( SoundType  type)
static

Definition at line 40 of file SoundLoader.cs.

40 {
41 return nextSound[type];
42 }

References Terraria.ModLoader.SoundLoader.nextSound.

Referenced by Terraria.ModLoader.Mod.AddMusicBox().

+ Here is the caller graph for this function:

Member Data Documentation

◆ customSoundType

const int Terraria.ModLoader.SoundLoader.customSoundType = 50
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.

Definition at line 21 of file SoundLoader.cs.

◆ nextSound

readonly IDictionary<SoundType, int> Terraria.ModLoader.SoundLoader.nextSound = new Dictionary<SoundType, int>()
staticprivate