From 9cd7498fe9bd494a0bc77b72765a679a0b4adb4b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 2 Jun 2012 15:24:21 +0200 Subject: [PATCH] Fixed: Sound CSheetID implementation (part 2) (not tested) --HG-- branch : sound_dev --- code/nel/samples/sound/sound_sources/main.cpp | 6 +++--- code/nel/src/sound/audio_mixer_user.cpp | 2 +- code/nel/src/sound/complex_sound.cpp | 8 ++++---- code/nel/src/sound/sound.cpp | 13 ++----------- code/nel/src/sound/sound_anim_marker.cpp | 2 +- code/nel/src/sound/sound_animation.cpp | 2 +- code/nel/src/sound/stream_file_sound.cpp | 6 +++--- code/ryzom/client/src/client_cfg.cpp | 2 +- code/ryzom/client/src/connection.cpp | 3 +-- 9 files changed, 17 insertions(+), 27 deletions(-) diff --git a/code/nel/samples/sound/sound_sources/main.cpp b/code/nel/samples/sound/sound_sources/main.cpp index c4efa7a4e..2c0ccedab 100644 --- a/code/nel/samples/sound/sound_sources/main.cpp +++ b/code/nel/samples/sound/sound_sources/main.cpp @@ -100,7 +100,7 @@ USource *OnAddSource( const char *name, float x, float y, float z ) /* * Create a source with sound 'name', and set some of its initial properties, if successful */ - USource *source = AudioMixer->createSource(CSheetId(name)); + USource *source = AudioMixer->createSource(CSheetId(name, "sound")); if ( source != NULL ) { source->setPos( CVector(x,y,z) ); @@ -161,8 +161,8 @@ int main() printf( "One is 20 meters ahead, on the right\n" ); printf( "The other is 5 meters ahead, on the left\n" ); getchar(); - USource *src1 = OnAddSource( "beep.sound", 1.0f, 20.0f, 0.0f ); // Beep on the right, 20 meters ahead - USource *src2 = OnAddSource( "tuut.sound", -2.0f, 5.0f, 0.0f ); // Tuut on the left, 5 meters ahead + USource *src1 = OnAddSource( "beep", 1.0f, 20.0f, 0.0f ); // Beep on the right, 20 meters ahead + USource *src2 = OnAddSource( "tuut", -2.0f, 5.0f, 0.0f ); // Tuut on the left, 5 meters ahead // Second step: we will move the listener ahead printf( "Press ENTER again to start moving the listener\n" ); diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 61dca9f9e..6eb9a2a2c 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -1132,7 +1132,7 @@ void CAudioMixerUser::CControledSources::serial(NLMISC::IStream &s) for (uint i=0; igetArrayValue(soundname, i)) { - soundname = CFile::getFilenameWithoutExtension(soundname); - _Sounds.push_back(NLMISC::CSheetId(soundname)/*CStringMapper::map(soundname)*/); + nlassert(soundname.find(".sound") != std::string::npos); + _Sounds.push_back(NLMISC::CSheetId(soundname)); } } } diff --git a/code/nel/src/sound/sound.cpp b/code/nel/src/sound/sound.cpp index f1d06bd5f..cc69455af 100644 --- a/code/nel/src/sound/sound.cpp +++ b/code/nel/src/sound/sound.cpp @@ -134,17 +134,7 @@ void CSound::serial(NLMISC::IStream &s) s.serial(_Direction); s.serial(_Looping); s.serial(_MaxDist); - if (s.isReading()) - { - std::string name; - s.serial(name); - _Name = NLMISC::CSheetId(name);//CStringMapper::map(name); - } - else - { - std::string name = _Name.toString();//CStringMapper::unmap(_Name); - s.serial(name); - } + _Name.serialString(s, "sound"); nlassert(CGroupControllerRoot::getInstance()); // not sure #if NLSOUND_SHEET_VERSION_BUILT < 2 @@ -171,6 +161,7 @@ void CSound::serial(NLMISC::IStream &s) void CSound::importForm(const std::string& filename, NLGEORGES::UFormElm& root) { // Name + nlassert(filename.find(".sound") != std::string::npos); _Name = NLMISC::CSheetId(filename); // InternalConeAngle diff --git a/code/nel/src/sound/sound_anim_marker.cpp b/code/nel/src/sound/sound_anim_marker.cpp index 40e058589..b64e02f3c 100644 --- a/code/nel/src/sound/sound_anim_marker.cpp +++ b/code/nel/src/sound/sound_anim_marker.cpp @@ -41,7 +41,7 @@ void CSoundAnimMarker::play(UAudioMixer* mixer, NL3D::CCluster *cluster, CSoundC for (; first != last; ++first) { - USource* source = mixer->createSource(NLMISC::CSheetId(*first), true, NULL, NULL, cluster, &context); + USource* source = mixer->createSource((*first), true, NULL, NULL, cluster, &context); if (source != NULL) { source->setRelativeGain(context.RelativeGain); diff --git a/code/nel/src/sound/sound_animation.cpp b/code/nel/src/sound/sound_animation.cpp index 5ea3f87cb..5a6f1c256 100644 --- a/code/nel/src/sound/sound_animation.cpp +++ b/code/nel/src/sound/sound_animation.cpp @@ -190,7 +190,7 @@ void CSoundAnimation::load() throw NLMISC::Exception("Invalid sound animation marker"); } - marker->addSound(NLMISC::CSheetId(string(name))/*CStringMapper::map(string(name))*/); + marker->addSound(NLMISC::CSheetId(string(name), "sound")); xmlFree ((void*)name); diff --git a/code/nel/src/sound/stream_file_sound.cpp b/code/nel/src/sound/stream_file_sound.cpp index b86f0b5df..fbf0c91a1 100644 --- a/code/nel/src/sound/stream_file_sound.cpp +++ b/code/nel/src/sound/stream_file_sound.cpp @@ -73,13 +73,13 @@ void CStreamFileSound::serial(NLMISC::IStream &s) void CStreamFileSound::setMusicFilePath(const std::string &filePath, bool async, bool loop) { -#if !FINAL_VERSION +/*#if !FINAL_VERSION //_Name = NLMISC::CStringMapper::map(std::string(""); _Name = NLMISC::CSheetId(std::string(""); #else //_Name = NLMISC::CStringMapper::map(""); - _Name = NLMISC::CSheetId(""); -#endif +#endif*/ + _Name = NLMISC::CSheetId("music_channel.sound"); _ConeInnerAngle = NLMISC::Pi * 2; _ConeOuterAngle = NLMISC::Pi * 2; _Looping = loop; diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index f6f7d7e3f..84ba25060 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -419,7 +419,7 @@ CClientConfig::CClientConfig() // only force patching under Windows by default #ifdef NL_OS_WINDOWS - PatchWanted = false;//true; + PatchWanted = true; #else PatchWanted = false; #endif diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 3f94368d5..ffbba52e9 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -2006,8 +2006,7 @@ public: virtual void execute (CCtrlBase * /* pCaller */, const string &Params) { string sName = getParam(Params, "name"); - //TStringId id = CStringMapper::map(sName); - CSheetId id = CSheetId(sName); + CSheetId id = CSheetId(sName, "sound"); if (SoundMngr != NULL) SoundMngr->spawnSource(id,CVector(0,0,0)); }