mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-31 19:45:32 +00:00
Store the underwater sound to easily stop it
This commit is contained in:
parent
16331bf1ed
commit
02df8ab841
2 changed files with 8 additions and 5 deletions
|
@ -103,6 +103,7 @@ namespace MWSound
|
|||
|
||||
SoundManager::~SoundManager()
|
||||
{
|
||||
mUnderwaterSound.reset();
|
||||
mActiveSounds.clear();
|
||||
mMusic.reset();
|
||||
mOutput.reset();
|
||||
|
@ -550,13 +551,13 @@ namespace MWSound
|
|||
{
|
||||
env = Env_Underwater;
|
||||
//play underwater sound
|
||||
if(!getSoundPlaying(MWWorld::Ptr(), "Underwater"))
|
||||
playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv);
|
||||
if(!(mUnderwaterSound && mUnderwaterSound->isPlaying()))
|
||||
mUnderwaterSound = playSound("Underwater", 1.0f, 1.0f, Play_TypeSfx, Play_LoopNoEnv);
|
||||
}
|
||||
else
|
||||
else if(mUnderwaterSound)
|
||||
{
|
||||
//no need to check if it's playing, stop sound does nothing in that case
|
||||
stopSound("Underwater");
|
||||
mUnderwaterSound->stop();
|
||||
mUnderwaterSound.reset();
|
||||
}
|
||||
|
||||
mOutput->updateListener(
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace MWSound
|
|||
typedef std::map<MWBase::SoundPtr,PtrIDPair> SoundMap;
|
||||
SoundMap mActiveSounds;
|
||||
|
||||
MWBase::SoundPtr mUnderwaterSound;
|
||||
|
||||
Ogre::Vector3 mListenerPos;
|
||||
Ogre::Vector3 mListenerDir;
|
||||
Ogre::Vector3 mListenerUp;
|
||||
|
|
Loading…
Reference in a new issue