mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-20 16:08:44 +00:00
Fixed: Sound CSheetID implementation (part 2) (not tested)
--HG-- branch : sound_dev
This commit is contained in:
parent
3608f0a429
commit
9cd7498fe9
9 changed files with 17 additions and 27 deletions
|
@ -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" );
|
||||
|
|
|
@ -1132,7 +1132,7 @@ void CAudioMixerUser::CControledSources::serial(NLMISC::IStream &s)
|
|||
for (uint i=0; i<size; ++i)
|
||||
{
|
||||
s.serial(soundName);
|
||||
SoundNames.push_back(CSheetId(soundName.find(".sound") == std::string::npos ? (soundName + ".sound") : soundName));
|
||||
SoundNames.push_back(CSheetId(soundName, "sound"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -237,7 +237,7 @@ void CComplexSound::serial(NLMISC::IStream &s)
|
|||
{
|
||||
std::string name;
|
||||
s.serial(name);
|
||||
_Sounds.push_back(/*CStringMapper::map(name)*/NLMISC::CSheetId(name));
|
||||
_Sounds.push_back(NLMISC::CSheetId(name, "sound"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -246,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])*/_Sounds[i].toString();
|
||||
std::string name = _Sounds[i].toString();
|
||||
s.serial(name);
|
||||
}
|
||||
}
|
||||
|
@ -301,8 +301,8 @@ void CComplexSound::importForm(const std::string& filename, NLGEORGES::UFormElm&
|
|||
string soundname;
|
||||
if (psoundsArray->getArrayValue(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
_Name = NLMISC::CSheetId(std::string("<MusicChannel:") + NLMISC::CFile::getFilenameWithoutExtension(filePath) + ">");
|
||||
#else
|
||||
//_Name = NLMISC::CStringMapper::map("<MusicChannel>");
|
||||
_Name = NLMISC::CSheetId("<MusicChannel>");
|
||||
#endif
|
||||
#endif*/
|
||||
_Name = NLMISC::CSheetId("music_channel.sound");
|
||||
_ConeInnerAngle = NLMISC::Pi * 2;
|
||||
_ConeOuterAngle = NLMISC::Pi * 2;
|
||||
_Looping = loop;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue