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-15 17:08:45 +00:00
committed by Tim Moore
parent 6fe057e277
commit a67688322d
4 changed files with 12 additions and 6 deletions

View File

@@ -63,7 +63,6 @@ SGSampleGroup::SGSampleGroup ( SGSoundMgr *smgr, const string &refname ) :
_orientation(SGQuatd::zeros())
{
_smgr->add(this, refname);
_active = _smgr->is_working();
_samples.clear();
}

View File

@@ -155,6 +155,7 @@ public:
inline void tie_to_listener() { _tied_to_listener = true; }
inline void activate() { _active = true; }
protected:
SGSoundMgr *_smgr;

View File

@@ -70,7 +70,6 @@ SGSoundMgr::SGSoundMgr() :
testForALUTError("alut initialization");
return;
}
_alut_init++;
}
_alut_init++;
#endif
@@ -152,6 +151,13 @@ void SGSoundMgr::init() {
if (_free_sources.size() == 0) {
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
@@ -471,9 +477,9 @@ void SGSoundMgr::release_buffer(SGSoundSample *sample)
bool SGSoundMgr::load(string &samplepath, void **dbuf, int *fmt,
unsigned int *sz, int *frq )
{
ALenum format = (ALenum)*fmt;
ALsizei size = (ALsizei)*sz;
ALsizei freq = (ALsizei)*frq;
ALenum format;
ALsizei size;
ALsizei freq;
ALvoid *data;
#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1

View File

@@ -199,7 +199,7 @@ public:
*/
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 );