_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];
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();
if ( !_active || _pause ) return;
- testForALError("start of update!!\n");
+ testForMgrError("start of update!!\n");
cleanup_removed_samples();
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;
} else if ( sample->is_valid_source() ) {
check_playing_sample(sample);
}
- testForALError("update");
+ testForMgrError("update");
}
}
_smgr->sample_suspend( sample );
#endif
}
- testForALError("suspend");
+ testForMgrError("suspend");
}
}
SGSoundSample *sample = sample_current->second;
_smgr->sample_resume( sample );
}
- testForALError("resume");
+ testForMgrError("resume");
#endif
_pause = false;
}
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;
}
// 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>
/**
* 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.
*/
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();
#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;
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;
}
#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>
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);