$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <vector>
#include "unit.h"
#include "unitsound.h"
#include "player.h"
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 |
#define | CallbackMusicOn() CallbackMusic = true; |
Turn music stopped callback on. | |
#define | CallbackMusicOff() CallbackMusic = false; |
Turn music stopped callback off. | |
GameSound | GameSounds |
bool | CallbackMusic |
Game sound configuration. | |
int | DistanceSilent |
flag true callback ccl if stops | |
void | PlayUnitSound (const CUnit &unit, UnitVoiceGroup unit_voice_group) |
Play a unit sound. | |
void | PlayUnitSound (const CUnit &unit, CSound *sound) |
Play a unit sound. | |
void | PlayMissileSound (const Missile *missile, CSound *sound) |
Play a missile sound. | |
void | PlayGameSound (CSound *sound, unsigned char volume) |
Play a game sound. | |
int | PlayFile (const std::string &name, LuaActionListener *listener=NULL) |
Play a sound file. | |
void | SetSoundRange (CSound *sound, unsigned char range) |
Modify the range of a given sound. | |
CSound * | RegisterSound (const char *files[], unsigned int number) |
Register a sound (can be a simple sound or a group). | |
CSound * | RegisterTwoGroups (CSound *first, CSound *second) |
Create a special sound group with two sounds. | |
void | InitSoundClient () |
Initialize client side of the sound layer. | |
void | CheckMusicFinished (bool force=false) |
Check if music is finished and play the next song. | |
void | InitMusic () |
Initialize music. | |
void | MapSound (const std::string &sound_name, CSound *id) |
Map sound to identifier. | |
CSound * | SoundForName (const std::string &sound_name) |
Get the sound id bound to an identifier. | |
CSound * | MakeSound (const std::string &sound_name, const char *file[], int nb) |
Make a sound bound to identifier. | |
CSound * | MakeSoundGroup (const std::string &name, CSound *first, CSound *second) |
Make a sound group bound to identifier. | |
void | SoundCclRegister () |
register ccl features |
#define CallbackMusicOff | ( | ) | CallbackMusic = false; |
Turn music stopped callback off.
#define CallbackMusicOn | ( | ) | CallbackMusic = true; |
Turn music stopped callback on.
#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)
void CheckMusicFinished | ( | bool | force | ) |
Check if music is finished and play the next song.
Check if music is finished and play the next song
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 char * | file[], | |||
int | nb | |||
) |
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 |
void MapSound | ( | const std::string & | name, | |
CSound * | id | |||
) |
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 |
void PlayGameSound | ( | CSound * | sound, | |
unsigned char | volume | |||
) |
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 | |||
) |
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 char * | files[], | |
unsigned int | number | |||
) |
Register a sound (can be a simple sound or a group).
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 |
void SetSoundRange | ( | CSound * | sound, | |
unsigned char | range | |||
) |
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. |
bool CallbackMusic |
Game sound configuration.
int DistanceSilent |
flag true callback ccl if stops
global range control (max cut off distance for sound)
Various sounds used in game.