_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "sound.h"
#include "action/action_resource.h"
#include "map.h"
#include "missile.h"
#include "sound_server.h"
#include "ui.h"
#include "unit.h"
#include "video.h"
#include "widgets.h"
Classes | |
struct | SelectionHandling |
sound.cpp - The sound. | |
GameSound | GameSounds |
SelectionHandling | SelectionHandler |
FIXME: docu. More... | |
static int | ViewPointOffset |
int | DistanceSilent |
Distance to Volume Mapping. More... | |
static std::map< int, LuaActionListener * > | ChannelMap |
static std::map< int, Mix_Chunk * > | SampleMap |
static Mix_Chunk * | SimpleChooseSample (const CSound &sound) |
silent distance More... | |
static Mix_Chunk * | ChooseSample (CSound *sound, bool selection, Origin &source) |
static CSound * | ChooseUnitVoiceSound (const CUnit &unit, UnitVoiceGroup voice) |
unsigned char | VolumeForDistance (unsigned short d, unsigned char range) |
unsigned char | CalculateVolume (bool isVolume, int power, unsigned char range) |
Calculates volume level. More... | |
static char | CalculateStereo (const CUnit &unit) |
void | PlayUnitSound (const CUnit &unit, UnitVoiceGroup voice, bool sampleUnique) |
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) |
Play a game sound. More... | |
static void | PlaySoundFileCallback (int channel) |
int | PlayFile (const std::string &name, LuaActionListener *listener) |
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... | |
|
static |
Calculate the stereo value 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.
Choose the sample to play
|
static |
Maps a UnitVoiceGroup to a CSound*.
unit | Sound initiator |
voice | Type of sound wanted |
void InitSoundClient | ( | ) |
Initialize client side of the sound layer.
Lookup the sound id's for the game sounds.
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 |
|
static |
Callback for PlaySoundFile
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. |
|
static |
silent distance
"Randomly" choose a sample from a sound group.
unsigned char VolumeForDistance | ( | unsigned short | d, |
unsigned char | range | ||
) |
Compute a suitable volume for something taking place at a given distance from the current view point.
d | distance |
range | range |
|
static |
int DistanceSilent |
Distance to Volume Mapping.
Game sound configuration.
GameSound GameSounds |
Various sounds used in game.
|
static |
SelectionHandling SelectionHandler |
FIXME: docu.
|
static |