diff options
Diffstat (limited to 'intern/audaspace/OpenAL')
-rw-r--r-- | intern/audaspace/OpenAL/AUD_OpenALDevice.cpp | 24 | ||||
-rw-r--r-- | intern/audaspace/OpenAL/AUD_OpenALDevice.h | 9 |
2 files changed, 29 insertions, 4 deletions
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp index 40fc8a55f03..d5b365fa62f 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.cpp @@ -469,8 +469,7 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceVelocity(const AUD_Vector3& ve AUD_Quaternion AUD_OpenALDevice::AUD_OpenALHandle::getSourceOrientation() { - // AUD_XXX not implemented yet - return AUD_Quaternion(0, 0, 0, 0); + return m_orientation; } bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaternion& orientation) @@ -491,6 +490,8 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::setSourceOrientation(const AUD_Quaterni m_device->unlock(); + m_orientation = orientation; + return true; } @@ -1284,6 +1285,21 @@ AUD_Reference<AUD_IHandle> AUD_OpenALDevice::play(AUD_Reference<AUD_IFactory> fa return play(factory->createReader(), keep); } +void AUD_OpenALDevice::stopAll() +{ + lock(); + alcSuspendContext(m_context); + + while(!m_playingSounds.empty()) + m_playingSounds.front()->stop(); + + while(!m_pausedSounds.empty()) + m_pausedSounds.front()->stop(); + + alcProcessContext(m_context); + unlock(); +} + void AUD_OpenALDevice::lock() { pthread_mutex_lock(&m_mutex); @@ -1454,8 +1470,7 @@ void AUD_OpenALDevice::setListenerVelocity(const AUD_Vector3& velocity) AUD_Quaternion AUD_OpenALDevice::getListenerOrientation() const { - // AUD_XXX not implemented yet - return AUD_Quaternion(0, 0, 0, 0); + return m_orientation; } void AUD_OpenALDevice::setListenerOrientation(const AUD_Quaternion& orientation) @@ -1474,6 +1489,7 @@ void AUD_OpenALDevice::setListenerOrientation(const AUD_Quaternion& orientation) direction[5] = 2 * (orientation.w() * orientation.x() + orientation.y() * orientation.z()); alListenerfv(AL_ORIENTATION, direction); + m_orientation = orientation; } float AUD_OpenALDevice::getSpeedOfSound() const diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h index 3ba761bad5a..3e8b05d79e2 100644 --- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h +++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h @@ -89,6 +89,9 @@ private: /// Stop callback data. void* m_stop_data; + /// Orientation. + AUD_Quaternion m_orientation; + /// Current status of the handle AUD_Status m_status; @@ -205,6 +208,11 @@ private: AUD_Buffer m_buffer; /** + * Orientation. + */ + AUD_Quaternion m_orientation; + + /** * Starts the streaming thread. */ void start(bool join = true); @@ -243,6 +251,7 @@ public: virtual AUD_DeviceSpecs getSpecs() const; virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IReader> reader, bool keep = false); virtual AUD_Reference<AUD_IHandle> play(AUD_Reference<AUD_IFactory> factory, bool keep = false); + virtual void stopAll(); virtual void lock(); virtual void unlock(); virtual float getVolume() const; |