A SoundShader is a description of a sound with various properties. More...
#include "SoundShader.hpp"
Public Types | |
enum | SoundGroupE { SOUND_MUSIC, SOUND_EFFECT, SOUND_PLAYER, SOUND_AMBIENT } |
SoundType is used to change properties of all sounds from a specific type in the game code. More... | |
enum | LoadTypeE { AUTO, STATIC, STREAM, COMPRESSED } |
Determines how a sound file is loaded into memory. More... | |
Public Member Functions | |
SoundShaderT (const std::string &SoundShaderName="") | |
Default constructor used to create an "empty" sound shader with default parameters. More... | |
SoundShaderT (const std::string &SoundShaderName, TextParserT &TextParser, const std::string &ModDir) | |
Constructor to create a sound shader from a scriptfile using the passed TextParser. More... | |
Public Attributes | |
const std::string | Name |
The name of the sound shader. More... | |
std::string | AudioFile |
The sound file this shader is associated with. More... | |
float | InnerVolume |
The volume of this sound (inside its sound cone/at minimal distance). 1.0 meaning 100% volume and 0.0 mute sound. More... | |
float | OuterVolume |
The sounds volume if listener is outside the sound cone. More... | |
float | InnerConeAngle |
The inner angle of the cone in which the sound is emited at normal volume. More... | |
float | OuterConeAngle |
The outer angle of the cone outside which the sound is emited at outside volume. More... | |
float | MinDistance |
The minimum distance that the sound will cease to continue growing louder at (stays at max. volume). More... | |
float | MaxDistance |
The maximum distance that the sound will cease to attenuate. More... | |
int | NrOfLoops |
The number of times this sound should be looped. -1 for infinite, 1 for one time sounds. More... | |
float | Pause |
Pause in seconds between two loops. More... | |
float | RollOfFactor |
The factor at which the sound is attenuated when listener is outside min distance. More... | |
float | Pitch |
Pitch muliplier for this sound. More... | |
unsigned int | Priority |
Priority for sounds using this shader (higher values mean higher priority). More... | |
SoundGroupE | SoundGroup |
Determines the group this sound belongs to. More... | |
LoadTypeE | LoadType |
Determines the way this sound shaders file is loaded into memory. More... | |
A SoundShader is a description of a sound with various properties.
These properties can be specified by the user through a sound shader script. The sound system uses a sound shader to load soundfiles and play them with sound shader specific properties.
Determines how a sound file is loaded into memory.
SoundType is used to change properties of all sounds from a specific type in the game code.
e.g. Turn volume of player effects down.
Enumerator | |
---|---|
SOUND_MUSIC |
Background music. |
SOUND_EFFECT |
Effects like gunshots etc. |
SOUND_PLAYER |
Player sounds like footsteps etc. |
SOUND_AMBIENT |
Ambient sounds like birds. |
SoundShaderT::SoundShaderT | ( | const std::string & | SoundShaderName = "" | ) |
Default constructor used to create an "empty" sound shader with default parameters.
This is useful to create a custom sound shader from game code and adjust its parameters manually.
SoundShaderName | Name of this soundshader (since shaders of this kind are never registered with the global sound shader manager, their names don't need to be unique or set at all). |
SoundShaderT::SoundShaderT | ( | const std::string & | SoundShaderName, |
TextParserT & | TextParser, | ||
const std::string & | ModDir | ||
) |
Constructor to create a sound shader from a scriptfile using the passed TextParser.
This constructor is used by the sound shader manager to load sound shaders from script files. Throws TextParserT::ParseError on failure.
SoundShaderName | Name of the sound shader as specified in the material script. |
TextParser | The textparser that is currently parsing a sound shader script (must be at the position of this sound shaders definition). |
ModDir | The directory of the MOD this shader is created in relative to the executables directory. |
std::string SoundShaderT::AudioFile |
The sound file this shader is associated with.
float SoundShaderT::InnerConeAngle |
The inner angle of the cone in which the sound is emited at normal volume.
float SoundShaderT::InnerVolume |
The volume of this sound (inside its sound cone/at minimal distance). 1.0 meaning 100% volume and 0.0 mute sound.
LoadTypeE SoundShaderT::LoadType |
Determines the way this sound shaders file is loaded into memory.
float SoundShaderT::MaxDistance |
The maximum distance that the sound will cease to attenuate.
float SoundShaderT::MinDistance |
The minimum distance that the sound will cease to continue growing louder at (stays at max. volume).
const std::string SoundShaderT::Name |
The name of the sound shader.
int SoundShaderT::NrOfLoops |
The number of times this sound should be looped. -1 for infinite, 1 for one time sounds.
float SoundShaderT::OuterConeAngle |
The outer angle of the cone outside which the sound is emited at outside volume.
float SoundShaderT::OuterVolume |
The sounds volume if listener is outside the sound cone.
float SoundShaderT::Pause |
Pause in seconds between two loops.
float SoundShaderT::Pitch |
Pitch muliplier for this sound.
unsigned int SoundShaderT::Priority |
Priority for sounds using this shader (higher values mean higher priority).
float SoundShaderT::RollOfFactor |
The factor at which the sound is attenuated when listener is outside min distance.
SoundGroupE SoundShaderT::SoundGroup |
Determines the group this sound belongs to.