Initialization was done much earlier than expected resulting in some sample

groups not being activated (and sample loading using OpenAL/ALUT functions to
be scheduled before OpenAL was initilialized).

fix alutInit counter
remove left over static declaration fro SGSoundMgr::load
This commit is contained in:
ehofman
2009-10-16 11:14:05 +02:00
committed by Tim Moore
parent 6fe057e277
commit a67688322d
4 changed files with 12 additions and 6 deletions
-1
View File
@@ -63,7 +63,6 @@ SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr, const string &refname ) :
_orientation(SGQuatd::zeros()) _orientation(SGQuatd::zeros())
{ {
_smgr->add(this, refname); _smgr->add(this, refname);
_active = _smgr->is_working();
_samples.clear(); _samples.clear();
} }
+1
View File
@@ -155,6 +155,7 @@ public:
inline void tie_to_listener() { _tied_to_listener = true; } inline void tie_to_listener() { _tied_to_listener = true; }
inline void activate() { _active = true; }
protected: protected:
SGSoundMgr *_smgr; SGSoundMgr *_smgr;
+10 -4
View File
@@ -70,7 +70,6 @@ SGSoundMgr::SGSoundMgr() :
testForALUTError("alut initialization"); testForALUTError("alut initialization");
return; return;
} }
_alut_init++;
} }
_alut_init++; _alut_init++;
#endif #endif
@@ -152,6 +151,13 @@ void SGSoundMgr::init() {
if (_free_sources.size() == 0) { if (_free_sources.size() == 0) {
SG_LOG(SG_GENERAL, SG_ALERT, "Unable to grab any OpenAL sources!"); SG_LOG(SG_GENERAL, SG_ALERT, "Unable to grab any OpenAL sources!");
} }
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 ) {
SGSampleGroup *sgrp = sample_grp_current->second;
sgrp->activate();
}
} }
// suspend the sound manager // suspend the sound manager
@@ -471,9 +477,9 @@ void SGSoundMgr::release_buffer(SGSoundSample *sample)
bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt, bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt,
unsigned int *sz, int *frq ) unsigned int *sz, int *frq )
{ {
ALenum format = (ALenum)*fmt; ALenum format;
ALsizei size = (ALsizei)*sz; ALsizei size;
ALsizei freq = (ALsizei)*frq; ALsizei freq;
ALvoid *data; ALvoid *data;
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1 #if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
+1 -1
View File
@@ -199,7 +199,7 @@ public:
*/ */
inline bool has_changed() { return _changed; } inline bool has_changed() { return _changed; }
static bool load(string &samplepath, void **data, int *format, bool load(string &samplepath, void **data, int *format,
unsigned int*size, int *freq ); unsigned int*size, int *freq );