Cafu Engine
SoundShaderT Class Reference

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...
 

Detailed Description

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.

Member Enumeration Documentation

Determines how a sound file is loaded into memory.

Enumerator
AUTO 

The sound system decides how to load the sound file associated with this shader.

STATIC 

Load whole sound decrompressed into memory (used for small files).

STREAM 

Stream sound into memory (decrompressed).

COMPRESSED 

Load whole sound compressed into memory (lower memory usage, but higher CPU usage).

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.

Constructor & Destructor Documentation

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.

Parameters
SoundShaderNameName 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.

Parameters
SoundShaderNameName of the sound shader as specified in the material script.
TextParserThe textparser that is currently parsing a sound shader script (must be at the position of this sound shaders definition).
ModDirThe directory of the MOD this shader is created in relative to the executables directory.

Member Data Documentation

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.


The documentation for this class was generated from the following files: