tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.ModSound Class Reference

This class allows you to customize how a sound you add is played. To use this, pass an instance to Mod.AddSound, or if you are autoloading sounds, give an overriding class the same name as the file with the sound you are adding. More...

Public Member Functions

virtual SoundEffectInstance PlaySound (ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type)
 Override this hook to customize how this sound is played. If this sound is already currently playing, you have the option to call soundInstance.Stop(). You must eventually assign the result of sound.CreateInstance() to soundInstace. Afterwards, you can modify soundInstance.Volume, soundInstance.Pan, and soundInstance.Pitch to your liking. The default volume and pan have been passed as parameters. Volume measures loudness, pan measures how far to the left or right the sound is, and pitch measures the octave. Finally, call Main.PlaySoundInstance(soundInstance). More...
 

Properties

SoundEffect sound [get, set]
 The SoundEffect instance of the sound that this ModSound controls. This is here so you can call CreateInstance on it. More...
 

Detailed Description

This class allows you to customize how a sound you add is played. To use this, pass an instance to Mod.AddSound, or if you are autoloading sounds, give an overriding class the same name as the file with the sound you are adding.

Definition at line 8 of file ModSound.cs.

Member Function Documentation

◆ PlaySound()

virtual SoundEffectInstance Terraria.ModLoader.ModSound.PlaySound ( ref SoundEffectInstance  soundInstance,
float  volume,
float  pan,
SoundType  type 
)
virtual

Override this hook to customize how this sound is played. If this sound is already currently playing, you have the option to call soundInstance.Stop(). You must eventually assign the result of sound.CreateInstance() to soundInstace. Afterwards, you can modify soundInstance.Volume, soundInstance.Pan, and soundInstance.Pitch to your liking. The default volume and pan have been passed as parameters. Volume measures loudness, pan measures how far to the left or right the sound is, and pitch measures the octave. Finally, call Main.PlaySoundInstance(soundInstance).

Definition at line 21 of file ModSound.cs.

21 {
22 return soundInstance;
23 }

Property Documentation

◆ sound

SoundEffect Terraria.ModLoader.ModSound.sound
getset

The SoundEffect instance of the sound that this ModSound controls. This is here so you can call CreateInstance on it.

Definition at line 13 of file ModSound.cs.

13 {
14 get;
15 internal set;
16 }