Fixed: Make build_soundbank tool work with latest changes

This commit is contained in:
kaetemi 2012-06-03 16:00:43 +02:00
parent fb7689db88
commit 6cfb10a275
5 changed files with 15 additions and 6 deletions

View file

@ -468,7 +468,7 @@ void CAudioMixerUser::initDevice(const std::string &deviceName, const CInitInfo
nlwarning("AM: OptionSoftwareBuffer not available, forceSoftwareBuffer = false"); 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 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"); 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 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. /// 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) std::string UAudioMixer::buildSoundBank(const std::string &packedSheetDir)
{ {
CGroupControllerRoot *tempRoot = NULL;
if (!CGroupControllerRoot::isInitialized())
tempRoot = new CGroupControllerRoot();
std::string dir = CPath::standardizePath(packedSheetDir, true); std::string dir = CPath::standardizePath(packedSheetDir, true);
CSoundBank *soundBank = new CSoundBank(); CSoundBank *soundBank = new CSoundBank();
soundBank->load(dir, true); soundBank->load(dir, true);
delete soundBank; delete soundBank;
delete tempRoot;
return dir + "sounds.packed_sheets"; return dir + "sounds.packed_sheets";
} }

View file

@ -43,7 +43,7 @@ using namespace std;
namespace NLSOUND { namespace NLSOUND {
CGroupControllerRoot::CGroupControllerRoot() : CGroupController(NULL) CGroupControllerRoot::CGroupControllerRoot() : CGroupController(NULL), NLMISC::CManualSingleton<CGroupControllerRoot>()
{ {
} }

View file

@ -136,15 +136,15 @@ void CSound::serial(NLMISC::IStream &s)
_Name.serialString(s, "sound"); _Name.serialString(s, "sound");
nlassert(CGroupControllerRoot::getInstance()); // not sure nlassert(CGroupControllerRoot::isInitialized()); // not sure
#if NLSOUND_SHEET_VERSION_BUILT < 2 #if NLSOUND_SHEET_VERSION_BUILT < 2
if (s.isReading()) _GroupController = static_cast<CGroupController *>(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 #else
if (s.isReading()) if (s.isReading())
{ {
std::string groupControllerPath; std::string groupControllerPath;
s.serial(groupControllerPath); s.serial(groupControllerPath);
_GroupController = static_cast<CGroupController *>(CAudioMixerUser::instance()->getGroupController(groupControllerPath)); _GroupController = CGroupControllerRoot::getInstance()->getGroupController(groupControllerPath);
} }
else else
{ {
@ -245,7 +245,7 @@ void CSound::importForm(const std::string& filename, NLGEORGES::UFormElm& roo
_Priority = MidPri; _Priority = MidPri;
} }
nlassert(CGroupControllerRoot::getInstance()); // not sure nlassert(CGroupControllerRoot::isInitialized()); // not sure
#if NLSOUND_SHEET_VERSION_BUILT < 2 #if NLSOUND_SHEET_VERSION_BUILT < 2
_GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER); _GroupController = CGroupControllerRoot::getInstance()->getGroupController(NLSOUND_SHEET_V1_DEFAULT_SOUND_GROUP_CONTROLLER);
#else #else

View file

@ -124,6 +124,7 @@ CSoundBank::~CSoundBank()
void CSoundBank::addSound(CSound *sound) void CSoundBank::addSound(CSound *sound)
{ {
// nlassert(_Sounds.size() > sound->getName().getShortId()); // nlassert(_Sounds.size() > sound->getName().getShortId());
// nldebug("SOUNDBANK: Add %s", sound->getName().toString().c_str());
if (_Sounds.size() <= sound->getName().getShortId()) if (_Sounds.size() <= sound->getName().getShortId())
_Sounds.resize(sound->getName().getShortId() + 1); _Sounds.resize(sound->getName().getShortId() + 1);
_Sounds[sound->getName().getShortId()] = sound; _Sounds[sound->getName().getShortId()] = sound;

View file

@ -29,6 +29,7 @@
#include <nel/misc/log.h> #include <nel/misc/log.h>
#include <nel/misc/path.h> #include <nel/misc/path.h>
#include <nel/sound/u_audio_mixer.h> #include <nel/sound/u_audio_mixer.h>
#include <nel/misc/sheet_id.h>
// Project includes // Project includes
// ... // ...
@ -75,6 +76,9 @@ int main(int nNbArg, char **ppArgs)
// add search paths // add search paths
CPath::addSearchPath(leveldesignDir, true, false); CPath::addSearchPath(leveldesignDir, true, false);
CPath::addSearchPath(dfnDir, true, false); CPath::addSearchPath(dfnDir, true, false);
// init sheet_id.bin
NLMISC::CSheetId::init(false);
// build the sound bank // build the sound bank
UAudioMixer::buildSoundBank(exportDir); UAudioMixer::buildSoundBank(exportDir);