|
|
|
@ -20,9 +20,9 @@
|
|
|
|
|
|
|
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
|
|
|
|
|
#include "sound_output.hpp"
|
|
|
|
|
#include "sound_buffer.hpp"
|
|
|
|
|
#include "sound_decoder.hpp"
|
|
|
|
|
#include "sound_output.hpp"
|
|
|
|
|
#include "sound.hpp"
|
|
|
|
|
|
|
|
|
|
#include "openal_output.hpp"
|
|
|
|
@ -578,7 +578,7 @@ namespace MWSound
|
|
|
|
|
if(!sfx) return nullptr;
|
|
|
|
|
|
|
|
|
|
// Only one copy of given sound can be played at time, so stop previous copy
|
|
|
|
|
stopSound(soundId);
|
|
|
|
|
stopSound(sfx, MWWorld::ConstPtr());
|
|
|
|
|
|
|
|
|
|
Sound *sound = getSoundRef();
|
|
|
|
|
sound->init(volume * sfx->mVolume, volumeFromType(type), pitch, mode|type|Play_2D);
|
|
|
|
@ -614,7 +614,7 @@ namespace MWSound
|
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
|
|
// Only one copy of given sound can be played at time on ptr, so stop previous copy
|
|
|
|
|
stopSound3D(ptr, soundId);
|
|
|
|
|
stopSound(sfx, ptr);
|
|
|
|
|
|
|
|
|
|
bool played;
|
|
|
|
|
Sound *sound = getSoundRef();
|
|
|
|
@ -681,12 +681,11 @@ namespace MWSound
|
|
|
|
|
mOutput->finishSound(sound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr, const std::string& soundId)
|
|
|
|
|
void SoundManager::stopSound(Sound_Buffer *sfx, const MWWorld::ConstPtr &ptr)
|
|
|
|
|
{
|
|
|
|
|
SoundMap::iterator snditer = mActiveSounds.find(ptr);
|
|
|
|
|
if(snditer != mActiveSounds.end())
|
|
|
|
|
{
|
|
|
|
|
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
|
|
|
|
for(SoundBufferRefPair &snd : snditer->second)
|
|
|
|
|
{
|
|
|
|
|
if(snd.second == sfx)
|
|
|
|
@ -695,6 +694,22 @@ namespace MWSound
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::stopSound(const std::string& soundId)
|
|
|
|
|
{
|
|
|
|
|
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
|
|
|
|
if (!sfx) return;
|
|
|
|
|
|
|
|
|
|
stopSound(sfx, MWWorld::ConstPtr());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr, const std::string& soundId)
|
|
|
|
|
{
|
|
|
|
|
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
|
|
|
|
if (!sfx) return;
|
|
|
|
|
|
|
|
|
|
stopSound(sfx, ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::stopSound3D(const MWWorld::ConstPtr &ptr)
|
|
|
|
|
{
|
|
|
|
|
SoundMap::iterator snditer = mActiveSounds.find(ptr);
|
|
|
|
@ -718,6 +733,7 @@ namespace MWSound
|
|
|
|
|
mOutput->finishSound(sndbuf.first);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(SaySoundMap::value_type &snd : mActiveSaySounds)
|
|
|
|
|
{
|
|
|
|
|
if(!snd.first.isEmpty() && snd.first != MWMechanics::getPlayer() && snd.first.getCell() == cell)
|
|
|
|
@ -725,20 +741,6 @@ namespace MWSound
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::stopSound(const std::string& soundId)
|
|
|
|
|
{
|
|
|
|
|
SoundMap::iterator snditer = mActiveSounds.find(MWWorld::ConstPtr());
|
|
|
|
|
if(snditer != mActiveSounds.end())
|
|
|
|
|
{
|
|
|
|
|
Sound_Buffer *sfx = loadSound(Misc::StringUtils::lowerCase(soundId));
|
|
|
|
|
for(SoundBufferRefPair &sndbuf : snditer->second)
|
|
|
|
|
{
|
|
|
|
|
if(sndbuf.second == sfx)
|
|
|
|
|
mOutput->finishSound(sndbuf.first);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SoundManager::fadeOutSound3D(const MWWorld::ConstPtr &ptr,
|
|
|
|
|
const std::string& soundId, float duration)
|
|
|
|
|
{
|
|
|
|
|