mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-13 10:49:11 +00:00
Changed: #1469 StringId conversion to SheetId for sound (DOES NOT COMPILE YET)
This commit is contained in:
parent
2cf7e0795a
commit
1db44e6250
30 changed files with 156 additions and 134 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/misc/plane.h"
|
||||
#include "nel/misc/aabbox.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
#include "nel/3d/transform.h"
|
||||
|
||||
|
@ -125,9 +126,9 @@ public:
|
|||
//\name Sound related.
|
||||
//@{
|
||||
void setSoundGroup(const std::string &soundGroup);
|
||||
void setSoundGroup(const NLMISC::TStringId &soundGroupId);
|
||||
void setSoundGroup(const NLMISC::CSheetId &soundGroupId);
|
||||
const std::string &getSoundGroup();
|
||||
NLMISC::TStringId getSoundGroupId();
|
||||
NLMISC::CSheetId getSoundGroupId();
|
||||
void setEnvironmentFx(const std::string &environmentFx);
|
||||
void setEnvironmentFx(const NLMISC::TStringId &environmentFxId);
|
||||
const std::string &getEnvironmentFx();
|
||||
|
@ -188,7 +189,7 @@ private:
|
|||
std::vector<NLMISC::CPlane> _Volume;
|
||||
|
||||
/// Sound group name id
|
||||
NLMISC::TStringId _SoundGroupId;
|
||||
NLMISC::CSheetId _SoundGroupId;
|
||||
/// Environement Fx name Id (using CStringMapper)
|
||||
NLMISC::TStringId _EnvironmentFxId;
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/3d/ps_located.h"
|
||||
#include "nel/3d/ps_attrib.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
|
||||
|
||||
|
@ -63,13 +64,13 @@ public:
|
|||
virtual void step(TPSProcessPass pass);
|
||||
|
||||
/// set the name of the sound
|
||||
void setSoundName(const NLMISC::TStringId &soundName)
|
||||
void setSoundName(const NLMISC::CSheetId &soundName)
|
||||
{
|
||||
_SoundName = soundName;
|
||||
}
|
||||
|
||||
/// get the name of the sound
|
||||
const NLMISC::TStringId &getSoundName(void) const
|
||||
const NLMISC::CSheetId &getSoundName(void) const
|
||||
{
|
||||
return _SoundName;
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ protected:
|
|||
void removeAllSources();
|
||||
|
||||
CPSAttrib<UPSSoundInstance *> _Sounds;
|
||||
NLMISC::TStringId _SoundName;
|
||||
NLMISC::CSheetId _SoundName;
|
||||
float _Gain;
|
||||
CPSAttribMaker<float> * _GainScheme;
|
||||
float _Pitch;
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
|
||||
|
||||
/// inherited from IPSSoundServer
|
||||
UPSSoundInstance *createSound(const NLMISC::TStringId &soundName, bool spawned = true)
|
||||
UPSSoundInstance *createSound(const NLMISC::CSheetId &soundName, bool spawned = true)
|
||||
{
|
||||
if (!_AudioMixer)
|
||||
return NULL;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include <string>
|
||||
|
||||
namespace NLMISC
|
||||
|
@ -50,7 +51,7 @@ struct UPSSoundServer
|
|||
* \param spawn true if the sound must be spawned e.g it continues after this interface is removed
|
||||
* \param cb useful only for spawned sound, it tells when a spawned sound has been removed
|
||||
*/
|
||||
virtual UPSSoundInstance *createSound(const NLMISC::TStringId &soundName, bool spawn = false) = 0;
|
||||
virtual UPSSoundInstance *createSound(const NLMISC::CSheetId &soundName, bool spawn = false) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <nel/misc/time_nl.h>
|
||||
#include <nel/misc/stream.h>
|
||||
#include <nel/misc/singleton.h>
|
||||
#include <nel/misc/sheet_id.h>
|
||||
#include <nel/sound/u_audio_mixer.h>
|
||||
#include <nel/georges/u_form.h>
|
||||
|
||||
|
@ -92,9 +93,9 @@ public:
|
|||
//@{
|
||||
/// @name IStringMapperProvider implementation
|
||||
/// map a string
|
||||
NLMISC::TStringId map(const std::string &str) { return NLMISC::CStringMapper::map(str);}
|
||||
NLMISC::CSheetId map(const std::string &str) { return NLMISC::CSheetId(str);/*NLMISC::CStringMapper::map(str);*/}
|
||||
/// unmap a string
|
||||
const std::string &unmap(const NLMISC::TStringId &stringId) { return NLMISC::CStringMapper::unmap(stringId);}
|
||||
const std::string &unmap(const NLMISC::CSheetId &stringId) { return stringId.toString();/*NLMISC::CStringMapper::unmap(stringId);*/}
|
||||
//@}
|
||||
|
||||
|
||||
|
@ -180,7 +181,7 @@ public:
|
|||
// Load environment sounds ; treeRoot can be null if you don't want an access to the envsounds
|
||||
// virtual void loadEnvSounds( const char *filename, UEnvSound **treeRoot=NULL );
|
||||
/// Get a TSoundId from a name (returns NULL if not found)
|
||||
virtual TSoundId getSoundId( const NLMISC::TStringId &name );
|
||||
virtual TSoundId getSoundId( const NLMISC::CSheetId &name );
|
||||
|
||||
/// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created.
|
||||
/// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera
|
||||
|
@ -192,7 +193,7 @@ public:
|
|||
* pass a callback function that will be called (if not NULL) just before deleting the spawned
|
||||
* source.
|
||||
*/
|
||||
virtual USource *createSource( const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
|
||||
virtual USource *createSource( const NLMISC::CSheetId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
|
||||
/// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*)
|
||||
virtual USource *createSource( TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL);
|
||||
/// Add a source which was created by an EnvSound
|
||||
|
@ -223,7 +224,7 @@ public:
|
|||
|
||||
|
||||
/// Return the names of the sounds (call this method after loadSounds())
|
||||
virtual void getSoundNames( std::vector<NLMISC::TStringId> &names ) const;
|
||||
virtual void getSoundNames( std::vector<NLMISC::CSheetId> &names ) const;
|
||||
/// Return the number of mixing tracks (voices)
|
||||
virtual uint getPolyphony() const { return (uint)_Tracks.size(); }
|
||||
/// Return the number of sources instance.
|
||||
|
@ -320,8 +321,8 @@ public:
|
|||
void incPlayingSourceMuted() { ++_PlayingSourcesMuted; };
|
||||
void decPlayingSourceMuted() { --_PlayingSourcesMuted; };
|
||||
|
||||
void setUserVar(NLMISC::TStringId varName, float value);
|
||||
float getUserVar(NLMISC::TStringId varName);
|
||||
void setUserVar(NLMISC::CSheetId varName, float value);
|
||||
float getUserVar(NLMISC::CSheetId varName);
|
||||
|
||||
// music
|
||||
virtual bool playMusic(const std::string &fileName, uint xFadeTime= 0, bool async= true, bool loop=true);
|
||||
|
@ -351,7 +352,7 @@ public:
|
|||
/// Add a reverb environment.
|
||||
void addEnvironment(const std::string &name, const IReverbEffect::CEnvironment &environment);
|
||||
/// Set the current reverb environment.
|
||||
void setEnvironment(NLMISC::TStringId environmentName, float roomSize);
|
||||
void setEnvironment(NLMISC::CSheetId environmentName, float roomSize);
|
||||
/// Set the current reverb environment.
|
||||
inline void setEnvironment(const std::string &environmentName, float roomSize) { setEnvironment(NLMISC::CStringMapper::map(environmentName), roomSize); }
|
||||
/// Get a reverb environment
|
||||
|
@ -409,8 +410,8 @@ public:
|
|||
|
||||
/// Read all user controled var sheets
|
||||
void initUserVar();
|
||||
void addUserControledSource(CSourceCommon *source, NLMISC::TStringId varName);
|
||||
void removeUserControledSource(CSourceCommon *source, NLMISC::TStringId varName);
|
||||
void addUserControledSource(CSourceCommon *source, NLMISC::CSheetId varName);
|
||||
void removeUserControledSource(CSourceCommon *source, NLMISC::CSheetId varName);
|
||||
|
||||
|
||||
virtual void startDriverBench();
|
||||
|
@ -440,11 +441,11 @@ private:
|
|||
struct CControledSources
|
||||
{
|
||||
/// The user var name
|
||||
NLMISC::TStringId Name;
|
||||
NLMISC::CSheetId Name;
|
||||
/// Witch parameter to control
|
||||
TControledParamId ParamId;
|
||||
/// The controled sounds names.
|
||||
std::vector<NLMISC::TStringId> SoundNames;
|
||||
std::vector<NLMISC::CSheetId> SoundNames;
|
||||
/// Current parameter value
|
||||
float Value;
|
||||
/// All the sources controled by this variable
|
||||
|
@ -472,7 +473,7 @@ protected:
|
|||
/// Fill a vector of position and mute flag for all playing sound source.
|
||||
virtual void getPlayingSoundsPos(bool virtualPos, std::vector<std::pair<bool, NLMISC::CVector> > &pos);
|
||||
|
||||
typedef CHashMap<NLMISC::TStringId, CControledSources, NLMISC::CStringIdHashMapTraits> TUserVarControlsContainer;
|
||||
typedef CHashMap<NLMISC::CSheetId, CControledSources, NLMISC::CStringIdHashMapTraits> TUserVarControlsContainer;
|
||||
/// Container for all user controler and currently controled playing source
|
||||
TUserVarControlsContainer _UserVarControls;
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
/// Associtation clas for storage of sound / filter.
|
||||
struct TSoundInfo
|
||||
{
|
||||
NLMISC::TStringId SoundName;
|
||||
NLMISC::CSheetId SoundName;
|
||||
UAudioMixer::TBackgroundFlags Filter;
|
||||
|
||||
void serial(NLMISC::IStream &s)
|
||||
|
@ -73,11 +73,11 @@ public:
|
|||
if (s.isReading())
|
||||
{
|
||||
s.serial(soundName);
|
||||
SoundName = NLMISC::CStringMapper::map(soundName);
|
||||
SoundName = NLMISC::CSheetId(soundName);/*NLMISC::CStringMapper::map(soundName)*/;
|
||||
}
|
||||
else
|
||||
{
|
||||
soundName = NLMISC::CStringMapper::unmap(SoundName);
|
||||
soundName = SoundName.toString();/* NLMISC::CStringMapper::unmap(SoundName)*/;
|
||||
s.serial(soundName);
|
||||
}
|
||||
s.serial(Filter);
|
||||
|
|
|
@ -229,7 +229,7 @@ private:
|
|||
struct TSoundData
|
||||
{
|
||||
/// The name of the sound.
|
||||
NLMISC::TStringId SoundName;
|
||||
NLMISC::CSheetId SoundName;
|
||||
/// The reference to the sound.
|
||||
CSound *Sound;
|
||||
/// A source instance of the sound (may be NULL).
|
||||
|
@ -282,7 +282,7 @@ private:
|
|||
struct TFxZone
|
||||
{
|
||||
/// Name of the env fx
|
||||
NLMISC::TStringId FxName;
|
||||
NLMISC::CSheetId FxName;
|
||||
/// The vector of points compositing the primitive
|
||||
std::vector<NLMISC::CVector> Points;
|
||||
/// The min vector of the bounding box
|
||||
|
@ -295,7 +295,7 @@ private:
|
|||
/// Container for the fx primitive.
|
||||
std::vector<TFxZone> _FxZones;
|
||||
/// Last setted env fx. Used when clustered sound is not active
|
||||
NLMISC::TStringId _LastEnv;
|
||||
NLMISC::CSheetId _LastEnv;
|
||||
|
||||
//@}
|
||||
};
|
||||
|
|
|
@ -249,11 +249,11 @@ private:
|
|||
/// The segment of all the audio path.
|
||||
std::vector<std::pair<NLMISC::CVector, NLMISC::CVector> > _AudioPath;
|
||||
|
||||
typedef CHashMap<NLMISC::TStringId, CClusterSound, NLMISC::CStringIdHashMapTraits> TClusterSoundCont;
|
||||
typedef CHashMap<NLMISC::CSheetId, CClusterSound, NLMISC::CStringIdHashMapTraits> TClusterSoundCont;
|
||||
/// The current cluster playing source indexed with sound group id
|
||||
TClusterSoundCont _Sources;
|
||||
|
||||
typedef CHashMap<NLMISC::TStringId, NLMISC::TStringId, NLMISC::CStringIdHashMapTraits> TStringStringMap;
|
||||
typedef CHashMap<NLMISC::CSheetId, NLMISC::CSheetId, NLMISC::CStringIdHashMapTraits> TStringStringMap;
|
||||
/// The sound_group to sound assoc
|
||||
TStringStringMap _SoundGroupToSound;
|
||||
};
|
||||
|
|
|
@ -52,8 +52,8 @@ public:
|
|||
|
||||
const std::vector<uint32> &getSoundSeq() const { return _SoundSeq;}
|
||||
const std::vector<uint32> &getDelaySeq() const { return _DelaySeq;}
|
||||
NLMISC::TStringId getSound(uint index) const { return !_Sounds.empty() ? _Sounds[index%_Sounds.size()]:0;}
|
||||
const std::vector<NLMISC::TStringId> &getSounds() const { return _Sounds;}
|
||||
NLMISC::CSheetId getSound(uint index) const { return !_Sounds.empty() ? _Sounds[index%_Sounds.size()]:NLMISC::CSheetId::Unknown;}
|
||||
const std::vector<NLMISC::CSheetId> &getSounds() const { return _Sounds;}
|
||||
|
||||
uint32 getFadeLength() const { return _XFadeLength;}
|
||||
|
||||
|
@ -87,7 +87,7 @@ private:
|
|||
virtual float getMaxDistance() const;
|
||||
|
||||
TPATTERN_MODE _PatternMode;
|
||||
std::vector<NLMISC::TStringId> _Sounds;
|
||||
std::vector<NLMISC::CSheetId> _Sounds;
|
||||
float _TicksPerSeconds;
|
||||
std::vector<uint32> _SoundSeq;
|
||||
/// Sequence of delay in millisec.
|
||||
|
|
|
@ -133,7 +133,7 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
|
||||
virtual void addSound(CSound *sound, const std::string &baseName)
|
||||
{
|
||||
const std::string &patternName = NLMISC::CStringMapper::unmap(sound->getName());
|
||||
const std::string &patternName = sound->getName().toString(); /*NLMISC::CStringMapper::unmap(sound->getName())*/;
|
||||
nlassert(patternName.size() >= baseName.size());
|
||||
|
||||
std::string arg;
|
||||
|
@ -172,7 +172,7 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
|
||||
if (i != NbJoker)
|
||||
return;
|
||||
nlassertex(i==NbJoker, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
|
||||
nlassertex(i==NbJoker, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
|
||||
|
||||
sint randomValue = 0;
|
||||
if (UseRandom)
|
||||
|
@ -187,7 +187,7 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
}
|
||||
else if (!arg.empty())
|
||||
{
|
||||
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
|
||||
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
|
||||
// end of the argument.
|
||||
NLMISC::fromString(arg, randomValue);
|
||||
arg.clear();
|
||||
|
@ -199,13 +199,13 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
// read the potential last arg.
|
||||
if (!arg.empty())
|
||||
{
|
||||
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
|
||||
nlassertex (!ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
|
||||
// end of the argument.
|
||||
NLMISC::fromString(arg, randomValue);
|
||||
arg.clear();
|
||||
ok = true;
|
||||
}
|
||||
nlassertex (ok, ("Error while adding sound '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
|
||||
nlassertex (ok, ("Error while adding sound '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -221,9 +221,9 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
if (!ret.second)
|
||||
{
|
||||
typename THashContextSound::iterator it = _ContextSounds.find(cm);
|
||||
nlassertex(it != _ContextSounds.end(), ("Error wile adding soudn '%s' into context sound container", NLMISC::CStringMapper::unmap(sound->getName()).c_str()));
|
||||
nlassertex(it != _ContextSounds.end(), ("Error wile adding soudn '%s' into context sound container", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/));
|
||||
|
||||
nlwarning("Sound %s has the same context matcher as the sound %s", NLMISC::CStringMapper::unmap(sound->getName()).c_str(), NLMISC::CStringMapper::unmap(it->second->getName()).c_str());
|
||||
nlwarning("Sound %s has the same context matcher as the sound %s", sound->getName().toString().c_str()/*NLMISC::CStringMapper::unmap(sound->getName()).c_str()*/, it->second->getName().toString().c_str() /*NLMISC::CStringMapper::unmap(it->second->getName()).c_str()*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ class CContextSoundContainer : public IContextSoundContainer
|
|||
typename THashContextSound::const_iterator first(_ContextSounds.begin()), last(_ContextSounds.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
subsounds.push_back(std::make_pair(NLMISC::CStringMapper::unmap(first->second->getName()), first->second));
|
||||
subsounds.push_back(std::make_pair(first->second->getName().toString()/*NLMISC::CStringMapper::unmap(first->second->getName())*/, first->second));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/sound/u_source.h"
|
||||
#include "nel/georges/u_form_elm.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include <string>
|
||||
|
||||
namespace NLSOUND {
|
||||
|
@ -35,7 +36,7 @@ class CGroupController;
|
|||
|
||||
/// Sound names hash map
|
||||
//typedef std::hash_map<std::string, CSound*> TSoundMap;
|
||||
typedef CHashMap<NLMISC::TStringId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundMap;
|
||||
typedef CHashMap<NLMISC::CSheetId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundMap;
|
||||
|
||||
/// Sound names set (for ambiant sounds)
|
||||
typedef std::set<CSound*> TSoundSet;
|
||||
|
@ -99,7 +100,7 @@ public:
|
|||
/// Return the length of the sound in ms
|
||||
virtual uint32 getDuration() = 0;
|
||||
/// Return the name (must be unique)
|
||||
const NLMISC::TStringId& getName() const { return _Name; }
|
||||
const NLMISC::CSheetId& getName() const { return _Name; }
|
||||
|
||||
/// Return the min distance (if detailed()) (default 1.0f if not implemented by sound type)
|
||||
virtual float getMinDistance() const { return _MinDist; }
|
||||
|
@ -117,11 +118,12 @@ public:
|
|||
|
||||
virtual void serial(NLMISC::IStream &s);
|
||||
|
||||
NLMISC::TStringId getUserVarControler() { return _UserVarControler; }
|
||||
NLMISC::CSheetId getUserVarControler() { return _UserVarControler; }
|
||||
|
||||
bool operator<( const CSound& otherSound ) const
|
||||
{
|
||||
return NLMISC::CStringMapper::unmap(_Name) < NLMISC::CStringMapper::unmap(otherSound._Name);
|
||||
//return NLMISC::CStringMapper::unmap(_Name) < NLMISC::CStringMapper::unmap(otherSound._Name);
|
||||
return _Name.toString() < otherSound._Name.toString();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -142,9 +144,9 @@ protected:
|
|||
float _MaxDist;
|
||||
|
||||
// Sound name.
|
||||
NLMISC::TStringId _Name;
|
||||
NLMISC::CSheetId _Name;
|
||||
/// An optional user var controler.
|
||||
NLMISC::TStringId _UserVarControler;
|
||||
NLMISC::CSheetId _UserVarControler;
|
||||
|
||||
/// The group controller, always exists, owned by the audio mixer
|
||||
CGroupController *_GroupController;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/3d/cluster.h"
|
||||
#include "nel/sound/u_source.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
|
||||
namespace NLMISC
|
||||
|
@ -31,7 +32,7 @@ namespace NLMISC
|
|||
namespace NLSOUND {
|
||||
|
||||
|
||||
typedef std::set<NLMISC::TStringId> TMarkerSoundSet;
|
||||
typedef std::set<NLMISC::CSheetId> TMarkerSoundSet;
|
||||
|
||||
class UAudioMixer;
|
||||
|
||||
|
@ -50,13 +51,13 @@ public:
|
|||
virtual float getTime() const { return _Time; }
|
||||
|
||||
/** Add a new sound in the set of to-be-played sounds for this marker */
|
||||
virtual void addSound(const NLMISC::TStringId &soundName);
|
||||
virtual void addSound(const NLMISC::CSheetId &soundName);
|
||||
|
||||
/** Remove a sound */
|
||||
virtual void removeSound(const NLMISC::TStringId &soundName);
|
||||
virtual void removeSound(const NLMISC::CSheetId &soundName);
|
||||
|
||||
/** Return the set of sounds of this marker */
|
||||
virtual void getSounds(std::vector<NLMISC::TStringId> &sounds);
|
||||
virtual void getSounds(std::vector<NLMISC::CSheetId> &sounds);
|
||||
|
||||
/** Play all the sounds of this marker */
|
||||
virtual void play(UAudioMixer* mixer, NL3D::CCluster *cluster, CSoundContext &context);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/sound/audio_mixer_user.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include <string>
|
||||
|
||||
namespace NLSOUND {
|
||||
|
@ -67,16 +68,16 @@ public:
|
|||
bool isLoaded();
|
||||
|
||||
/// Return a sound corresponding to a name.
|
||||
CSound *getSound(const NLMISC::TStringId &name);
|
||||
CSound *getSound(const NLMISC::CSheetId &name);
|
||||
|
||||
/// Return the names of the sounds
|
||||
void getNames( std::vector<NLMISC::TStringId> &names );
|
||||
void getNames( std::vector<NLMISC::CSheetId> &names );
|
||||
|
||||
/// Return the number of sounds in this bank.
|
||||
uint countSounds();
|
||||
|
||||
void addSound(CSound *sound);
|
||||
void removeSound(const NLMISC::TStringId &name);
|
||||
void removeSound(const NLMISC::CSheetId &name);
|
||||
|
||||
|
||||
private:
|
||||
|
@ -85,10 +86,10 @@ private:
|
|||
|
||||
typedef CHashSet<class CSimpleSound*, THashPtr<CSimpleSound*> > TSimpleSoundContainer;
|
||||
// typedef std::hash_map<std::string, TSimpleSoundContainer > TBufferAssocContainer;
|
||||
typedef CHashMap<NLMISC::TStringId, TSimpleSoundContainer, NLMISC::CStringIdHashMapTraits> TBufferAssocContainer;
|
||||
typedef CHashMap<NLMISC::CSheetId, TSimpleSoundContainer, NLMISC::CStringIdHashMapTraits> TBufferAssocContainer;
|
||||
/// Sound names hash map
|
||||
// typedef std::hash_map<std::string, CSound*> TSoundTable;
|
||||
typedef CHashMap<NLMISC::TStringId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundTable;
|
||||
typedef CHashMap<NLMISC::CSheetId, CSound*, NLMISC::CStringIdHashMapTraits> TSoundTable;
|
||||
|
||||
/// Assoc from buffer to sound. Used for sound unloading.
|
||||
TBufferAssocContainer _BufferAssoc;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nel/3d/cluster.h"
|
||||
#include "nel/sound/sound.h"
|
||||
#include "nel/sound/group_controller.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
namespace NLSOUND {
|
||||
|
||||
|
@ -149,7 +150,7 @@ protected:
|
|||
NL3D::CCluster *_Cluster;
|
||||
|
||||
/// An optional user var controler.
|
||||
NLMISC::TStringId _UserVarControler;
|
||||
NLMISC::CSheetId _UserVarControler;
|
||||
|
||||
/// Group controller for gain
|
||||
CGroupController *_GroupController;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/string_mapper.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
#include "nel/sound/u_source.h"
|
||||
#include "nel/sound/u_group_controller.h"
|
||||
#include "nel/ligo/primitive.h"
|
||||
|
@ -284,7 +285,7 @@ public:
|
|||
//@}
|
||||
|
||||
/// Get a TSoundId from a name (returns NULL if not found)
|
||||
virtual TSoundId getSoundId( const NLMISC::TStringId &name ) = 0;
|
||||
virtual TSoundId getSoundId( const NLMISC::CSheetId &name ) = 0;
|
||||
|
||||
/// Gets the group controller for the given group tree path with separator '/', if it doesn't exist yet it will be created.
|
||||
/// Examples: "music", "effects", "dialog", "music/background", "music/loading", "music/player", etcetera
|
||||
|
@ -296,7 +297,7 @@ public:
|
|||
* pass a callback function that will be called (if not NULL) just before deleting the spawned
|
||||
* source.
|
||||
*/
|
||||
virtual USource *createSource(const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
|
||||
virtual USource *createSource(const NLMISC::CSheetId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
|
||||
/// Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*)
|
||||
virtual USource *createSource(TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam = NULL, NL3D::CCluster *cluster = 0, CSoundContext *context = 0, UGroupController *groupController = NULL) = 0;
|
||||
|
||||
|
@ -320,7 +321,7 @@ public:
|
|||
//@{
|
||||
//@name Statistic and utility methods
|
||||
/// Fill a vector with the names of all loaded sounds.
|
||||
virtual void getSoundNames( std::vector<NLMISC::TStringId> &names ) const = 0;
|
||||
virtual void getSoundNames( std::vector<NLMISC::CSheetId> &names ) const = 0;
|
||||
/// Return the number of mixing tracks (voices)
|
||||
virtual uint getPolyphony() const = 0;
|
||||
/// Return the number of sources
|
||||
|
@ -381,9 +382,9 @@ public:
|
|||
* Binding from user var to sound parameter is done in
|
||||
* one or more georges sheet .user_var_binding.
|
||||
*/
|
||||
virtual void setUserVar(NLMISC::TStringId varName, float value) =0;
|
||||
virtual void setUserVar(NLMISC::CSheetId varName, float value) =0;
|
||||
/// Return the current value of a user var.
|
||||
virtual float getUserVar(NLMISC::TStringId varName) =0;
|
||||
virtual float getUserVar(NLMISC::CSheetId varName) =0;
|
||||
//@}
|
||||
|
||||
//@{
|
||||
|
|
|
@ -51,7 +51,9 @@ CCluster::CCluster ()
|
|||
// map a no fx string
|
||||
_EnvironmentFxId = CStringMapper::map("no fx");
|
||||
// map a no soundgroup string
|
||||
_SoundGroupId = CStringMapper::map("");
|
||||
_SoundGroupId = NLMISC::CSheetId::Unknown; /*CStringMapper::map("")*/;
|
||||
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
|
||||
|
||||
|
||||
// I am a transform cluster
|
||||
CTransform::setIsCluster(true);
|
||||
|
@ -76,18 +78,21 @@ CCluster::~CCluster()
|
|||
|
||||
void CCluster::setSoundGroup(const std::string &soundGroup)
|
||||
{
|
||||
_SoundGroupId = CStringMapper::map(soundGroup);
|
||||
_SoundGroupId = NLMISC::CSheetId(soundGroup);/*CStringMapper::map(soundGroup);*/
|
||||
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
|
||||
|
||||
}
|
||||
void CCluster::setSoundGroup(const NLMISC::TStringId &soundGroupId)
|
||||
void CCluster::setSoundGroup(const NLMISC::CSheetId &soundGroupId)
|
||||
{
|
||||
_SoundGroupId = soundGroupId;
|
||||
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
|
||||
}
|
||||
const std::string &CCluster::getSoundGroup()
|
||||
{
|
||||
return CStringMapper::unmap(_SoundGroupId);
|
||||
return _SoundGroupId.toString();/*CStringMapper::unmap(_SoundGroupId)*/;
|
||||
}
|
||||
|
||||
NLMISC::TStringId CCluster::getSoundGroupId()
|
||||
NLMISC::CSheetId CCluster::getSoundGroupId()
|
||||
{
|
||||
return _SoundGroupId;
|
||||
}
|
||||
|
@ -304,7 +309,8 @@ void CCluster::serial (NLMISC::IStream&f)
|
|||
std::string envFxName;
|
||||
|
||||
f.serial(soundGroup);
|
||||
_SoundGroupId = CStringMapper::map(soundGroup);
|
||||
_SoundGroupId = NLMISC::CSheetId(soundGroup); /*CStringMapper::map(soundGroup)*/;
|
||||
nldebug("SOUNDSHEET: %s", _SoundGroupId.toString().c_str());
|
||||
|
||||
f.serial(envFxName);
|
||||
if (envFxName == "")
|
||||
|
@ -314,7 +320,7 @@ void CCluster::serial (NLMISC::IStream&f)
|
|||
else
|
||||
{
|
||||
// write the sound group
|
||||
std::string soundGroup = CStringMapper::unmap(_SoundGroupId);
|
||||
std::string soundGroup = _SoundGroupId.toString();/*CStringMapper::unmap(_SoundGroupId)*/;
|
||||
f.serial(soundGroup);
|
||||
// write the env fx name
|
||||
std::string envFxName = CStringMapper::unmap(_EnvironmentFxId);
|
||||
|
|
|
@ -43,7 +43,7 @@ CPSSound::CPSSound() : _Gain(1.f),
|
|||
{
|
||||
NL_PS_FUNC(CPSSound_CPSSound)
|
||||
if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("sound");
|
||||
_SoundName = NLMISC::CStringMapper::emptyId();
|
||||
_SoundName = NLMISC::CSheetId::Unknown /*NLMISC::CStringMapper::emptyId()*/;
|
||||
}
|
||||
|
||||
// ***************************************************************************************************
|
||||
|
@ -265,11 +265,11 @@ void CPSSound::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
|||
{
|
||||
std::string soundName;
|
||||
f.serial(soundName);
|
||||
_SoundName = NLMISC::CStringMapper::map(soundName);
|
||||
_SoundName = NLMISC::CSheetId(soundName)/*NLMISC::CStringMapper::map(soundName)*/;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string soundName = NLMISC::CStringMapper::unmap(_SoundName);
|
||||
std::string soundName = _SoundName.toString()/*NLMISC::CStringMapper::unmap(_SoundName)*/;
|
||||
f.serial(soundName);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "nel/misc/command.h"
|
||||
#include "nel/misc/file.h"
|
||||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
#include "nel/georges/u_form_loader.h"
|
||||
#include "nel/georges/u_form_elm.h"
|
||||
|
@ -1157,7 +1158,7 @@ void CAudioMixerUser::CControledSources::serial(NLMISC::IStream &s)
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
void CAudioMixerUser::setUserVar(NLMISC::TStringId varName, float value)
|
||||
void CAudioMixerUser::setUserVar(NLMISC::CSheetId varName, float value)
|
||||
{
|
||||
TUserVarControlsContainer::iterator it(_UserVarControls.find(varName));
|
||||
if (it != _UserVarControls.end())
|
||||
|
@ -1190,7 +1191,7 @@ void CAudioMixerUser::setUserVar(NLMISC::TStringId varName, float value)
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
float CAudioMixerUser::getUserVar(NLMISC::TStringId varName)
|
||||
float CAudioMixerUser::getUserVar(NLMISC::CSheetId varName)
|
||||
{
|
||||
TUserVarControlsContainer::iterator it(_UserVarControls.find(varName));
|
||||
if (it != _UserVarControls.end())
|
||||
|
@ -1203,7 +1204,7 @@ float CAudioMixerUser::getUserVar(NLMISC::TStringId varName)
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
void CAudioMixerUser::addUserControledSource(CSourceCommon *source, NLMISC::TStringId varName)
|
||||
void CAudioMixerUser::addUserControledSource(CSourceCommon *source, NLMISC::CSheetId varName)
|
||||
{
|
||||
TUserVarControlsContainer::iterator it(_UserVarControls.find(varName));
|
||||
if (it != _UserVarControls.end())
|
||||
|
@ -1227,7 +1228,7 @@ void CAudioMixerUser::addUserControledSource(CSourceCommon *source, NLMISC::TStr
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
void CAudioMixerUser::removeUserControledSource(CSourceCommon *source, NLMISC::TStringId varName)
|
||||
void CAudioMixerUser::removeUserControledSource(CSourceCommon *source, NLMISC::CSheetId varName)
|
||||
{
|
||||
TUserVarControlsContainer::iterator it(_UserVarControls.find(varName));
|
||||
if (it != _UserVarControls.end())
|
||||
|
@ -1780,7 +1781,7 @@ void CAudioMixerUser::update()
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
TSoundId CAudioMixerUser::getSoundId( const NLMISC::TStringId &name )
|
||||
TSoundId CAudioMixerUser::getSoundId( const NLMISC::CSheetId &name )
|
||||
{
|
||||
return _SoundBank->getSound(name);
|
||||
}
|
||||
|
@ -2035,7 +2036,7 @@ retrySound:
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
USource *CAudioMixerUser::createSource( const NLMISC::TStringId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController)
|
||||
USource *CAudioMixerUser::createSource( const NLMISC::CSheetId &name, bool spawn, TSpawnEndCallback cb, void *userParam, NL3D::CCluster *cluster, CSoundContext *context, UGroupController *groupController)
|
||||
{
|
||||
return createSource( getSoundId( name ), spawn, cb, userParam, cluster, context, groupController);
|
||||
}
|
||||
|
@ -2162,7 +2163,7 @@ bool CAudioMixerUser::unloadSampleBank(const std::string &name)
|
|||
|
||||
// ******************************************************************
|
||||
|
||||
void CAudioMixerUser::getSoundNames( std::vector<NLMISC::TStringId> &names ) const
|
||||
void CAudioMixerUser::getSoundNames( std::vector<NLMISC::CSheetId> &names ) const
|
||||
{
|
||||
_SoundBank->getNames(names);
|
||||
}
|
||||
|
@ -2767,7 +2768,7 @@ void CAudioMixerUser::addEnvironment(const std::string &environmentName, const I
|
|||
}
|
||||
|
||||
/// Set the current reverb environment
|
||||
void CAudioMixerUser::setEnvironment(NLMISC::TStringId environmentName, float roomSize)
|
||||
void CAudioMixerUser::setEnvironment(NLMISC::CSheetId environmentName, float roomSize)
|
||||
{
|
||||
if (_ReverbEffect)
|
||||
{
|
||||
|
@ -2776,7 +2777,7 @@ void CAudioMixerUser::setEnvironment(NLMISC::TStringId environmentName, float ro
|
|||
}
|
||||
|
||||
/// Get a reverb environment
|
||||
const IReverbEffect::CEnvironment &CAudioMixerUser::getEnvironment(NLMISC::TStringId environmentName)
|
||||
const IReverbEffect::CEnvironment &CAudioMixerUser::getEnvironment(NLMISC::CSheetId environmentName)
|
||||
{
|
||||
TEnvironments::iterator it(_Environments.find(environmentName));
|
||||
if (it == _Environments.end())
|
||||
|
|
|
@ -84,7 +84,7 @@ void CBackgroundSound::importForm(const std::string& filename, NLGEORGES::UFormE
|
|||
// Read the sound name.
|
||||
std::string soundName;
|
||||
psoundItem->getValueByName(soundName, "Sound");
|
||||
sound.SoundName = CStringMapper::map(CFile::getFilenameWithoutExtension(soundName));
|
||||
sound.SoundName = NLMISC::CSheetId(CFile::getFilenameWithoutExtension(soundName));/*CStringMapper::map(CFile::getFilenameWithoutExtension(soundName))*/;
|
||||
|
||||
|
||||
// Read the environnement flag.
|
||||
|
@ -133,7 +133,7 @@ void CBackgroundSound::getSubSoundList(std::vector<std::pair<std::string, CSound
|
|||
for (; first != last; ++first)
|
||||
{
|
||||
CSound *sound = mixer->getSoundId(first->SoundName);
|
||||
subsounds.push_back(make_pair(CStringMapper::unmap(first->SoundName), sound));
|
||||
subsounds.push_back(make_pair(first->SoundName.toString()/*CStringMapper::unmap(first->SoundName)*/, sound));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void CBackgroundSoundManager::addSound(const std::string &soundName, uint layerI
|
|||
CAudioMixerUser *mixer = CAudioMixerUser::instance();
|
||||
TSoundData sd;
|
||||
|
||||
sd.SoundName = CStringMapper::map(soundName);
|
||||
sd.SoundName = /*CStringMapper::map(soundName)*/ NLMISC::CSheetId(soundName);
|
||||
sd.Sound = mixer->getSoundId(sd.SoundName);
|
||||
sd.Source = 0;
|
||||
|
||||
|
@ -133,7 +133,7 @@ void CBackgroundSoundManager::addSound(const std::string &soundName, uint layerI
|
|||
}
|
||||
else
|
||||
{
|
||||
nlwarning ("The sound '%s' can't be loaded", CStringMapper::unmap(sd.SoundName).c_str());
|
||||
nlwarning ("The sound '%s' can't be loaded", sd.SoundName.toString().c_str()/*CStringMapper::unmap(sd.SoundName).c_str()*/);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -465,7 +465,7 @@ void CBackgroundSoundManager::addFxZone(const std::string &fxName, const std::ve
|
|||
{
|
||||
TFxZone fxZone;
|
||||
|
||||
fxZone.FxName = CStringMapper::map(fxName);
|
||||
fxZone.FxName = /*CStringMapper::map(fxName)*/ NLMISC::CSheetId(fxName);
|
||||
fxZone.Points.resize (points.size());
|
||||
for (uint j=0; j<points.size(); j++)
|
||||
{
|
||||
|
@ -893,7 +893,7 @@ void CBackgroundSoundManager::updateBackgroundStatus()
|
|||
if (rootCluster)
|
||||
{
|
||||
// use the cluster system
|
||||
rootCluster->setEnvironmentFx(first->FxName);
|
||||
rootCluster->setEnvironmentFx(first->FxName.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1437,14 +1437,14 @@ void CBackgroundSoundManager::TSoundData::serial(NLMISC::IStream &s)
|
|||
{
|
||||
CAudioMixerUser *mixer = CAudioMixerUser::instance();
|
||||
s.serial(str);
|
||||
SoundName = NLMISC::CStringMapper::map(str);
|
||||
SoundName = /*NLMISC::CStringMapper::map(str)*/ NLMISC::CSheetId(str);
|
||||
Sound = mixer->getSoundId(SoundName);
|
||||
Source = NULL;
|
||||
Selected = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.serial(const_cast<std::string&>(NLMISC::CStringMapper::unmap(SoundName)));
|
||||
s.serial(const_cast<std::string&>(SoundName.toString()/*NLMISC::CStringMapper::unmap(SoundName)*/));
|
||||
}
|
||||
s.serial(MinBox);
|
||||
s.serial(MaxBox);
|
||||
|
@ -1461,11 +1461,11 @@ void CBackgroundSoundManager::TFxZone::serial(NLMISC::IStream &s)
|
|||
if (s.isReading())
|
||||
{
|
||||
s.serial(str);
|
||||
FxName= NLMISC::CStringMapper::map(str);
|
||||
FxName= NLMISC::CSheetId(str);/*NLMISC::CStringMapper::map(str)*/;
|
||||
}
|
||||
else
|
||||
{
|
||||
s.serial(const_cast<std::string&>(NLMISC::CStringMapper::unmap(FxName)));
|
||||
s.serial(const_cast<std::string&>(FxName.toString()/*NLMISC::CStringMapper::unmap(FxName)*/));
|
||||
}
|
||||
|
||||
s.serialCont(Points);
|
||||
|
|
|
@ -254,10 +254,10 @@ void CClusteredSound::update(const CVector &listenerPos, const CVector &/* view
|
|||
TClusterStatusMap::const_iterator first(_AudibleClusters.begin()), last(_AudibleClusters.end());
|
||||
for (; first != last; ++first )
|
||||
{
|
||||
static NLMISC::TStringId NO_SOUND_GROUP = CStringMapper::emptyId();
|
||||
static NLMISC::CSheetId NO_SOUND_GROUP = /*CStringMapper::emptyId()*/NLMISC::CSheetId::Unknown;
|
||||
const CClusterSoundStatus &css = first->second;
|
||||
CCluster *cluster = first->first;
|
||||
NLMISC::TStringId soundGroup;
|
||||
NLMISC::CSheetId soundGroup;
|
||||
|
||||
soundGroup = cluster->getSoundGroupId();
|
||||
|
||||
|
@ -292,7 +292,7 @@ void CClusteredSound::update(const CVector &listenerPos, const CVector &/* view
|
|||
TStringStringMap::iterator it2(_SoundGroupToSound.find(soundGroup));
|
||||
if (it2 != _SoundGroupToSound.end())
|
||||
{
|
||||
NLMISC::TStringId soundName = it2->second;
|
||||
NLMISC::CSheetId soundName = it2->second;
|
||||
CClusterSound cs;
|
||||
|
||||
// nldebug("Found the sound [%s] for sound group [%s]", CStringMapper::unmap(soundName).c_str(), CStringMapper::unmap(soundGroup).c_str());
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nel/misc/path.h"
|
||||
#include "nel/misc/common.h"
|
||||
#include "nel/sound/audio_mixer_user.h"
|
||||
#include "nel/misc/sheet_id.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
@ -63,11 +64,11 @@ void CComplexSound::parseSequence(const std::string &str, std::vector<uint32> &s
|
|||
void CComplexSound::getSubSoundList(std::vector<std::pair<std::string, CSound*> > &subsounds) const
|
||||
{
|
||||
CAudioMixerUser *mixer = CAudioMixerUser::instance();
|
||||
std::vector<NLMISC::TStringId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
std::vector<NLMISC::CSheetId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
CSound *sound = mixer->getSoundId(*first);
|
||||
subsounds.push_back(make_pair(CStringMapper::unmap(*first), sound));
|
||||
subsounds.push_back(make_pair((*first).toString()/*CStringMapper::unmap(*first)*/, sound));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +84,7 @@ uint32 CComplexSound::getDuration()
|
|||
CAudioMixerUser *mixer = CAudioMixerUser::instance();
|
||||
|
||||
vector<sint32> durations;
|
||||
std::vector<NLMISC::TStringId>::iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
std::vector<NLMISC::CSheetId>::iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
CSound *sound = mixer->getSoundId(*first);
|
||||
|
@ -204,7 +205,7 @@ float CComplexSound::getMaxDistance() const
|
|||
CComplexSound *This = const_cast<CComplexSound*>(this);
|
||||
|
||||
This->_MaxDist = 0.0f;
|
||||
std::vector<NLMISC::TStringId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
std::vector<NLMISC::CSheetId>::const_iterator first(_Sounds.begin()), last(_Sounds.end());
|
||||
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
|
@ -236,7 +237,7 @@ void CComplexSound::serial(NLMISC::IStream &s)
|
|||
{
|
||||
std::string name;
|
||||
s.serial(name);
|
||||
_Sounds.push_back(CStringMapper::map(name));
|
||||
_Sounds.push_back(/*CStringMapper::map(name)*/NLMISC::CSheetId(name));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -245,7 +246,7 @@ void CComplexSound::serial(NLMISC::IStream &s)
|
|||
s.serial(nb);
|
||||
for (uint i=0; i<nb; ++i)
|
||||
{
|
||||
std::string name = CStringMapper::unmap(_Sounds[i]);
|
||||
std::string name = /*CStringMapper::unmap(_Sounds[i])*/_Sounds[i].toString();
|
||||
s.serial(name);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +302,7 @@ void CComplexSound::importForm(const std::string& filename, NLGEORGES::UFormElm&
|
|||
if (psoundsArray->getArrayValue(soundname, i))
|
||||
{
|
||||
soundname = CFile::getFilenameWithoutExtension(soundname);
|
||||
_Sounds.push_back(CStringMapper::map(soundname));
|
||||
_Sounds.push_back(NLMISC::CSheetId(soundname)/*CStringMapper::map(soundname)*/);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,9 +190,9 @@ void CComplexSource::playStuf()
|
|||
case CComplexSound::MODE_ALL_IN_ONE:
|
||||
{
|
||||
// just spanw all the listed source.
|
||||
const std::vector<NLMISC::TStringId> &sounds = _PatternSound->getSounds();
|
||||
const std::vector<NLMISC::CSheetId> &sounds = _PatternSound->getSounds();
|
||||
|
||||
std::vector<NLMISC::TStringId>::const_iterator first(sounds.begin()), last(sounds.end());
|
||||
std::vector<NLMISC::CSheetId>::const_iterator first(sounds.begin()), last(sounds.end());
|
||||
|
||||
if (_AllSources.empty())
|
||||
{
|
||||
|
@ -524,7 +524,7 @@ void CComplexSource::onUpdate()
|
|||
else
|
||||
{
|
||||
// no sound after, just set an event at end of current sound to stop the complex sound.
|
||||
nldebug("Setting last event for sound %s in %u millisec.", CStringMapper::unmap(_Source1->getSound()->getName()).c_str(), _Source1->getSound()->getDuration());
|
||||
nldebug("Setting last event for sound %s in %u millisec.", _Source1->getSound()->getName().toString().c_str()/*CStringMapper::unmap(_Source1->getSound()->getName()).c_str()*/, _Source1->getSound()->getDuration());
|
||||
if (_PatternSound->doFadeOut())
|
||||
{
|
||||
// set the event to begin fade out.
|
||||
|
|
|
@ -187,7 +187,7 @@ void CContextSound::init()
|
|||
}
|
||||
else
|
||||
{
|
||||
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
|
||||
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
|
||||
fromString(index, contextArgIndex[nbJoker++]);
|
||||
parseArg = false;
|
||||
index = "";
|
||||
|
@ -195,13 +195,13 @@ void CContextSound::init()
|
|||
}
|
||||
else if (*first == 'r')
|
||||
{
|
||||
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
|
||||
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
|
||||
useRandom = true;
|
||||
}
|
||||
}
|
||||
else if (*first == '%')
|
||||
{
|
||||
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
|
||||
nlassertex(useRandom == false, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
|
||||
parseArg = true;
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ void CContextSound::init()
|
|||
}
|
||||
else
|
||||
{
|
||||
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", CStringMapper::unmap(_Name).c_str()));
|
||||
nlassertex(nbJoker < SoundContextNbArgs, ("Error will trying to play ContextSound '%s'", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/));
|
||||
fromString(index, contextArgIndex[nbJoker++]);
|
||||
parseArg = false;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void CContextSound::init()
|
|||
LM_CASE_CONTAINER_CREATOR(9)
|
||||
LM_CASE_CONTAINER_CREATOR(10)
|
||||
default:
|
||||
nlwarning("Unsuported number of context argument in context sound '%s'!", CStringMapper::unmap(_Name).c_str());
|
||||
nlwarning("Unsuported number of context argument in context sound '%s'!", _Name.toString().c_str()/*CStringMapper::unmap(_Name).c_str()*/);
|
||||
return;
|
||||
}
|
||||
// cleanup macro
|
||||
|
@ -257,14 +257,14 @@ void CContextSound::init()
|
|||
|
||||
// ok, we have the container, now fill it with the sound
|
||||
{
|
||||
std::vector<NLMISC::TStringId> allSounds;
|
||||
std::vector<NLMISC::CSheetId> allSounds;
|
||||
// CSoundBank::getSoundNames(allSounds);
|
||||
CAudioMixerUser::instance()->getSoundNames(allSounds);
|
||||
|
||||
std::vector<NLMISC::TStringId>::iterator first(allSounds.begin()), last(allSounds.end());
|
||||
std::vector<NLMISC::CSheetId>::iterator first(allSounds.begin()), last(allSounds.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
const std::string &soundName = CStringMapper::unmap(*first);
|
||||
const std::string &soundName = first->toString()/*CStringMapper::unmap(*first)*/;
|
||||
if (soundName.size() > _BaseName.size())
|
||||
{
|
||||
uint i;
|
||||
|
|
|
@ -115,7 +115,7 @@ CSound::CSound() :
|
|||
_Looping(false),
|
||||
_MinDist(1.0f),
|
||||
_MaxDist(1000000.0f),
|
||||
_UserVarControler(CStringMapper::emptyId()),
|
||||
_UserVarControler(NLMISC::CSheetId::Unknown),
|
||||
_GroupController(NULL)
|
||||
{
|
||||
}
|
||||
|
@ -137,11 +137,11 @@ void CSound::serial(NLMISC::IStream &s)
|
|||
{
|
||||
std::string name;
|
||||
s.serial(name);
|
||||
_Name = CStringMapper::map(name);
|
||||
_Name = NLMISC::CSheetId(name);//CStringMapper::map(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = CStringMapper::unmap(_Name);
|
||||
std::string name = _Name.toString();//CStringMapper::unmap(_Name);
|
||||
s.serial(name);
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ void CSound::serial(NLMISC::IStream &s)
|
|||
void CSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root)
|
||||
{
|
||||
// Name
|
||||
_Name = CStringMapper::map(CFile::getFilenameWithoutExtension(filename));
|
||||
_Name = NLMISC::CSheetId(CFile::getFilenameWithoutExtension(filename));//CStringMapper::map(CFile::getFilenameWithoutExtension(filename));
|
||||
|
||||
// InternalConeAngle
|
||||
uint32 inner;
|
||||
|
|
|
@ -41,7 +41,7 @@ void CSoundAnimMarker::play(UAudioMixer* mixer, NL3D::CCluster *cluster, CSoundC
|
|||
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
USource* source = mixer->createSource((*first), true, NULL, NULL, cluster, &context);
|
||||
USource* source = mixer->createSource(NLMISC::CSheetId(*first), true, NULL, NULL, cluster, &context);
|
||||
if (source != NULL)
|
||||
{
|
||||
source->setRelativeGain(context.RelativeGain);
|
||||
|
@ -53,19 +53,19 @@ void CSoundAnimMarker::play(UAudioMixer* mixer, NL3D::CCluster *cluster, CSoundC
|
|||
|
||||
// ********************************************************
|
||||
|
||||
void CSoundAnimMarker::addSound(const NLMISC::TStringId& soundName)
|
||||
void CSoundAnimMarker::addSound(const NLMISC::CSheetId& soundName)
|
||||
{
|
||||
pair<TMarkerSoundSet::iterator, bool> inserted;
|
||||
inserted = _Sounds.insert(soundName);
|
||||
if (inserted.second == false)
|
||||
{
|
||||
nlwarning("Duplicate sound (%s)", CStringMapper::unmap(soundName).c_str());
|
||||
nlwarning("Duplicate sound (%s)",/* CStringMapper::unmap(soundName).c_str()*/soundName.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
void CSoundAnimMarker::removeSound(const NLMISC::TStringId &soundName)
|
||||
void CSoundAnimMarker::removeSound(const NLMISC::CSheetId &soundName)
|
||||
{
|
||||
TMarkerSoundSet::iterator iter = _Sounds.find(soundName);
|
||||
if (iter != _Sounds.end())
|
||||
|
@ -74,13 +74,13 @@ void CSoundAnimMarker::removeSound(const NLMISC::TStringId &soundName)
|
|||
}
|
||||
else
|
||||
{
|
||||
nlwarning("No sound was removed (%s)", CStringMapper::unmap(soundName).c_str());
|
||||
nlwarning("No sound was removed (%s)", soundName.toString().c_str()/*CStringMapper::unmap(soundName).c_str()*/);
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************
|
||||
|
||||
void CSoundAnimMarker::getSounds(vector<NLMISC::TStringId> &sounds)
|
||||
void CSoundAnimMarker::getSounds(vector<NLMISC::CSheetId> &sounds)
|
||||
{
|
||||
sounds.insert(sounds.end(), _Sounds.begin(), _Sounds.end());
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ void CSoundAnimation::save()
|
|||
{
|
||||
// File stream
|
||||
COFile file;
|
||||
vector<NLMISC::TStringId> sounds;
|
||||
vector<NLMISC::CSheetId> sounds;
|
||||
|
||||
// Open the file
|
||||
if (!file.open(_Filename.c_str()))
|
||||
|
@ -108,11 +108,11 @@ void CSoundAnimation::save()
|
|||
|
||||
marker->getSounds(sounds);
|
||||
|
||||
vector<NLMISC::TStringId>::iterator iter2;
|
||||
vector<NLMISC::CSheetId>::iterator iter2;
|
||||
for (iter2 = sounds.begin(); iter2 != sounds.end(); iter2++)
|
||||
{
|
||||
xmlNodePtr soundNode = xmlNewChild ( markerNode, NULL, (const xmlChar*)"SOUND", NULL );
|
||||
xmlSetProp (soundNode, (const xmlChar*)"name", (const xmlChar*) CStringMapper::unmap(*iter2).c_str());
|
||||
xmlSetProp (soundNode, (const xmlChar*)"name", (const xmlChar*)iter2->toString().c_str() /*CStringMapper::unmap(*iter2).c_str()*/);
|
||||
}
|
||||
|
||||
sounds.clear();
|
||||
|
@ -190,7 +190,7 @@ void CSoundAnimation::load()
|
|||
throw NLMISC::Exception("Invalid sound animation marker");
|
||||
}
|
||||
|
||||
marker->addSound(CStringMapper::map(string(name)));
|
||||
marker->addSound(NLMISC::CSheetId(string(name))/*CStringMapper::map(string(name))*/);
|
||||
|
||||
xmlFree ((void*)name);
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void CSoundBank::addSound(CSound *sound)
|
|||
nlassert(ret.second);
|
||||
}
|
||||
|
||||
void CSoundBank::removeSound(const NLMISC::TStringId &name)
|
||||
void CSoundBank::removeSound(const NLMISC::CSheetId &name)
|
||||
{
|
||||
_Sounds.erase(name);
|
||||
}
|
||||
|
@ -258,14 +258,16 @@ public:
|
|||
void CSoundBank::load(const std::string &packedSheetDir, bool packedSheetUpdate)
|
||||
{
|
||||
// this structure is fill by the loadForm() function and will contain all you need
|
||||
std::map<std::string, CSoundSerializer> Container;
|
||||
//std::map<std::string, CSoundSerializer> Container;
|
||||
std::map<NLMISC::CSheetId, CSoundSerializer> Container;
|
||||
nlassert(!_Loaded);
|
||||
// Just call the GEORGE::loadFrom method to read all available sounds
|
||||
::loadForm("sound", packedSheetDir + "sounds.packed_sheets", Container, packedSheetUpdate, false);
|
||||
_Loaded = true;
|
||||
|
||||
// add all the loaded sound in the sound banks
|
||||
std::map<std::string, CSoundSerializer>::iterator first(Container.begin()), last(Container.end());
|
||||
//std::map<std::string, CSoundSerializer>::iterator first(Container.begin()), last(Container.end());
|
||||
std::map<NLMISC::CSheetId, CSoundSerializer>::iterator first(Container.begin()), last(Container.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
if (first->second.Sound != 0)
|
||||
|
@ -328,7 +330,7 @@ bool CSoundBank::isLoaded()
|
|||
/*
|
||||
* Return a sound sample corresponding to a name.
|
||||
*/
|
||||
CSound* CSoundBank::getSound(const NLMISC::TStringId &name)
|
||||
CSound* CSoundBank::getSound(const NLMISC::CSheetId &name)
|
||||
{
|
||||
// Find sound
|
||||
TSoundTable::iterator iter = _Sounds.find(name);
|
||||
|
@ -345,7 +347,7 @@ CSound* CSoundBank::getSound(const NLMISC::TStringId &name)
|
|||
/**
|
||||
* Return the names of the sounds
|
||||
*/
|
||||
void CSoundBank::getNames( std::vector<NLMISC::TStringId> &names )
|
||||
void CSoundBank::getNames( std::vector<NLMISC::CSheetId> &names )
|
||||
{
|
||||
TSoundTable::const_iterator iter;
|
||||
for (iter = _Sounds.begin(); iter != _Sounds.end(); ++iter)
|
||||
|
|
|
@ -102,7 +102,7 @@ void CSourceCommon::play()
|
|||
_Playing = true;
|
||||
_PlayStart = CTime::getLocalTime();
|
||||
|
||||
if (_UserVarControler != CStringMapper::emptyId())
|
||||
if (_UserVarControler != NLMISC::CSheetId::Unknown/*CStringMapper::emptyId()*/)
|
||||
CAudioMixerUser::instance()->addUserControledSource(this, _UserVarControler);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void CSourceCommon::stop()
|
|||
CAudioMixerUser::instance()->decPlayingSource();
|
||||
_Playing = false;
|
||||
|
||||
if (_UserVarControler != CStringMapper::emptyId())
|
||||
if (_UserVarControler != NLMISC::CSheetId::Unknown/*CStringMapper::emptyId()*/)
|
||||
CAudioMixerUser::instance()->removeUserControledSource(this, _UserVarControler);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,9 +74,11 @@ void CStreamFileSound::serial(NLMISC::IStream &s)
|
|||
void CStreamFileSound::setMusicFilePath(const std::string &filePath, bool async, bool loop)
|
||||
{
|
||||
#if !FINAL_VERSION
|
||||
_Name = NLMISC::CStringMapper::map(std::string("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
//_Name = NLMISC::CStringMapper::map(std::string("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
_Name = NLMISC::CSheetId(std::string("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
#else
|
||||
_Name = NLMISC::CStringMapper::map("<MusicChannel>");
|
||||
//_Name = NLMISC::CStringMapper::map("<MusicChannel>");
|
||||
_Name = NLMISC::CSheetId("<MusicChannel>");
|
||||
#endif
|
||||
_ConeInnerAngle = NLMISC::Pi * 2;
|
||||
_ConeOuterAngle = NLMISC::Pi * 2;
|
||||
|
|
Loading…
Reference in a new issue