mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 07:53:52 +00:00
Add a function to update the sound listener
This commit is contained in:
parent
2429755bf1
commit
2dabdcb9e5
3 changed files with 17 additions and 0 deletions
|
@ -243,6 +243,18 @@ Sound* OpenAL_Output::StreamSound(const std::string &fname, std::auto_ptr<Sound_
|
|||
}
|
||||
|
||||
|
||||
void OpenAL_Output::UpdateListener(float pos[3], float atdir[3], float updir[3])
|
||||
{
|
||||
alListener3f(AL_POSITION, pos[0], pos[2], -pos[1]);
|
||||
ALfloat orient[6] = {
|
||||
atdir[0], atdir[2], -atdir[1],
|
||||
updir[0], updir[2], -updir[1]
|
||||
};
|
||||
alListenerfv(AL_ORIENTATION, orient);
|
||||
throwALerror();
|
||||
}
|
||||
|
||||
|
||||
OpenAL_Output::OpenAL_Output(SoundManager &mgr)
|
||||
: Sound_Output(mgr), Device(0), Context(0)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace MWSound
|
|||
|
||||
virtual Sound *StreamSound(const std::string &fname, std::auto_ptr<Sound_Decoder> decoder);
|
||||
|
||||
virtual void UpdateListener(float pos[3], float atdir[3], float updir[3]);
|
||||
|
||||
OpenAL_Output(SoundManager &mgr);
|
||||
virtual ~OpenAL_Output();
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@ namespace MWSound
|
|||
|
||||
virtual Sound *StreamSound(const std::string &fname, std::auto_ptr<Sound_Decoder> decoder) = 0;
|
||||
|
||||
// FIXME: This should take an MWWorld::Ptr that represents the in-world camera
|
||||
virtual void UpdateListener(float pos[3], float atdir[3], float updir[3]) = 0;
|
||||
|
||||
Sound_Output(SoundManager &mgr) : mgr(mgr) { }
|
||||
public:
|
||||
virtual ~Sound_Output() { }
|
||||
|
|
Loading…
Reference in a new issue