2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

Cache the file when it is played for the first time.

This commit is contained in:
Darryl Pogue
2011-04-26 23:52:00 -07:00
parent 08e401eabc
commit c8284bd808

View File

@ -75,6 +75,12 @@ plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore
char cachedPath[256]; char cachedPath[256];
IGetCachedPath(path, cachedPath, whichChan); IGetCachedPath(path, cachedPath, whichChan);
plAudioFileReader *r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll); plAudioFileReader *r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll);
if (!r->IsValid()) {
// So we tried to play a cached file and it didn't exist
// Oops... we should cache it now
ICacheFile(path, true, whichChan);
r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll);
}
return r; return r;
} }