SGSoundMgr::SGSoundMgr() :
_working(false),
_changed(true),
- _volume(0.5),
+ _volume(0.0),
_device(NULL),
_context(NULL),
_listener_pos(SGVec3d::zeros().data()),
_sources_in_use.clear();
}
+void SGSoundMgr::update( double dt )
+{
+ // nothing to do in the regular update,e verything is done on the following
+ // function
+}
+
// run the audio scheduler
-void SGSoundMgr::update( double dt ) {
+void SGSoundMgr::update_late( double dt ) {
if (_working) {
+ // alcSuspendContext(_context);
+
sample_group_map_iterator sample_grp_current = _sample_groups.begin();
sample_group_map_iterator sample_grp_end = _sample_groups.end();
for ( ; sample_grp_current != sample_grp_end; ++sample_grp_current ) {
testForALError("update");
_changed = false;
}
+ // alcProcessContext(_context);
}
}
if ( result == AL_PLAYING ) {
alSourceStop( source );
}
- testForALError("free_source");
+ testForALError("release source");
_free_sources.push_back(source);
_sources_in_use.erase(_sources_in_use.begin()+i,
*/
void SGSoundMgr::set_orientation( SGQuatd ori )
{
- SGVec3d sgv_up = ori.rotate(SGVec3d::e2());
- SGVec3d sgv_at = ori.rotate(SGVec3d::e3());
+ SGVec3d sgv_up = ori.rotate(SGVec3d::e3());
+ SGVec3d sgv_at = ori.rotate(SGVec3d::e2());
for (int i=0; i<3; i++) {
_listener_ori[i] = sgv_at[i];
_listener_ori[i+3] = sgv_up[i];
bool SGSoundMgr::testForALUTError(string s)
{
+#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
ALenum error;
error = alutGetError ();
if (error != ALUT_ERROR_NO_ERROR) {
<< s);
return true;
}
+#endif
return false;
}