|
TModLoader v1.4.4.9
TModLoader source code documentation
|
This data type describes in detail how a sound should be played.
Passable to the M:Terraria.Audio.SoundEngine.PlaySound(Terraria.Audio.SoundStyle@,System.Nullable<Microsoft.Xna.Framework.Vector2>,Terraria.Audio.SoundUpdateCallback) method.
More...
Collaboration diagram for Terraria.Audio.SoundStyle:Public Member Functions | |
| SoundStyle (string soundPath, SoundType type=SoundType.Sound) | |
| 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) | |
| bool | IsTheSameAs (SoundStyle style) |
| SoundEffect | GetRandomSound () |
| float | GetRandomPitch () |
| SoundStyle | WithVolumeScale (float scale) |
| SoundStyle | WithPitchOffset (float offset) |
| override readonly int | GetHashCode () |
| readonly bool | Equals (SoundStyle other) |
Public Attributes | |
| float | minPitch |
| A helper property for controlling both Pitch and PitchVariance at once. | |
Package Functions | |
| SoundStyle | WithVolume (float volume) |
| SoundStyle | WithPitchVariance (float pitchVariance) |
Properties | |
| 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. | |
| string? | Identifier [get, set] |
| If defined, this string will be the only thing used to determine which styles should instances be shared with. | |
| int | MaxInstances [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. | |
| SoundLimitBehavior | SoundLimitBehavior [get, set] |
| Determines what the action taken when the max amount of sound instances is reached. | |
| bool | PlayOnlyIfFocused [get, set] |
| If true, this sound won't play if the game's window isn't selected. | |
| bool | IsLooped [get, set] |
| Whether or not to loop played sounds. | |
| bool | UsesMusicPitch [get, set] |
| Whether or not this sound obeys the F:Terraria.Main.musicPitch field to decide its pitch. Defaults to false. Used in vanilla by the sounds for the Bell, the (Magical) Harp, and The Axe. Could prove useful, but is kept internal for the moment. | |
| ReadOnlySpan< int > | Variants [get, set] |
| An array of possible suffixes to randomly append to after P:Terraria.Audio.SoundStyle.SoundPath. Setting this property resets P:Terraria.Audio.SoundStyle.VariantsWeights. | |
| ReadOnlySpan< float > | VariantsWeights [get, set] |
| An array of randomization weights to optionally go with P:Terraria.Audio.SoundStyle.Variants. Set this last, if at all, as the P:Terraria.Audio.SoundStyle.Variants's setter resets all weights data. | |
| float | Volume [get, set] |
| The volume multiplier to play sounds with. | |
| float | Pitch [get, set] |
| The pitch offset to play sounds with. | |
| 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. | |
| float float maxPitch | PitchRange [get, set] |
Private Member Functions | |
| int | GetRandomVariantIndex () |
| bool | PrintMembers (StringBuilder builder) |
Static Private Member Functions | |
| static int[] | CreateVariants (int start, int count) |
Private Attributes | |
| int?[] | variants |
| float?[] | variantsWeights |
| float? | totalVariantWeight |
| float | volume |
| float | pitch |
| float | pitchVariance |
| Asset< SoundEffect >? | effectCache |
| Asset< SoundEffect >??[] | variantsEffectCache |
Static Private Attributes | |
| const float | MinPitchValue = -1f |
| const float | MaxPitchValue = 1f |
| static readonly UnifiedRandom | Random = new UnifiedRandom() |
This data type describes in detail how a sound should be played.
Passable to the M:Terraria.Audio.SoundEngine.PlaySound(Terraria.Audio.SoundStyle@,System.Nullable<Microsoft.Xna.Framework.Vector2>,Terraria.Audio.SoundUpdateCallback) method.
Definition at line 18 of file SoundStyle.cs.