____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

sound_id.cpp File Reference

The sound id. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include <string>
#include <map>
#include "sound.h"
#include "sound_server.h"

Go to the source code of this file.

Functions

void MapSound (const std::string &name, CSound *id)
 < Map sound to identifier
CSoundSoundForName (const std::string &name)
 Make a sound bound to identifier.
CSoundMakeSound (const std::string &name, const char *file[], int nb)
 Make a sound group bound to identifier.
CSoundMakeSoundGroup (const std::string &name, CSound *first, CSound *second)

Variables

static std::map< std::string,
CSound * > 
SoundMap


Detailed Description

The sound id.

Definition in file sound_id.cpp.


Function Documentation

CSound* MakeSound ( const std::string &  name,
const char *  file[],
int  nb 
)

Make a sound group 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.

Parameters:
name name of this sound group (Freed by caller).
file list of sound file names
nb number of sounds
Returns:
the sound id of the created group

Definition at line 99 of file sound_id.cpp.

References _C_, Assert, DebugPrint, MapSound(), RegisterSound(), and SoundMap.

Referenced by CclMakeSound().

CSound* MakeSoundGroup ( const std::string &  name,
CSound first,
CSound second 
)

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.

Parameters:
name the name of the group (handled by caller).
first id of the first group
second id of the second group
Returns:
Registered sound identifier.

Definition at line 129 of file sound_id.cpp.

References _C_, DebugPrint, MapSound(), RegisterTwoGroups(), and SoundMap.

Referenced by CclMakeSoundGroup().

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.

Parameters:
name Name of the sound (now freed by caller!).
id Sound identifier.

Definition at line 64 of file sound_id.cpp.

References SoundMap.

Referenced by CclMapSound(), MakeSound(), and MakeSoundGroup().

CSound* SoundForName ( const std::string &  name  ) 

Make a sound bound to identifier.

Maps a sound name to its id

Parameters:
name Sound name.
Returns:
Sound identifier for this name.

Definition at line 76 of file sound_id.cpp.

References _C_, Assert, DebugPrint, and SoundMap.

Referenced by CclDefineSpell(), CclSoundForName(), MissileType::Init(), InitSoundClient(), MapAnimSounds2(), MapUnitSounds(), and UIHandleButtonUp().


Variable Documentation

std::map<std::string, CSound *> SoundMap [static]

Definition at line 51 of file sound_id.cpp.

Referenced by MakeSound(), MakeSoundGroup(), MapSound(), and SoundForName().


Generated on Sat Feb 21 00:28:19 2009 for Bos Wars by  doxygen 1.5.6