audiomanager refactoring, class-ified world objects, member access cleanups

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3952 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-12-08 21:17:11 +00:00
parent 44ef9c1cf8
commit 8b63ffeb44
7 changed files with 69 additions and 43 deletions
+5 -6
View File
@@ -7,8 +7,6 @@
#define DEBUGCOND (audiodebug==1)
extern int soundchannels;
VARP(soundschedpriorityscore, 0, 100, 1000);
VARP(soundscheddistancescore, 0, 5, 1000);
VARP(soundschedoldbonus, 0, 100, 1000);
@@ -26,9 +24,10 @@ sourcescheduler &sourcescheduler::instance()
return *inst;
}
void sourcescheduler::init()
void sourcescheduler::init(int numsoundchannels)
{
int newchannels = soundchannels - sources.length();
this->numsoundchannels = numsoundchannels;
int newchannels = numsoundchannels - sources.length();
if(newchannels < 0)
{
loopv(sources)
@@ -37,7 +36,7 @@ void sourcescheduler::init()
if(src->locked) continue;
sources.remove(i--);
delete src;
if(sources.length() <= soundchannels) break;
if(sources.length() <= numsoundchannels) break;
}
}
else loopi(newchannels)
@@ -151,7 +150,7 @@ void sourcescheduler::releasesource(source *src)
if(!src) return;
src->unlock();
if(sources.length() > soundchannels)
if(sources.length() > numsoundchannels)
{
sources.removeobj(src);
delete src;