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

Don't use CWaveFile for caching sounds.

As a sideeffect, cached sounds are no longer wave files.
This commit is contained in:
Darryl Pogue
2011-04-25 20:10:42 -07:00
parent 547ce8c090
commit 7cecdae5c0

View File

@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plFile/plFileUtils.h" #include "plFile/plFileUtils.h"
#include "plUnifiedTime/plUnifiedTime.h" #include "plUnifiedTime/plUnifiedTime.h"
#include "plBufferedFileReader.h" #include "plBufferedFileReader.h"
#include "plCachedFileReader.h"
#include "plFastWavReader.h" #include "plFastWavReader.h"
#include "plOGGCodec.h" #include "plOGGCodec.h"
#include "plWavFile.h" #include "plWavFile.h"
@ -73,7 +74,7 @@ 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 plFastWAV(cachedPath, plAudioCore::kAll); plAudioFileReader *r = TRACKED_NEW plCachedFileReader(cachedPath, plAudioCore::kAll);
return r; return r;
} }
@ -92,7 +93,7 @@ plAudioFileReader* plAudioFileReader::CreateWriter(const char* path, plWAVHeader
{ {
const char* ext = plFileUtils::GetFileExt(path); const char* ext = plFileUtils::GetFileExt(path);
plAudioFileReader* writer = TRACKED_NEW CWaveFile(path, plAudioCore::kAll); plAudioFileReader* writer = TRACKED_NEW plCachedFileReader(path, plAudioCore::kAll);
writer->OpenForWriting(path, header); writer->OpenForWriting(path, header);
return writer; return writer;
} }
@ -113,11 +114,11 @@ void plAudioFileReader::IGetCachedPath(const char* path, char* cachedPath, plAud
strncat(cachedPath, fileName, fileExt-fileName-1); strncat(cachedPath, fileName, fileExt-fileName-1);
if (whichChan == plAudioCore::kLeft) if (whichChan == plAudioCore::kLeft)
strcat(cachedPath, "-Left.wav"); strcat(cachedPath, "-Left.tmp");
else if (whichChan == plAudioCore::kRight) else if (whichChan == plAudioCore::kRight)
strcat(cachedPath, "-Right.wav"); strcat(cachedPath, "-Right.tmp");
else if (whichChan == plAudioCore::kAll) else if (whichChan == plAudioCore::kAll)
strcat(cachedPath, ".wav"); strcat(cachedPath, ".tmp");
} }
void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCore::ChannelSelect whichChan) void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCore::ChannelSelect whichChan)