tModLoader v2024.10
A mod to make and play Terraria mods
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, SoundUpdateCallback? updateCallback=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, SoundUpdateCallback? updateCallback=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 SoundPlayer SoundPlayer
 

Properties

static bool IsAudioSupported [get]
 

Member Function Documentation

◆ PlaySound() [1/2]

static SlotId SoundEngine.PlaySound ( in SoundStyle  style,
Vector2?  position = null,
SoundUpdateCallback?  updateCallback = 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.
updateCallbackA callback for customizing the behavior of the created sound instance, like tying its existence to a projectile using ProjectileAudioTracker.

◆ PlaySound() [2/2]

static SlotId SoundEngine.PlaySound ( in SoundStyle style,
Vector2?  position = null,
SoundUpdateCallback?  updateCallback = 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.