mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 10:53:54 +00:00
Pass the new position to the sound update method
This commit is contained in:
parent
44fc204864
commit
f7ac94d686
3 changed files with 7 additions and 8 deletions
|
@ -96,7 +96,7 @@ public:
|
||||||
void Play(float volume, float pitch);
|
void Play(float volume, float pitch);
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
virtual bool isPlaying();
|
virtual bool isPlaying();
|
||||||
virtual void Update(MWWorld::Ptr ptr);
|
virtual void Update(const float *pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpenAL_Sound : public Sound
|
class OpenAL_Sound : public Sound
|
||||||
|
@ -110,7 +110,7 @@ public:
|
||||||
|
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
virtual bool isPlaying();
|
virtual bool isPlaying();
|
||||||
virtual void Update(MWWorld::Ptr ptr);
|
virtual void Update(const float *pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,9 +234,8 @@ bool OpenAL_SoundStream::isPlaying()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenAL_SoundStream::Update(MWWorld::Ptr ptr)
|
void OpenAL_SoundStream::Update(const float *pos)
|
||||||
{
|
{
|
||||||
const float *pos = ptr.getCellRef().pos.pos;
|
|
||||||
alSource3f(Source, AL_POSITION, pos[0], pos[2], -pos[1]);
|
alSource3f(Source, AL_POSITION, pos[0], pos[2], -pos[1]);
|
||||||
alSource3f(Source, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
alSource3f(Source, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
||||||
alSource3f(Source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
alSource3f(Source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
||||||
|
@ -271,9 +270,8 @@ bool OpenAL_Sound::isPlaying()
|
||||||
return state==AL_PLAYING;
|
return state==AL_PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenAL_Sound::Update(MWWorld::Ptr ptr)
|
void OpenAL_Sound::Update(const float *pos)
|
||||||
{
|
{
|
||||||
const float *pos = ptr.getCellRef().pos.pos;
|
|
||||||
alSource3f(Source, AL_POSITION, pos[0], pos[2], -pos[1]);
|
alSource3f(Source, AL_POSITION, pos[0], pos[2], -pos[1]);
|
||||||
alSource3f(Source, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
alSource3f(Source, AL_DIRECTION, 0.0f, 0.0f, 0.0f);
|
||||||
alSource3f(Source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
alSource3f(Source, AL_VELOCITY, 0.0f, 0.0f, 0.0f);
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace MWSound
|
||||||
{
|
{
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
virtual bool isPlaying() = 0;
|
virtual bool isPlaying() = 0;
|
||||||
virtual void Update(MWWorld::Ptr ptr) = 0;
|
virtual void Update(const float *pos) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Sound() { }
|
virtual ~Sound() { }
|
||||||
|
|
|
@ -358,7 +358,8 @@ namespace MWSound
|
||||||
IDMap::iterator iditer = snditer->second.begin();
|
IDMap::iterator iditer = snditer->second.begin();
|
||||||
while(iditer != snditer->second.end())
|
while(iditer != snditer->second.end())
|
||||||
{
|
{
|
||||||
iditer->second->Update(ptr);
|
const ESM::Position &pos = ptr.getCellRef().pos;
|
||||||
|
iditer->second->Update(pos.pos);
|
||||||
iditer++;
|
iditer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue