$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

src/sound/sound_id.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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.
CSoundSoundForName (const std::string &name)
 Get the sound id bound to an identifier.
CSoundMakeSound (const std::string &name, const char *file[], int nb)
 Make a sound bound to identifier.
CSoundMakeSoundGroup (const std::string &name, CSound *first, CSound *second)
 Make a sound group bound to identifier.

Function Documentation

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

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.

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

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:
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.

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.

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

Get the sound id bound to an identifier.

Maps a sound name to its id

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


Variable Documentation

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

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.