- Fixed a bug in SampleCache
- simplified card files initial parsing
This commit is contained in:
wagic.the.homebrew
2008-11-29 15:31:56 +00:00
parent 58a50705de
commit 7bf9cc8c07
8 changed files with 40 additions and 108 deletions

View File

@@ -126,6 +126,7 @@ SampleCache * SampleCache::GetInstance(){
}
JSample * SampleCache::getSample(string filename){
lastTime++;
map<string,SampleCached *>::iterator it = cache.find(filename);
if (it == cache.end()){
if (cache.size() >10) cleanOldest(); //Poor man's limit
@@ -134,10 +135,11 @@ JSample * SampleCache::getSample(string filename){
cleanCache();
sample = JSoundSystem::GetInstance()->LoadSample(filename.c_str());
}
lastTime++;
cache[filename] = NEW SampleCached(lastTime, sample);
return sample;
}else{
it->second->lastTime = lastTime;
return (it->second->sample);
}
}