_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

sound_id.cpp File Reference
#include "stratagus.h"
#include <string>
#include <map>
#include "sound.h"
#include "sound_server.h"
#include "util.h"

sound_id.cpp - The sound id.

static std::map< std::string, CSound * > SoundMap
 
static CSoundFindSound (const std::string &name)
 
void MapSound (const std::string &name, CSound *id)
 Map sound to identifier. More...
 
CSoundSoundForName (const std::string &name)
 Get the sound id bound to an identifier. More...
 
CSoundMakeSound (const std::string &name, const std::vector< std::string > &files)
 Make a sound bound to identifier. More...
 
CSoundMakeSoundGroup (const std::string &name, CSound *first, CSound *second)
 Make a sound group bound to identifier. More...
 
void FreeSounds ()
 

Function Documentation

◆ FindSound()

static CSound* FindSound ( const std::string &  name)
static

◆ FreeSounds()

void FreeSounds ( )

◆ MakeSound()

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.

Parameters
namename of this sound group (Freed by caller).
filelist of sound file names
nbnumber of sounds
Returns
the sound id of the created group

◆ MakeSoundGroup()

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

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.

Parameters
namethe name of the group (handled by caller).
firstid of the first group
secondid of the second group
Returns
Registered sound identifier.

◆ MapSound()

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
nameName of the sound (now freed by caller!).
idSound identifier.

◆ SoundForName()

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

Get the sound id bound to an identifier.

Maps a sound name to its id

Parameters
nameSound name.
Returns
Sound identifier for this name.

Variable Documentation

◆ SoundMap

std::map<std::string, CSound *> SoundMap
static
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.