From 2d884fc035d403d43c7a18e3e61cd56ccdfbec2b Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sun, 7 Aug 2011 11:54:58 +0000 Subject: 3D Audio GSoC: * Pepper depends on ffmpeg 0.7.1 or higher now, windows and mac build systems set to ffmpeg-0.8 * Fixed orientation retrieval in OpenAL device code. * Added stopAll() method to AUD_IDevice (also for Python) and call it on BGE exit * Changed BGE to use audaspace via native C++ instead over the C API. * Made AUD_SequencerFactory and AUD_SequencerEntry thread safe. * Changed sound caching into a flag which fixes problems on file loading, especially with undo. * Removed unused parameter from sound_mute_scene_sound * Fixed bug: changing FPS didn't update the sequencer sound positions. * Fixed bug: Properties of sequencer strips weren't set correctly. * Minor warning fixes. --- intern/audaspace/OpenAL/AUD_OpenALDevice.cpp | 24 ++++++++++++++++++++---- intern/audaspace/OpenAL/AUD_OpenALDevice.h | 9 +++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'intern/audaspace/OpenAL') 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_OpenALDevice::play(AUD_Reference 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; @@ -204,6 +207,11 @@ private: */ AUD_Buffer m_buffer; + /** + * Orientation. + */ + AUD_Quaternion m_orientation; + /** * Starts the streaming thread. */ @@ -243,6 +251,7 @@ public: virtual AUD_DeviceSpecs getSpecs() const; virtual AUD_Reference play(AUD_Reference reader, bool keep = false); virtual AUD_Reference play(AUD_Reference factory, bool keep = false); + virtual void stopAll(); virtual void lock(); virtual void unlock(); virtual float getVolume() const; -- cgit v1.2.3