forked from mirror/openmw-tes3mp
Rename a couple members to avoid confusion
This commit is contained in:
parent
1ce3e7f5b9
commit
4bd235284b
3 changed files with 23 additions and 29 deletions
|
@ -666,7 +666,7 @@ MWBase::SoundPtr OpenAL_Output::playSound(Sound_Handle data, float vol, float ba
|
|||
alSourcei(source, AL_LOOPING, (flags&MWBase::SoundManager::Play_Loop) ? AL_TRUE : AL_FALSE);
|
||||
|
||||
ALfloat gain = vol*basevol;
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mLastEnvironment == Env_Underwater)
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mListenerEnv == Env_Underwater)
|
||||
{
|
||||
gain *= 0.9f;
|
||||
pitch *= 0.7f;
|
||||
|
@ -715,9 +715,9 @@ MWBase::SoundPtr OpenAL_Output::playSound3D(Sound_Handle data, const osg::Vec3f
|
|||
alSourcei(source, AL_LOOPING, (flags&MWBase::SoundManager::Play_Loop) ? AL_TRUE : AL_FALSE);
|
||||
|
||||
ALfloat gain = vol*basevol;
|
||||
if((pos - mPos).length2() > maxdist*maxdist)
|
||||
if((pos - mListenerPos).length2() > maxdist*maxdist)
|
||||
gain = 0.0f;
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mLastEnvironment == Env_Underwater)
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mListenerEnv == Env_Underwater)
|
||||
{
|
||||
gain *= 0.9f;
|
||||
pitch *= 0.7f;
|
||||
|
@ -797,7 +797,7 @@ MWBase::SoundStreamPtr OpenAL_Output::streamSound(DecoderPtr decoder, float base
|
|||
alSourcei(source, AL_LOOPING, AL_FALSE);
|
||||
|
||||
ALfloat gain = basevol;
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mLastEnvironment == Env_Underwater)
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mListenerEnv == Env_Underwater)
|
||||
{
|
||||
gain *= 0.9f;
|
||||
pitch *= 0.7f;
|
||||
|
@ -847,9 +847,9 @@ MWBase::SoundStreamPtr OpenAL_Output::streamSound3D(DecoderPtr decoder, const os
|
|||
alSourcei(source, AL_LOOPING, AL_FALSE);
|
||||
|
||||
ALfloat gain = volume*basevol;
|
||||
if((pos - mPos).length2() > maxdist*maxdist)
|
||||
if((pos - mListenerPos).length2() > maxdist*maxdist)
|
||||
gain = 0.0f;
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mLastEnvironment == Env_Underwater)
|
||||
if(!(flags&MWBase::SoundManager::Play_NoEnv) && mListenerEnv == Env_Underwater)
|
||||
{
|
||||
gain *= 0.9f;
|
||||
pitch *= 0.7f;
|
||||
|
@ -937,19 +937,19 @@ void OpenAL_Output::finishUpdate()
|
|||
|
||||
void OpenAL_Output::updateListener(const osg::Vec3f &pos, const osg::Vec3f &atdir, const osg::Vec3f &updir, Environment env)
|
||||
{
|
||||
mPos = pos;
|
||||
mLastEnvironment = env;
|
||||
|
||||
if(mContext)
|
||||
{
|
||||
ALfloat orient[6] = {
|
||||
atdir.x(), atdir.y(), atdir.z(),
|
||||
updir.x(), updir.y(), updir.z()
|
||||
};
|
||||
alListener3f(AL_POSITION, mPos.x(), mPos.y(), mPos.z());
|
||||
alListenerfv(AL_POSITION, pos.ptr());
|
||||
alListenerfv(AL_ORIENTATION, orient);
|
||||
throwALerror();
|
||||
}
|
||||
|
||||
mListenerPos = pos;
|
||||
mListenerEnv = env;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1011,8 +1011,9 @@ void OpenAL_Output::loadLoudnessAsync(DecoderPtr decoder, Sound_Loudness *loudne
|
|||
|
||||
|
||||
OpenAL_Output::OpenAL_Output(SoundManager &mgr)
|
||||
: Sound_Output(mgr), mDevice(0), mContext(0), mLastEnvironment(Env_Normal),
|
||||
mStreamThread(new StreamThread)
|
||||
: Sound_Output(mgr), mDevice(0), mContext(0)
|
||||
, mListenerPos(0.0f, 0.0f, 0.0f), mListenerEnv(Env_Normal)
|
||||
, mStreamThread(new StreamThread)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,16 @@ namespace MWSound
|
|||
typedef std::vector<MWBase::SoundStreamPtr> StreamVec;
|
||||
StreamVec mActiveStreams;
|
||||
|
||||
Environment mLastEnvironment;
|
||||
osg::Vec3f mListenerPos;
|
||||
Environment mListenerEnv;
|
||||
|
||||
struct StreamThread;
|
||||
std::auto_ptr<StreamThread> mStreamThread;
|
||||
|
||||
OpenAL_Output& operator=(const OpenAL_Output &rhs);
|
||||
OpenAL_Output(const OpenAL_Output &rhs);
|
||||
|
||||
public:
|
||||
virtual std::vector<std::string> enumerate();
|
||||
virtual void init(const std::string &devname="");
|
||||
virtual void deinit();
|
||||
|
@ -63,20 +71,8 @@ namespace MWSound
|
|||
|
||||
virtual void loadLoudnessAsync(DecoderPtr decoder, Sound_Loudness *loudness);
|
||||
|
||||
OpenAL_Output& operator=(const OpenAL_Output &rhs);
|
||||
OpenAL_Output(const OpenAL_Output &rhs);
|
||||
|
||||
OpenAL_Output(SoundManager &mgr);
|
||||
virtual ~OpenAL_Output();
|
||||
|
||||
struct StreamThread;
|
||||
std::auto_ptr<StreamThread> mStreamThread;
|
||||
|
||||
friend class OpenAL_Sound;
|
||||
friend class OpenAL_Sound3D;
|
||||
friend class OpenAL_SoundStream;
|
||||
friend class OpenAL_SoundStream3D;
|
||||
friend class SoundManager;
|
||||
};
|
||||
#ifndef DEFAULT_OUTPUT
|
||||
#define DEFAULT_OUTPUT(x) ::MWSound::OpenAL_Output((x))
|
||||
|
|
|
@ -64,12 +64,9 @@ namespace MWSound
|
|||
|
||||
protected:
|
||||
bool mInitialized;
|
||||
osg::Vec3f mPos;
|
||||
|
||||
Sound_Output(SoundManager &mgr)
|
||||
: mManager(mgr)
|
||||
, mInitialized(false)
|
||||
, mPos(0.0f, 0.0f, 0.0f)
|
||||
: mManager(mgr), mInitialized(false)
|
||||
{ }
|
||||
public:
|
||||
virtual ~Sound_Output() { }
|
||||
|
|
Loading…
Reference in a new issue