mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +00:00
Pass a proper PlayMode enum to playSound and playSound3D
This commit is contained in:
parent
3b7edae7c3
commit
7b2c3e6cd3
5 changed files with 12 additions and 20 deletions
|
@ -102,11 +102,11 @@ namespace MWBase
|
|||
///< Play a 2D audio track, using a custom decoder
|
||||
|
||||
virtual SoundPtr playSound(const std::string& soundId, float volume, float pitch,
|
||||
int mode=Play_Normal) = 0;
|
||||
PlayMode mode=Play_Normal) = 0;
|
||||
///< Play a sound, independently of 3D-position
|
||||
|
||||
virtual SoundPtr playSound3D(MWWorld::Ptr reference, const std::string& soundId,
|
||||
float volume, float pitch, int mode=Play_Normal) = 0;
|
||||
float volume, float pitch, PlayMode mode=Play_Normal) = 0;
|
||||
///< Play a sound from an object
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference, const std::string& soundId) = 0;
|
||||
|
@ -134,16 +134,6 @@ namespace MWBase
|
|||
|
||||
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir, const Ogre::Vector3 &up) = 0;
|
||||
};
|
||||
|
||||
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) | static_cast<int> (b); }
|
||||
inline int operator&(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) & static_cast<int> (b); }
|
||||
|
||||
inline int operator|(SoundManager::PlayType a, SoundManager::PlayType b)
|
||||
{ return static_cast<int> (a) | static_cast<int> (b); }
|
||||
inline int operator&(SoundManager::PlayType a, SoundManager::PlayType b)
|
||||
{ return static_cast<int> (a) & static_cast<int> (b); }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -118,7 +118,8 @@ namespace MWScript
|
|||
std::string sound = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, 1.0, 1.0, mLoop ? MWBase::SoundManager::Play_Loop : 0);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, 1.0, 1.0, mLoop ? MWBase::SoundManager::Play_Loop :
|
||||
MWBase::SoundManager::Play_Normal);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -144,7 +145,8 @@ namespace MWScript
|
|||
Interpreter::Type_Float pitch = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, volume, pitch, mLoop ? MWBase::SoundManager::Play_Loop : 0);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, sound, volume, pitch, mLoop ? MWBase::SoundManager::Play_Loop :
|
||||
MWBase::SoundManager::Play_Normal);
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -307,7 +307,7 @@ namespace MWSound
|
|||
}
|
||||
|
||||
|
||||
MWBase::SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, int mode)
|
||||
MWBase::SoundPtr SoundManager::playSound(const std::string& soundId, float volume, float pitch, PlayMode mode)
|
||||
{
|
||||
MWBase::SoundPtr sound;
|
||||
if(!mOutput->isInitialized())
|
||||
|
@ -329,7 +329,7 @@ namespace MWSound
|
|||
}
|
||||
|
||||
MWBase::SoundPtr SoundManager::playSound3D(MWWorld::Ptr ptr, const std::string& soundId,
|
||||
float volume, float pitch, int mode)
|
||||
float volume, float pitch, PlayMode mode)
|
||||
{
|
||||
MWBase::SoundPtr sound;
|
||||
if(!mOutput->isInitialized())
|
||||
|
|
|
@ -110,11 +110,11 @@ namespace MWSound
|
|||
virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type);
|
||||
///< Play a 2D audio track, using a custom decoder
|
||||
|
||||
virtual MWBase::SoundPtr playSound(const std::string& soundId, float volume, float pitch, int mode=Play_Normal);
|
||||
virtual MWBase::SoundPtr playSound(const std::string& soundId, float volume, float pitch, PlayMode mode=Play_Normal);
|
||||
///< Play a sound, independently of 3D-position
|
||||
|
||||
virtual MWBase::SoundPtr playSound3D(MWWorld::Ptr reference, const std::string& soundId,
|
||||
float volume, float pitch, int mode=Play_Normal);
|
||||
float volume, float pitch, PlayMode mode=Play_Normal);
|
||||
///< Play a sound from an object
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference, const std::string& soundId);
|
||||
|
|
|
@ -738,7 +738,7 @@ void WeatherManager::update(float duration)
|
|||
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), ambientSnd) == mSoundsPlaying.end())
|
||||
{
|
||||
mSoundsPlaying.push_back(ambientSnd);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(ambientSnd, 1.0, 1.0, true);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(ambientSnd, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ void WeatherManager::update(float duration)
|
|||
if (std::find(mSoundsPlaying.begin(), mSoundsPlaying.end(), rainSnd) == mSoundsPlaying.end())
|
||||
{
|
||||
mSoundsPlaying.push_back(rainSnd);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(rainSnd, 1.0, 1.0, true);
|
||||
MWBase::Environment::get().getSoundManager()->playSound(rainSnd, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue