mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 13:53:55 +00:00
Prefix some SoundManager class member variables
This commit is contained in:
parent
2f92559fc7
commit
162642e672
2 changed files with 33 additions and 33 deletions
|
@ -47,10 +47,10 @@ namespace MWSound
|
||||||
std::cout << "Sound output: " << SOUND_OUT << std::endl;
|
std::cout << "Sound output: " << SOUND_OUT << std::endl;
|
||||||
std::cout << "Sound decoder: " << SOUND_IN << std::endl;
|
std::cout << "Sound decoder: " << SOUND_IN << std::endl;
|
||||||
|
|
||||||
Output.reset(new DEFAULT_OUTPUT(*this));
|
mOutput.reset(new DEFAULT_OUTPUT(*this));
|
||||||
if(!Output->Initialize())
|
if(!mOutput->Initialize())
|
||||||
{
|
{
|
||||||
Output.reset();
|
mOutput.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ namespace MWSound
|
||||||
|
|
||||||
SoundManager::~SoundManager()
|
SoundManager::~SoundManager()
|
||||||
{
|
{
|
||||||
LooseSounds.clear();
|
mLooseSounds.clear();
|
||||||
ActiveSounds.clear();
|
mActiveSounds.clear();
|
||||||
mMusic.reset();
|
mMusic.reset();
|
||||||
Output.reset();
|
mOutput.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a new decoder instance, used as needed by the output implementations
|
// Return a new decoder instance, used as needed by the output implementations
|
||||||
|
@ -130,11 +130,11 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
Sound *sound;
|
Sound *sound;
|
||||||
const ESM::Position &pos = ptr.getCellRef().pos;
|
const ESM::Position &pos = ptr.getCellRef().pos;
|
||||||
sound = Output->PlaySound3D(file, pos.pos, volume, pitch, min, max, loop);
|
sound = mOutput->PlaySound3D(file, pos.pos, volume, pitch, min, max, loop);
|
||||||
if(untracked)
|
if(untracked)
|
||||||
LooseSounds[id] = SoundPtr(sound);
|
mLooseSounds[id] = SoundPtr(sound);
|
||||||
else
|
else
|
||||||
ActiveSounds[ptr][id] = SoundPtr(sound);
|
mActiveSounds[ptr][id] = SoundPtr(sound);
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
|
@ -144,8 +144,8 @@ namespace MWSound
|
||||||
|
|
||||||
bool SoundManager::isPlaying(MWWorld::Ptr ptr, const std::string &id) const
|
bool SoundManager::isPlaying(MWWorld::Ptr ptr, const std::string &id) const
|
||||||
{
|
{
|
||||||
SoundMap::const_iterator snditer = ActiveSounds.find(ptr);
|
SoundMap::const_iterator snditer = mActiveSounds.find(ptr);
|
||||||
if(snditer == ActiveSounds.end())
|
if(snditer == mActiveSounds.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
IDMap::const_iterator iditer = snditer->second.find(id);
|
IDMap::const_iterator iditer = snditer->second.find(id);
|
||||||
|
@ -167,7 +167,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
if(mMusic)
|
if(mMusic)
|
||||||
mMusic->Stop();
|
mMusic->Stop();
|
||||||
mMusic.reset(Output->StreamSound(filename, 0.4f, 1.0f));
|
mMusic.reset(mOutput->StreamSound(filename, 0.4f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::streamMusic(const std::string& filename)
|
void SoundManager::streamMusic(const std::string& filename)
|
||||||
|
@ -277,8 +277,8 @@ namespace MWSound
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Sound *sound;
|
Sound *sound;
|
||||||
sound = Output->PlaySound(file, volume, pitch, loop);
|
sound = mOutput->PlaySound(file, volume, pitch, loop);
|
||||||
LooseSounds[soundId] = SoundPtr(sound);
|
mLooseSounds[soundId] = SoundPtr(sound);
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
|
@ -305,8 +305,8 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
// Stop a sound and remove it from the list. If soundId="" then
|
// Stop a sound and remove it from the list. If soundId="" then
|
||||||
// stop all its sounds.
|
// stop all its sounds.
|
||||||
SoundMap::iterator snditer = ActiveSounds.find(ptr);
|
SoundMap::iterator snditer = mActiveSounds.find(ptr);
|
||||||
if(snditer == ActiveSounds.end())
|
if(snditer == mActiveSounds.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!soundId.empty())
|
if(!soundId.empty())
|
||||||
|
@ -316,21 +316,21 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
snditer->second.erase(iditer);
|
snditer->second.erase(iditer);
|
||||||
if(snditer->second.size() == 0)
|
if(snditer->second.size() == 0)
|
||||||
ActiveSounds.erase(snditer);
|
mActiveSounds.erase(snditer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ActiveSounds.erase(snditer);
|
mActiveSounds.erase(snditer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::stopSound(MWWorld::Ptr::CellStore *cell)
|
void SoundManager::stopSound(MWWorld::Ptr::CellStore *cell)
|
||||||
{
|
{
|
||||||
// Remove all references to objects belonging to a given cell
|
// Remove all references to objects belonging to a given cell
|
||||||
SoundMap::iterator snditer = ActiveSounds.begin();
|
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||||
while(snditer != ActiveSounds.end())
|
while(snditer != mActiveSounds.end())
|
||||||
{
|
{
|
||||||
if(snditer->first.getCell() == cell)
|
if(snditer->first.getCell() == cell)
|
||||||
ActiveSounds.erase(snditer++);
|
mActiveSounds.erase(snditer++);
|
||||||
else
|
else
|
||||||
snditer++;
|
snditer++;
|
||||||
}
|
}
|
||||||
|
@ -338,9 +338,9 @@ namespace MWSound
|
||||||
|
|
||||||
void SoundManager::stopSound(const std::string& soundId)
|
void SoundManager::stopSound(const std::string& soundId)
|
||||||
{
|
{
|
||||||
IDMap::iterator iditer = LooseSounds.find(soundId);
|
IDMap::iterator iditer = mLooseSounds.find(soundId);
|
||||||
if(iditer != LooseSounds.end())
|
if(iditer != mLooseSounds.end())
|
||||||
LooseSounds.erase(iditer);
|
mLooseSounds.erase(iditer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundManager::getSoundPlaying(MWWorld::Ptr ptr, const std::string& soundId) const
|
bool SoundManager::getSoundPlaying(MWWorld::Ptr ptr, const std::string& soundId) const
|
||||||
|
@ -350,8 +350,8 @@ namespace MWSound
|
||||||
|
|
||||||
void SoundManager::updateObject(MWWorld::Ptr ptr)
|
void SoundManager::updateObject(MWWorld::Ptr ptr)
|
||||||
{
|
{
|
||||||
SoundMap::iterator snditer = ActiveSounds.find(ptr);
|
SoundMap::iterator snditer = mActiveSounds.find(ptr);
|
||||||
if(snditer == ActiveSounds.end())
|
if(snditer == mActiveSounds.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IDMap::iterator iditer = snditer->second.begin();
|
IDMap::iterator iditer = snditer->second.begin();
|
||||||
|
@ -443,15 +443,15 @@ namespace MWSound
|
||||||
float pos[3] = { nPos[0], -nPos[2], nPos[1] };
|
float pos[3] = { nPos[0], -nPos[2], nPos[1] };
|
||||||
float at[3] = { nDir[0], -nDir[2], nDir[1] };
|
float at[3] = { nDir[0], -nDir[2], nDir[1] };
|
||||||
float up[3] = { nUp[0], -nUp[2], nUp[1] };
|
float up[3] = { nUp[0], -nUp[2], nUp[1] };
|
||||||
Output->UpdateListener(pos, at, up);
|
mOutput->UpdateListener(pos, at, up);
|
||||||
|
|
||||||
// Check if any "untracked" sounds are finished playing, and trash
|
// Check if any "untracked" sounds are finished playing, and trash
|
||||||
// them
|
// them
|
||||||
IDMap::iterator snditer = LooseSounds.begin();
|
IDMap::iterator snditer = mLooseSounds.begin();
|
||||||
while(snditer != LooseSounds.end())
|
while(snditer != mLooseSounds.end())
|
||||||
{
|
{
|
||||||
if(!snditer->second->isPlaying())
|
if(!snditer->second->isPlaying())
|
||||||
LooseSounds.erase(snditer++);
|
mLooseSounds.erase(snditer++);
|
||||||
else
|
else
|
||||||
snditer++;
|
snditer++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWSound
|
||||||
|
|
||||||
MWWorld::Environment& mEnvironment;
|
MWWorld::Environment& mEnvironment;
|
||||||
|
|
||||||
std::auto_ptr<Sound_Output> Output;
|
std::auto_ptr<Sound_Output> mOutput;
|
||||||
|
|
||||||
boost::shared_ptr<Sound> mMusic;
|
boost::shared_ptr<Sound> mMusic;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ namespace MWSound
|
||||||
typedef boost::shared_ptr<Sound> SoundPtr;
|
typedef boost::shared_ptr<Sound> SoundPtr;
|
||||||
typedef std::map<std::string,SoundPtr> IDMap;
|
typedef std::map<std::string,SoundPtr> IDMap;
|
||||||
typedef std::map<MWWorld::Ptr,IDMap> SoundMap;
|
typedef std::map<MWWorld::Ptr,IDMap> SoundMap;
|
||||||
SoundMap ActiveSounds;
|
SoundMap mActiveSounds;
|
||||||
IDMap LooseSounds;
|
IDMap mLooseSounds;
|
||||||
|
|
||||||
std::string lookup(const std::string &soundId,
|
std::string lookup(const std::string &soundId,
|
||||||
float &volume, float &min, float &max);
|
float &volume, float &min, float &max);
|
||||||
|
|
Loading…
Reference in a new issue