_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
Go to the source code of this file.
Classes | |
class | GameSound |
class | CSound |
struct | Origin |
sound.h - The sound header file. | |
#define | MaxSampleVolume 255 |
#define | NO_SOUND 0 |
#define | ONE_SOUND 0 |
#define | TWO_GROUPS 1 |
#define | INFINITE_SOUND_RANGE 255 |
#define | MAX_SOUND_RANGE 254 |
enum | UnitVoiceGroup { VoiceSelected, VoiceAcknowledging, VoiceReady, VoiceHelpMe, VoiceDying, VoiceWorkCompleted, VoiceBuilding, VoiceDocking, VoiceRepairing, VoiceHarvesting, VoiceAttack, VoiceBuild } |
GameSound | GameSounds |
int | DistanceSilent |
Game sound configuration. More... | |
unsigned char | CalculateVolume (bool isVolume, int power, unsigned char range) |
Calculates volume level. More... | |
void | PlayUnitSound (const CUnit &unit, UnitVoiceGroup unit_voice_group, bool sampleUnique=false) |
Play a unit sound. More... | |
void | PlayUnitSound (const CUnit &unit, CSound *sound) |
Play a unit sound. More... | |
void | PlayMissileSound (const Missile &missile, CSound *sound) |
Play a missile sound. More... | |
void | PlayGameSound (CSound *sound, unsigned char volume, bool always=false) |
Play a game sound. More... | |
int | PlayFile (const std::string &name, LuaActionListener *listener=NULL) |
Play a sound file. More... | |
void | SetSoundRange (CSound *sound, unsigned char range) |
Modify the range of a given sound. More... | |
CSound * | RegisterSound (const std::vector< std::string > &files) |
Register a sound (can be a simple sound or a group) More... | |
CSound * | RegisterTwoGroups (CSound *first, CSound *second) |
Create a special sound group with two sounds. More... | |
void | InitSoundClient () |
Initialize client side of the sound layer. More... | |
void | InitMusic () |
Initialize music. More... | |
void | CallbackMusicEnable () |
Turn music stopped callback on. More... | |
void | CallbackMusicDisable () |
Skip the next music stopped callback invocation. More... | |
void | CallbackMusicTrigger () |
Turn music stopped callback on and trigger it immediately. More... | |
void | MapSound (const std::string &sound_name, CSound *id) |
Map sound to identifier. More... | |
CSound * | SoundForName (const std::string &sound_name) |
Get the sound id bound to an identifier. More... | |
CSound * | MakeSound (const std::string &sound_name, const std::vector< std::string > &files) |
Make a sound bound to identifier. More... | |
CSound * | MakeSoundGroup (const std::string &name, CSound *first, CSound *second) |
Make a sound group bound to identifier. More... | |
void | FreeSounds () |
void | SoundCclRegister () |
register ccl features More... | |
#define INFINITE_SOUND_RANGE 255 |
the range value that makes a sound volume distance independent
#define MAX_SOUND_RANGE 254 |
the maximum range value
#define MaxSampleVolume 255 |
#define NO_SOUND 0 |
#define ONE_SOUND 0 |
A possible value for Number in the Sound struct: means a simple sound
#define TWO_GROUPS 1 |
A possible value for Number in the Sound struct: means a double group (for selection/annoyed sounds)
enum UnitVoiceGroup |
Voice groups for a unit
unsigned char CalculateVolume | ( | bool | isVolume, |
int | power, | ||
unsigned char | range | ||
) |
Calculates volume level.
Calculate the volume associated with a request, either by clipping the range parameter of this request, or by mapping this range to a volume.
void CallbackMusicDisable | ( | ) |
Skip the next music stopped callback invocation.
void CallbackMusicEnable | ( | ) |
Turn music stopped callback on.
void CallbackMusicTrigger | ( | ) |
Turn music stopped callback on and trigger it immediately.
void FreeSounds | ( | ) |
void InitMusic | ( | ) |
Initialize music.
Init music
void InitSoundClient | ( | ) |
Initialize client side of the sound layer.
Lookup the sound id's for the game sounds.
CSound* MakeSound | ( | const std::string & | name, |
const std::vector< std::string > & | files | ||
) |
Make a sound bound to identifier.
Ask the sound server to register a sound and store the mapping between its name and its id. Register a sound group (or an unique sound if nb==1) and get the corresponding sound id.
name | name of this sound group (Freed by caller). |
file | list of sound file names |
nb | number of sounds |
Make a sound group bound to identifier.
Ask the sound server to build a special sound group.
Register two sound groups together to make a special sound (for selection). Return the corresponding id after registering it under a given name.
name | the name of the group (handled by caller). |
first | id of the first group |
second | id of the second group |
Map sound to identifier.
Add a new mapping (sound name to sound id) in the hash table Create a new mapping between a name and an already valid sound id.
name | Name of the sound (now freed by caller!). |
id | Sound identifier. |
int PlayFile | ( | const std::string & | name, |
LuaActionListener * | listener | ||
) |
Play a sound file.
Play a sound file
name | Filename of a sound to play |
listener | Optional lua callback |
Play a game sound.
Play a game sound
sound | Sound to play |
volume | Volume level to play the sound |
Play a missile sound.
Ask the sound server to play a sound for a missile.
missile | Sound initiator, missile exploding |
sound | Sound to be generated |
Play a unit sound.
Ask to the sound server to play a sound attached to a unit. The sound server may discard the sound if needed (e.g., when the same unit is already speaking).
unit | Sound initiator, unit speaking |
sound | Sound to be generated |
void PlayUnitSound | ( | const CUnit & | unit, |
UnitVoiceGroup | voice, | ||
bool | sampleUnique | ||
) |
Play a unit sound.
Ask to the sound server to play a sound attached to a unit. The sound server may discard the sound if needed (e.g., when the same unit is already speaking).
unit | Sound initiator, unit speaking |
voice | Type of sound wanted (Ready,Die,Yes,...) |
CSound* RegisterSound | ( | const std::vector< std::string > & | files | ) |
Register a sound (can be a simple sound or a group)
Ask the sound server to register a sound (and currently to load it) and to return an unique identifier for it. The unique identifier is memory pointer of the server.
files | An array of wav files. |
number | Number of files belonging together. |
Create a special sound group with two sounds.
Ask the sound server to put together two sounds to form a special sound.
first | first part of the group |
second | second part of the group |
Modify the range of a given sound.
Ask the sound server to change the range of a sound.
sound | the id of the sound to modify. |
range | the new range for this sound. |
void SoundCclRegister | ( | ) |
register ccl features
Register CCL features for sound.
CSound* SoundForName | ( | const std::string & | name | ) |
Get the sound id bound to an identifier.
Maps a sound name to its id
name | Sound name. |
int DistanceSilent |
GameSound GameSounds |
Various sounds used in game.