From e639868a386fcb3ca195e887213178ff17651beb Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 3 Jun 2012 16:00:43 +0200 Subject: [PATCH] Fixed: Make build_soundbank tool work with latest changes --- code/nel/src/sound/audio_mixer_user.cpp | 6 +++++- code/nel/src/sound/group_controller_root.cpp | 2 +- code/nel/src/sound/sound.cpp | 8 ++++---- code/nel/src/sound/sound_bank.cpp | 1 + code/nel/tools/sound/build_soundbank/build_soundbank.cpp | 4 ++++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 6eb9a2a2c..da3c7d177 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -468,7 +468,7 @@ void CAudioMixerUser::initDevice(const std::string &deviceName, const CInitInfo nlwarning("AM: OptionSoftwareBuffer not available, forceSoftwareBuffer = false"); forceSoftware = false; // not really needed, but set anyway in case this is still used later in this function } - if (manualRolloff && !_SoundDriver->getOption(ISoundDriver::OptionLocalBufferCopy)) + if (manualRolloff && !_SoundDriver->getOption(ISoundDriver::OptionManualRolloff)) { nlwarning("AM: OptionManualRolloff not available, manualRolloff = false"); manualRolloff = false; // not really needed, but set anyway in case this is still used later in this function @@ -971,10 +971,14 @@ void CAudioMixerUser::buildSampleBankList() /// Build the sound bank packed sheets file from georges sound sheet files with .sound extension in the search path, and return the path to the written file. std::string UAudioMixer::buildSoundBank(const std::string &packedSheetDir) { + CGroupControllerRoot *tempRoot = NULL; + if (!CGroupControllerRoot::isInitialized()) + tempRoot = new CGroupControllerRoot(); std::string dir = CPath::standardizePath(packedSheetDir, true); CSoundBank *soundBank = new CSoundBank(); soundBank->load(dir, true); delete soundBank; + delete tempRoot; return dir + "sounds.packed_sheets"; } diff --git a/code/nel/src/sound/group_controller_root.cpp b/code/nel/src/sound/group_controller_root.cpp index f460a808b..254dc16f4 100644 --- a/code/nel/src/sound/group_controller_root.cpp +++ b/code/nel/src/sound/group_controller_root.cpp @@ -43,7 +43,7 @@ using namespace std; namespace NLSOUND { -CGroupControllerRoot::CGroupControllerRoot() : CGroupController(NULL) +CGroupControllerRoot::CGroupControllerRoot() : CGroupController(NULL), NLMISC::CManualSingleton() { } diff --git a/code/nel/src/sound/sound.cpp b/code/nel/src/sound/sound.cpp index e7162b3a1..a1c9fd595 100644 --- a/code/nel/src/sound/sound.cpp +++ b/code/nel/src/sound/sound.cpp @@ -136,15 +136,15 @@ void CSound::serial(NLMISC::IStream &s) _Name.serialString(s, "sound"); - nlassert(CGroupControllerRoot::getInstance()); // not sure + nlassert(CGroupControllerRoot::isInitialized()); // not sure #if NLSOUND_SHEET_VERSION_BUILT < 2 - if (s.isReading()) _GroupController = static_cast(CAudioMixerUser::instance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER)); + if (s.isReading()) _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER); #else if (s.isReading()) { std::string groupControllerPath; s.serial(groupControllerPath); - _GroupController = static_cast(CAudioMixerUser::instance()->getGroupController(groupControllerPath)); + _GroupController = CGroupControllerRoot::getInstance()->getGroupController(groupControllerPath); } else { @@ -245,7 +245,7 @@ void CSound::importForm(const std::string& filename, NLGEORGES::UFormElm& roo _Priority = MidPri; } - nlassert(CGroupControllerRoot::getInstance()); // not sure + nlassert(CGroupControllerRoot::isInitialized()); // not sure #if NLSOUND_SHEET_VERSION_BUILT < 2 _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER); #else diff --git a/code/nel/src/sound/sound_bank.cpp b/code/nel/src/sound/sound_bank.cpp index 6e24947dd..6421e722b 100644 --- a/code/nel/src/sound/sound_bank.cpp +++ b/code/nel/src/sound/sound_bank.cpp @@ -124,6 +124,7 @@ CSoundBank::~CSoundBank() void CSoundBank::addSound(CSound *sound) { // nlassert(_Sounds.size() > sound->getName().getShortId()); + // nldebug("SOUNDBANK: Add %s", sound->getName().toString().c_str()); if (_Sounds.size() <= sound->getName().getShortId()) _Sounds.resize(sound->getName().getShortId() + 1); _Sounds[sound->getName().getShortId()] = sound; diff --git a/code/nel/tools/sound/build_soundbank/build_soundbank.cpp b/code/nel/tools/sound/build_soundbank/build_soundbank.cpp index 60abe4592..53848e20e 100644 --- a/code/nel/tools/sound/build_soundbank/build_soundbank.cpp +++ b/code/nel/tools/sound/build_soundbank/build_soundbank.cpp @@ -29,6 +29,7 @@ #include #include #include +#include // Project includes // ... @@ -75,6 +76,9 @@ int main(int nNbArg, char **ppArgs) // add search paths CPath::addSearchPath(leveldesignDir, true, false); CPath::addSearchPath(dfnDir, true, false); + + // init sheet_id.bin + NLMISC::CSheetId::init(false); // build the sound bank UAudioMixer::buildSoundBank(exportDir);