diff --git a/source/src/audiomanager.cpp b/source/src/audiomanager.cpp index f6885d2a..20fafee9 100644 --- a/source/src/audiomanager.cpp +++ b/source/src/audiomanager.cpp @@ -76,7 +76,7 @@ void audiomanager::initsound() conoutf("Driver: %s", alGetString(AL_VERSION)); // allocate OpenAL resources - sourcescheduler::default().init(); + sourcescheduler::instance().init(); // let the stream get the first source from the scheduler gamemusic = new oggstream(); @@ -230,7 +230,7 @@ void audiomanager::soundcleanup() bufferpool.clear(); // kill scheduler - sourcescheduler::default().reset(); + sourcescheduler::instance().reset(); // shutdown openal alcMakeContextCurrent(NULL); @@ -736,7 +736,7 @@ COMMANDF(mapsoundreset, ARG_NONE, () audiomgr.mapsoundreset(); }); -VARF(soundchannels, 4, 32, 1024, { if(!audiomgr.nosound) sourcescheduler::default().init(); }); +VARF(soundchannels, 4, 32, 1024, { if(!audiomgr.nosound) sourcescheduler::instance().init(); }); VARFP(soundvol, 0, 128, 255, { diff --git a/source/src/oggstream.cpp b/source/src/oggstream.cpp index 1d7a8995..b04da253 100644 --- a/source/src/oggstream.cpp +++ b/source/src/oggstream.cpp @@ -27,7 +27,7 @@ oggstream::oggstream() : valid(false), isopen(false), src(NULL) reset(); // grab a source and keep it during the whole lifetime - src = sourcescheduler::default().newsource(SP_HIGHEST, camera1->o); + src = sourcescheduler::instance().newsource(SP_HIGHEST, camera1->o); if(src) { if(src->valid) @@ -37,7 +37,7 @@ oggstream::oggstream() : valid(false), isopen(false), src(NULL) } else { - sourcescheduler::default().releasesource(src); + sourcescheduler::instance().releasesource(src); src = NULL; } } @@ -53,7 +53,7 @@ oggstream::~oggstream() { reset(); - if(src) sourcescheduler::default().releasesource(src); + if(src) sourcescheduler::instance().releasesource(src); if(alIsBuffer(bufferids[0]) || alIsBuffer(bufferids[1])) { diff --git a/source/src/sound.h b/source/src/sound.h index 06d65080..018be69d 100644 --- a/source/src/sound.h +++ b/source/src/sound.h @@ -159,12 +159,12 @@ public: class sourcescheduler { - static sourcescheduler *instance; + static sourcescheduler *inst; vector sources; public: sourcescheduler(); - static sourcescheduler &default(); // singleton access + static sourcescheduler &instance(); // singleton access void init(); void reset(); diff --git a/source/src/soundlocation.cpp b/source/src/soundlocation.cpp index 920c3198..c7abd864 100644 --- a/source/src/soundlocation.cpp +++ b/source/src/soundlocation.cpp @@ -35,7 +35,7 @@ location::location(int sound, const worldobjreference &r, int priority) : cfg(NU } // obtain source - src = sourcescheduler::default().newsource(priority, r.currentposition()); + src = sourcescheduler::instance().newsource(priority, r.currentposition()); // apply configuration if(!src || !src->valid || !src->buffer(cfg->buf->id) || !src->looping(cfg->loop) || !src->gain(cfg->vol/100.0f*((float)gainscale)/100.0f)) { @@ -50,7 +50,7 @@ location::location(int sound, const worldobjreference &r, int priority) : cfg(NU location::~location() { - if(src) sourcescheduler::default().releasesource(src); + if(src) sourcescheduler::instance().releasesource(src); if(cfg) cfg->ondetach(); if(ref) { diff --git a/source/src/soundscheduler.cpp b/source/src/soundscheduler.cpp index 292b07d7..1d911bbc 100644 --- a/source/src/soundscheduler.cpp +++ b/source/src/soundscheduler.cpp @@ -14,16 +14,16 @@ VARP(soundscheddistancescore, 0, 5, 1000); VARP(soundschedoldbonus, 0, 100, 1000); VARP(soundschedreserve, 0, 2, 100); -sourcescheduler *sourcescheduler::instance; +sourcescheduler *sourcescheduler::inst; sourcescheduler::sourcescheduler() { } -sourcescheduler &sourcescheduler::default() +sourcescheduler &sourcescheduler::instance() { - if(instance==NULL) instance = new sourcescheduler(); - return *instance; + if(inst==NULL) inst = new sourcescheduler(); + return *inst; } void sourcescheduler::init()