tModLoader v2023.01
A mod to make and play Terraria mods
Terraria.Audio.SoundEngine Class Reference

Static Public Member Functions

static ActiveSound FindActiveSound (in SoundStyle style)
 
static void Initialize ()
 
static void Load (IServiceProvider services)
 
static SlotId PlaySound (in SoundStyle style, Vector2? position=null)
 Attempts to play a sound with the provided sound style, and returns a valid SlotId handle to it on success. More...
 
static SlotId PlaySound (in SoundStyle? style, Vector2? position=null)
 Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid SlotId handle to it on success. More...
 
static void Reload ()
 
static void StopAmbientSounds ()
 
static void StopTrackedSounds ()
 
static bool TryGetActiveSound (SlotId slotId, [NotNullWhen(true)] out ActiveSound? result)
 
static void Update ()
 

Static Public Attributes

static bool AreSoundsPaused
 
static readonly object AudioLock = new object()
 
static SoundPlayer SoundPlayer
 

Properties

static bool IsAudioSupported [get]
 

Member Function Documentation

◆ PlaySound() [1/2]

static SlotId Terraria.Audio.SoundEngine.PlaySound ( in SoundStyle  style,
Vector2?  position = null 
)
static

Attempts to play a sound with the provided sound style, and returns a valid SlotId handle to it on success.

Parameters
styleThe sound style that describes everything about the played sound.
positionAn optional 2D position to play the sound at. When null, this sound will be heard everywhere.

◆ PlaySound() [2/2]

static SlotId Terraria.Audio.SoundEngine.PlaySound ( in SoundStyle style,
Vector2?  position = null 
)
static

Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid SlotId handle to it on success.