From 364ebb905993f25f429f9153da03cc449c5b8c85 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Tue, 26 Jul 2016 15:22:09 +0200 Subject: [PATCH] Update to the latestaienwave.hpp header file --- simgear/sound/sample_group.cxx | 17 +++++++++-------- simgear/sound/sample_group.hxx | 8 ++++---- simgear/sound/soundmgr_aeonwave.cxx | 16 +++++++++++----- simgear/sound/soundmgr_aeonwave.hxx | 8 ++++---- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/simgear/sound/sample_group.cxx b/simgear/sound/sample_group.cxx index 2a922619..e45165a3 100644 --- a/simgear/sound/sample_group.cxx +++ b/simgear/sound/sample_group.cxx @@ -69,9 +69,10 @@ SGSampleGroup::~SGSampleGroup () _smgr = 0; } +#include void SGSampleGroup::cleanup_removed_samples() { - // Delete any OpenAL buffers that might still be in use. + // Delete any buffers that might still be in use. unsigned int size = _removed_samples.size(); for (unsigned int i=0; iis_sample_stopped(sample)) { // sample is stopped because it wasn't looping sample->stop(); @@ -128,7 +128,7 @@ void SGSampleGroup::update( double dt ) { if ( !_active || _pause ) return; - testForALError("start of update!!\n"); + testForMgrError("start of update!!\n"); cleanup_removed_samples(); @@ -140,6 +140,7 @@ void SGSampleGroup::update( double dt ) { sample_map_iterator sample_current = _samples.begin(); sample_map_iterator sample_end = _samples.end(); + size_t i = 0; for ( ; sample_current != sample_end; ++sample_current ) { SGSoundSample *sample = sample_current->second; @@ -149,7 +150,7 @@ void SGSampleGroup::update( double dt ) { } else if ( sample->is_valid_source() ) { check_playing_sample(sample); } - testForALError("update"); + testForMgrError("update"); } } @@ -237,7 +238,7 @@ SGSampleGroup::suspend () _smgr->sample_suspend( sample ); #endif } - testForALError("suspend"); + testForMgrError("suspend"); } } @@ -253,7 +254,7 @@ SGSampleGroup::resume () SGSoundSample *sample = sample_current->second; _smgr->sample_resume( sample ); } - testForALError("resume"); + testForMgrError("resume"); #endif _pause = false; } @@ -390,9 +391,9 @@ bool SGSampleGroup::testForError(void *p, std::string s) return false; } -bool SGSampleGroup::testForALError(std::string s) +bool SGSampleGroup::testForMgrError(std::string s) { - _smgr->testForError(s, _refname); + _smgr->testForError(s+" (sample group)", _refname); return false; } diff --git a/simgear/sound/sample_group.hxx b/simgear/sound/sample_group.hxx index 30fcebbe..8db767ff 100644 --- a/simgear/sound/sample_group.hxx +++ b/simgear/sound/sample_group.hxx @@ -22,8 +22,8 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -#ifndef _SG_SAMPLE_GROUP_OPENAL_HXX -#define _SG_SAMPLE_GROUP_OPENAL_HXX 1 +#ifndef _SG_SAMPLE_GROUP_HXX +#define _SG_SAMPLE_GROUP_HXX 1 #include @@ -76,7 +76,7 @@ public: /** * Update function. - * Call this function periodically to update the OpenAL state of all + * Call this function periodically to update the state of all * samples associated with this class. None op the configuration changes * take place without a call to this function. */ @@ -225,7 +225,7 @@ private: sample_map _samples; std::vector< SGSharedPtr > _removed_samples; - bool testForALError(std::string s); + bool testForMgrError(std::string s); bool testForError(void *p, std::string s); void update_pos_and_orientation(); diff --git a/simgear/sound/soundmgr_aeonwave.cxx b/simgear/sound/soundmgr_aeonwave.cxx index f60eef1b..8d4826bf 100644 --- a/simgear/sound/soundmgr_aeonwave.cxx +++ b/simgear/sound/soundmgr_aeonwave.cxx @@ -46,13 +46,15 @@ #include -typedef std::map < unsigned int,aax::Emitter > source_map; +// We keep track of the emitters ourselves. +typedef std::map < unsigned int, aax::Emitter > source_map; typedef source_map::iterator source_map_iterator; -typedef source_map::const_iterator const_source_map_iterator; +typedef source_map::const_iterator const_source_map_iterator; -typedef std::map < unsigned int,aax::Buffer& > buffer_map; +// The AeonWave class keeps track of the buffers, so use a reference instead. +typedef std::map < unsigned int, aax::Buffer& > buffer_map; typedef buffer_map::iterator buffer_map_iterator; -typedef buffer_map::const_iterator const_buffer_map_iterator; +typedef buffer_map::const_iterator const_buffer_map_iterator; typedef std::map < std::string, SGSharedPtr > sample_group_map; typedef sample_group_map::iterator sample_group_map_iterator; @@ -409,7 +411,11 @@ void SGSoundMgr::set_volume( float v ) unsigned int SGSoundMgr::request_source() { unsigned int id = d->_source_id++; - d->_sources.insert( std::make_pair(id,aax::Emitter()) ); +#if 0 + d->_sources.insert( std::make_pair(id, aax::Emitter(AAX_ABSOLUTE)) ); +#else + d->_sources[id] = aax::Emitter(AAX_ABSOLUTE); +#endif return id; } diff --git a/simgear/sound/soundmgr_aeonwave.hxx b/simgear/sound/soundmgr_aeonwave.hxx index a680b446..5336da08 100644 --- a/simgear/sound/soundmgr_aeonwave.hxx +++ b/simgear/sound/soundmgr_aeonwave.hxx @@ -35,8 +35,8 @@ #include #include // for std::auto_ptr -#include -#include +#include +#include #include #include @@ -329,11 +329,11 @@ private: float _volume; // Position of the listener. - AAX::Vector64 _offset_pos; + aax::Vector64 _offset_pos; SGGeod _geod_pos; // Velocity of the listener. - AAX::Vector64 _velocity; + aax::Vector64 _velocity; bool testForError(void *p, std::string s); -- 2.39.5