tModLoader v2023.01
A mod to make and play Terraria mods
|
This data type describes in detail how a sound should be played.
Passable to the SoundEngine.PlaySound(in SoundStyle, Vector2?) method.
More...
Public Member Functions | |
SoundStyle (string soundPath, int numVariants, SoundType type=SoundType.Sound) | |
SoundStyle (string soundPath, int variantSuffixesStart, int numVariants, SoundType type=SoundType.Sound) | |
SoundStyle (string soundPath, ReadOnlySpan< int > variants, SoundType type=SoundType.Sound) | |
SoundStyle (string soundPath, ReadOnlySpan<(int variant, float weight)> weightedVariants, SoundType type=SoundType.Sound) | |
SoundStyle (string soundPath, SoundType type=SoundType.Sound) | |
float | GetRandomPitch () |
SoundEffect | GetRandomSound () |
bool | IsTheSameAs (SoundStyle style) |
SoundStyle | WithPitchOffset (float offset) |
SoundStyle | WithVolumeScale (float scale) |
Properties | |
string? | Identifier = null [get, set] |
If defined, this string will be the only thing used to determine which styles should instances be shared with. | |
bool | IsLooped = false [get, set] |
Whether or not to loop played sounds. | |
int | MaxInstances = 1 [get, set] |
The max amount of sound instances that this style will allow creating, before stopping a playing sound or refusing to play a new one. Set to 0 for no limits. | |
float | Pitch [get, set] |
The pitch offset to play sounds with. In XNA and FNA, Pitch ranges from -1.0f (down one octave) to 1.0f (up one octave). 0.0f is unity (normal) pitch. | |
float float maxPitch | PitchRange [get, set] |
float | PitchVariance [get, set] |
The pitch offset randomness value. Cannot be negative. With Pitch at 0.0, and PitchVariance at 1.0, used pitch will range from -0.5 to 0.5. In XNA and FNA, Pitch ranges from -1.0f (down one octave) to 1.0f (up one octave). 0.0f is unity (normal) pitch. | |
bool | PlayOnlyIfFocused = false [get, set] |
If true, this sound won't play if the game's window isn't selected. | |
SoundLimitBehavior | SoundLimitBehavior = SoundLimitBehavior.ReplaceOldest [get, set] |
Determines what the action taken when the max amount of sound instances is reached. | |
string | SoundPath [get, set] |
The sound effect to play. | |
SoundType | Type [get, set] |
Controls which volume setting will this be affected by. Ambience sounds also don't play when the game is out of focus. | |
ReadOnlySpan< int > | Variants [get, set] |
An array of possible suffixes to randomly append to after SoundPath. Setting this property resets VariantsWeights. | |
ReadOnlySpan< float > | VariantsWeights [get, set] |
An array of randomization weights to optionally go with Variants. Set this last, if at all, as the Variants's setter resets all weights data. | |
float | Volume [get, set] |
The volume multiplier to play sounds with. | |
This data type describes in detail how a sound should be played.
Passable to the SoundEngine.PlaySound(in SoundStyle, Vector2?) method.