Update to the latestaienwave.hpp header file

This commit is contained in:
Erik Hofman 2016-07-26 15:22:09 +02:00
parent 48c5e5e43b
commit f6e92ac9e5
4 changed files with 28 additions and 21 deletions

View File

@ -69,9 +69,10 @@ SGSampleGroup::~SGSampleGroup ()
_smgr = 0;
}
#include <stdio.h>
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; i<size; ) {
SGSoundSample *sample = _removed_samples[i];
@ -104,7 +105,6 @@ void SGSampleGroup::start_playing_sample(SGSoundSample *sample)
void SGSampleGroup::check_playing_sample(SGSoundSample *sample)
{
// check if the sound has stopped by itself
if (_smgr->is_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;
}

View File

@ -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 <string>
@ -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<SGSoundSample> > _removed_samples;
bool testForALError(std::string s);
bool testForMgrError(std::string s);
bool testForError(void *p, std::string s);
void update_pos_and_orientation();

View File

@ -46,13 +46,15 @@
#include <simgear/misc/sg_path.hxx>
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<SGSampleGroup> > 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;
}

View File

@ -35,8 +35,8 @@
#include <map>
#include <memory> // for std::auto_ptr
#include <aax/Matrix>
#include <aax/AeonWave>
#include <aax/matrix.hpp>
#include <aax/aeonwave.hpp>
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
@ -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);