Terraria ModLoader  0.10.1.5
A framework for 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)
 

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

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  }
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:12
static readonly IDictionary< SoundType, int > nextSound
Definition: SoundLoader.cs:13

Member Function Documentation

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.

References Terraria.ModLoader.ModContent.GetMusic(), and Terraria.ModLoader.ModContent.GetSound().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 40 of file SoundLoader.cs.

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

40  {
41  return nextSound[type];
42  }
static readonly IDictionary< SoundType, int > nextSound
Definition: SoundLoader.cs:13

+ Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 21 of file SoundLoader.cs.

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

Definition at line 13 of file SoundLoader.cs.