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

Inherits Terraria.ModLoader.ILoader.

Static Public Member Functions

static void AddMusic (Mod mod, string musicPath)
 Registers a new music track with the provided mod and its local path to the sound file. More...
 
static void AddMusicBox (Mod mod, int musicSlot, int itemType, int tileType, int tileFrameY=0)
 Allows you to tie a music ID, and item ID, and a tile ID together to form a music box.
When music with the given ID is playing, equipped music boxes have a chance to change their ID to the given item type.
When an item with the given item type is equipped, it will play the music that has musicSlot as its ID.
When a tile with the given type and Y-frame is nearby, if its X-frame is >= 36, it will play the music that has musicSlot as its ID. More...
 
static IAudioTrack GetMusic (Mod mod, string musicPath)
 Gets the music track with the specified mod path. The path must not have a file extension. More...
 
static IAudioTrack GetMusic (string musicPath)
 Gets the music track with the specified full path. The path must be prefixed with a mod name and must not have a file extension. More...
 
static int GetMusicSlot (Mod mod, string musicPath)
 Gets the music id of the track with the specified mod path. The path must not have a file extension. More...
 
static int GetMusicSlot (string musicPath)
 Gets the music id of the track with the specified full path. The path must be prefixed with a mod name and must not have a file extension. More...
 
static bool MusicExists (Mod mod, string musicPath)
 Returns whether or not a music track with the specified mod path exists. The path must not have a file extension. More...
 
static bool MusicExists (string musicPath)
 Returns whether or not a music track with the specified path exists. The path must be prefixed with a mod name and must not have a file extension. More...
 

Properties

static int MusicCount = MusicID.Count [get]
 

Member Function Documentation

◆ AddMusic()

static void Terraria.ModLoader.MusicLoader.AddMusic ( Mod  mod,
string  musicPath 
)
static

Registers a new music track with the provided mod and its local path to the sound file.

Parameters
modThe mod that owns the music track.
musicPathThe provided mod's local path to the music track file, case-sensitive and without extensions.

◆ AddMusicBox()

static void Terraria.ModLoader.MusicLoader.AddMusicBox ( Mod  mod,
int  musicSlot,
int  itemType,
int  tileType,
int  tileFrameY = 0 
)
static

Allows you to tie a music ID, and item ID, and a tile ID together to form a music box.
When music with the given ID is playing, equipped music boxes have a chance to change their ID to the given item type.
When an item with the given item type is equipped, it will play the music that has musicSlot as its ID.
When a tile with the given type and Y-frame is nearby, if its X-frame is >= 36, it will play the music that has musicSlot as its ID.

Parameters
modThe music slot.
musicSlotThe music slot.
itemTypeType of the item.
tileTypeType of the tile.
tileFrameYThe tile frame y.
Exceptions
ArgumentOutOfRangeExceptionCannot assign music box to vanilla music id. or The provided music id does not exist. or Cannot assign music box to a vanilla item id. or The provided item id does not exist. or Cannot assign music box to a vanilla tile id. or The provided tile id does not exist
ArgumentExceptionThe provided music id has already been assigned a music box. or The provided item id has already been assigned a music. or Y-frame must be divisible by 36

◆ GetMusic() [1/2]

static IAudioTrack Terraria.ModLoader.MusicLoader.GetMusic ( Mod  mod,
string  musicPath 
)
static

Gets the music track with the specified mod path. The path must not have a file extension.

◆ GetMusic() [2/2]

static IAudioTrack Terraria.ModLoader.MusicLoader.GetMusic ( string  musicPath)
static

Gets the music track with the specified full path. The path must be prefixed with a mod name and must not have a file extension.

◆ GetMusicSlot() [1/2]

static int Terraria.ModLoader.MusicLoader.GetMusicSlot ( Mod  mod,
string  musicPath 
)
static

Gets the music id of the track with the specified mod path. The path must not have a file extension.

◆ GetMusicSlot() [2/2]

static int Terraria.ModLoader.MusicLoader.GetMusicSlot ( string  musicPath)
static

Gets the music id of the track with the specified full path. The path must be prefixed with a mod name and must not have a file extension.

◆ MusicExists() [1/2]

static bool Terraria.ModLoader.MusicLoader.MusicExists ( Mod  mod,
string  musicPath 
)
static

Returns whether or not a music track with the specified mod path exists. The path must not have a file extension.

◆ MusicExists() [2/2]

static bool Terraria.ModLoader.MusicLoader.MusicExists ( string  musicPath)
static

Returns whether or not a music track with the specified path exists. The path must be prefixed with a mod name and must not have a file extension.