mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Split stopSound3D into separate functions to deal with stopping all sounds on an object
This commit is contained in:
parent
033faba9c4
commit
f0db2ab82f
2 changed files with 21 additions and 24 deletions
|
@ -230,10 +230,6 @@ namespace MWSound
|
|||
}
|
||||
|
||||
void SoundManager::stopSound3D(MWWorld::Ptr ptr, const std::string& soundId)
|
||||
{
|
||||
// Stop a sound and remove it from the list. If soundId="" then
|
||||
// stop all its sounds.
|
||||
if(!soundId.empty())
|
||||
{
|
||||
SoundMap::iterator snditer = mActiveSounds.find(std::make_pair(ptr, soundId));
|
||||
if(snditer == mActiveSounds.end())
|
||||
|
@ -242,7 +238,8 @@ namespace MWSound
|
|||
snditer->second->stop();
|
||||
mActiveSounds.erase(snditer);
|
||||
}
|
||||
else
|
||||
|
||||
void SoundManager::stopSound3D(MWWorld::Ptr ptr)
|
||||
{
|
||||
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||
while(snditer != mActiveSounds.end())
|
||||
|
@ -256,11 +253,9 @@ namespace MWSound
|
|||
snditer++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SoundManager::stopSound(const MWWorld::Ptr::CellStore *cell)
|
||||
{
|
||||
// Remove all references to objects belonging to a given cell
|
||||
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||
while(snditer != mActiveSounds.end())
|
||||
{
|
||||
|
|
|
@ -95,9 +95,11 @@ namespace MWSound
|
|||
bool untracked=false);
|
||||
///< Play a sound from an object
|
||||
|
||||
void stopSound3D(MWWorld::Ptr reference, const std::string& soundId="");
|
||||
///< Stop the given object from playing the given sound, If no soundId is given,
|
||||
/// all sounds for this reference will stop.
|
||||
void stopSound3D(MWWorld::Ptr reference, const std::string& soundId);
|
||||
///< Stop the given object from playing the given sound,
|
||||
|
||||
void stopSound3D(MWWorld::Ptr reference);
|
||||
///< Stop the given object from playing all sounds.
|
||||
|
||||
void stopSound(const MWWorld::Ptr::CellStore *cell);
|
||||
///< Stop all sounds for the given cell.
|
||||
|
|
Loading…
Reference in a new issue