1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Deprecate plFileUtils and parts of pnUtPath

This commit is contained in:
2013-01-20 13:47:14 -08:00
parent 970ad3e729
commit 6e564476b7
114 changed files with 982 additions and 2117 deletions

View File

@ -56,7 +56,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//#include "hsTimer.h"
#include "plFile/hsFiles.h"
#include "plFile/plFileUtils.h"
#include "plUnifiedTime/plUnifiedTime.h"
#include "plBufferedFileReader.h"
#include "plCachedFileReader.h"
@ -66,20 +65,19 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define kCacheDirName "temp"
plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore::ChannelSelect whichChan, StreamType type)
plAudioFileReader* plAudioFileReader::CreateReader(const plFileName& path, plAudioCore::ChannelSelect whichChan, StreamType type)
{
const char* ext = plFileUtils::GetFileExt(path);
plString ext = path.GetFileExt();
if (type == kStreamWAV)
{
bool isWav = (stricmp(ext, "wav") == 0);
bool isWav = (ext.CompareI("wav") == 0);
// We want to stream a wav off disk, but this is a compressed file.
// Get the uncompressed path. Ignore the requested channel, since it
// will have already been split into two files if that is necessary.
if (!isWav)
{
char cachedPath[256];
IGetCachedPath(path, cachedPath, whichChan);
plFileName cachedPath = IGetCachedPath(path, whichChan);
plAudioFileReader *r = new plCachedFileReader(cachedPath, plAudioCore::kAll);
if (!r->IsValid()) {
// So we tried to play a cached file and it didn't exist
@ -102,43 +100,37 @@ plAudioFileReader* plAudioFileReader::CreateReader(const char* path, plAudioCore
return nil;
}
plAudioFileReader* plAudioFileReader::CreateWriter(const char* path, plWAVHeader& header)
plAudioFileReader* plAudioFileReader::CreateWriter(const plFileName& path, plWAVHeader& header)
{
const char* ext = plFileUtils::GetFileExt(path);
plAudioFileReader* writer = new plCachedFileReader(path, plAudioCore::kAll);
writer->OpenForWriting(path, header);
return writer;
}
void plAudioFileReader::IGetCachedPath(const char* path, char* cachedPath, plAudioCore::ChannelSelect whichChan)
plFileName plAudioFileReader::IGetCachedPath(const plFileName& path, plAudioCore::ChannelSelect whichChan)
{
// Get the file's path and add our streaming cache folder to it
strcpy(cachedPath, path);
plFileUtils::StripFile(cachedPath);
strcat(cachedPath, kCacheDirName"\\");
plFileName cachedPath = plFileName::Join(path.StripFileName(), kCacheDirName);
// Create the directory first
plFileUtils::CreateDir(cachedPath);
plFileSystem::CreateDir(cachedPath);
const char *suffix = "";
if (whichChan == plAudioCore::kLeft)
suffix = "-Left.tmp";
else if (whichChan == plAudioCore::kRight)
suffix = "-Right.tmp";
else if (whichChan == plAudioCore::kAll)
suffix = ".tmp";
// Get the path to the cached version of the file, without the extension
const char* fileName = plFileUtils::GetFileName(path);
const char* fileExt = plFileUtils::GetFileExt(fileName);
strncat(cachedPath, fileName, fileExt-fileName-1);
if (whichChan == plAudioCore::kLeft)
strcat(cachedPath, "-Left.tmp");
else if (whichChan == plAudioCore::kRight)
strcat(cachedPath, "-Right.tmp");
else if (whichChan == plAudioCore::kAll)
strcat(cachedPath, ".tmp");
return plFileName::Join(cachedPath, path.GetFileNameNoExt() + suffix);
}
void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCore::ChannelSelect whichChan)
void plAudioFileReader::ICacheFile(const plFileName& path, bool noOverwrite, plAudioCore::ChannelSelect whichChan)
{
char cachedPath[256];
IGetCachedPath(path, cachedPath, whichChan);
if (!noOverwrite || !plFileUtils::FileExists(cachedPath))
plFileName cachedPath = IGetCachedPath(path, whichChan);
if (!noOverwrite || !plFileInfo(cachedPath).Exists())
{
plAudioFileReader* reader = plAudioFileReader::CreateReader(path, whichChan, kStreamNative);
if (!reader || !reader->IsValid())
@ -169,7 +161,7 @@ void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCo
}
}
void plAudioFileReader::CacheFile(const char* path, bool splitChannels, bool noOverwrite)
void plAudioFileReader::CacheFile(const plFileName& path, bool splitChannels, bool noOverwrite)
{
if (splitChannels)
{

View File

@ -55,6 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Class Definition ////////////////////////////////////////////////////////
class plFileName;
class plUnifiedTime;
class plWAVHeader;
class plAudioFileReader
@ -80,20 +81,20 @@ public:
virtual bool Read( uint32_t numBytes, void *buffer ) = 0;
virtual uint32_t NumBytesLeft( void ) = 0;
virtual bool OpenForWriting( const char *path, plWAVHeader &header ) { return false; }
virtual bool OpenForWriting( const plFileName& path, plWAVHeader &header ) { return false; }
virtual uint32_t Write( uint32_t bytes, void *buffer ) { return 0; }
virtual bool IsValid( void ) = 0;
static plAudioFileReader* CreateReader(const char* path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll, StreamType type = kStreamWAV);
static plAudioFileReader* CreateWriter(const char* path, plWAVHeader& header);
static plAudioFileReader* CreateReader(const plFileName& path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll, StreamType type = kStreamWAV);
static plAudioFileReader* CreateWriter(const plFileName& path, plWAVHeader& header);
// Decompresses a compressed file to the cache directory
static void CacheFile(const char* path, bool splitChannels=false, bool noOverwrite=false);
static void CacheFile(const plFileName& path, bool splitChannels=false, bool noOverwrite=false);
protected:
static void IGetCachedPath(const char* path, char* cachedPath, plAudioCore::ChannelSelect whichChan);
static void ICacheFile(const char* path, bool noOverwrite, plAudioCore::ChannelSelect whichChan);
static plFileName IGetCachedPath(const plFileName& path, plAudioCore::ChannelSelect whichChan);
static void ICacheFile(const plFileName& path, bool noOverwrite, plAudioCore::ChannelSelect whichChan);
};
#endif //_plAudioFileReader_h

View File

@ -57,6 +57,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <string.h>
#include "HeadSpin.h"
#include "plBufferedFileReader.h"
#include "plFileSystem.h"
//#include "plProfile.h"
@ -64,14 +65,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Constructor/Destructor //////////////////////////////////////////////////
plBufferedFileReader::plBufferedFileReader( const char *path, plAudioCore::ChannelSelect whichChan )
plBufferedFileReader::plBufferedFileReader( const plFileName &path, plAudioCore::ChannelSelect whichChan )
{
// Init some stuff
fBufferSize = 0;
fBuffer = nil;
fCursor = 0;
hsAssert( path != nil, "Invalid path specified in plBufferedFileReader" );
hsAssert( path.IsValid(), "Invalid path specified in plBufferedFileReader" );
// Ask plAudioFileReader for another reader to get this file
// Note: have this reader do the chanSelect for us

View File

@ -59,7 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plBufferedFileReader : public plAudioFileReader
{
public:
plBufferedFileReader( const char *path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
plBufferedFileReader( const plFileName &path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
virtual ~plBufferedFileReader();
virtual plWAVHeader &GetHeader( void );
@ -72,10 +72,10 @@ public:
virtual bool IsValid( void ) { return ( fBuffer != nil ) ? true : false; }
protected:
uint32_t fBufferSize;
uint8_t *fBuffer;
uint32_t fBufferSize;
uint8_t *fBuffer;
plWAVHeader fHeader;
uint32_t fCursor;
uint32_t fCursor;
void IError( const char *msg );
};

View File

@ -55,16 +55,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Constructor/Destructor //////////////////////////////////////////////////
plCachedFileReader::plCachedFileReader(const char *path,
plCachedFileReader::plCachedFileReader(const plFileName &path,
plAudioCore::ChannelSelect whichChan)
: fFileHandle(nil), fCurPosition(0)
: fFilename(path), fFileHandle(nil), fCurPosition(0)
{
hsAssert(path != nil, "Invalid path specified in plCachedFileReader");
strncpy(fFilename, path, sizeof(fFilename));
hsAssert(path.IsValid(), "Invalid path specified in plCachedFileReader");
/// Open the file as a plain binary stream
fFileHandle = fopen(path, "rb");
fFileHandle = plFileSystem::Open(path, "rb");
if (fFileHandle != nil)
{
if (fread(&fHeader, 1, sizeof(plWAVHeader), fFileHandle)
@ -162,17 +160,17 @@ uint32_t plCachedFileReader::NumBytesLeft()
return fDataLength - fCurPosition;
}
bool plCachedFileReader::OpenForWriting(const char *path, plWAVHeader &header)
bool plCachedFileReader::OpenForWriting(const plFileName &path, plWAVHeader &header)
{
hsAssert(path != nil, "Invalid path specified in plCachedFileReader");
hsAssert(path.IsValid(), "Invalid path specified in plCachedFileReader");
fHeader = header;
fCurPosition = 0;
fDataLength = 0;
strncpy(fFilename, path, sizeof(fFilename));
fFilename = path;
/// Open the file as a plain binary stream
fFileHandle = fopen(path, "wb");
fFileHandle = plFileSystem::Open(path, "wb");
if (fFileHandle != nil)
{

View File

@ -54,13 +54,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plcachedfilereader_h
#include "plAudioFileReader.h"
#include "plFileSystem.h"
//// Class Definition ////////////////////////////////////////////////////////
class plCachedFileReader : public plAudioFileReader
{
public:
plCachedFileReader(const char *path,
plCachedFileReader(const plFileName &path,
plAudioCore::ChannelSelect whichChan = plAudioCore::kAll);
virtual ~plCachedFileReader();
@ -75,7 +76,7 @@ public:
virtual bool Read(uint32_t numBytes, void *buffer);
virtual uint32_t NumBytesLeft();
virtual bool OpenForWriting(const char *path, plWAVHeader &header);
virtual bool OpenForWriting(const plFileName &path, plWAVHeader &header);
virtual uint32_t Write(uint32_t bytes, void *buffer);
virtual bool IsValid() { return fFileHandle != nil; }
@ -86,11 +87,11 @@ protected:
kPCMFormatTag = 1
};
char fFilename[512];
plFileName fFilename;
FILE * fFileHandle;
plWAVHeader fHeader;
uint32_t fDataLength;
uint32_t fCurPosition;
uint32_t fDataLength;
uint32_t fCurPosition;
void IError(const char *msg);
};

View File

@ -112,14 +112,14 @@ class plRIFFHeader
//// Constructor/Destructor //////////////////////////////////////////////////
plFastWAV::plFastWAV( const char *path, plAudioCore::ChannelSelect whichChan ) : fFileHandle( nil )
plFastWAV::plFastWAV( const plFileName &path, plAudioCore::ChannelSelect whichChan ) : fFileHandle( nil )
{
hsAssert( path != nil, "Invalid path specified in plFastWAV reader" );
hsAssert(path.IsValid(), "Invalid path specified in plFastWAV reader");
strncpy( fFilename, path, sizeof( fFilename ) );
fFilename = path;
fWhichChannel = whichChan;
fFileHandle = fopen( path, "rb" );
fFileHandle = plFileSystem::Open(path, "rb");
if( fFileHandle != nil )
{
/// Read in our header and calc our start position
@ -226,8 +226,8 @@ void plFastWAV::Open()
{
if(fFileHandle)
return;
fFileHandle = fopen( fFilename, "rb" );
fFileHandle = plFileSystem::Open(fFilename, "rb");
if(!fFileHandle)
return;

View File

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plFastWavReader_h
#include "plAudioFileReader.h"
#include "plFileSystem.h"
//// Class Definition ////////////////////////////////////////////////////////
@ -60,7 +61,7 @@ class plRIFFChunk;
class plFastWAV : public plAudioFileReader
{
public:
plFastWAV( const char *path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
plFastWAV( const plFileName &path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
virtual ~plFastWAV();
virtual plWAVHeader &GetHeader( void );
@ -83,13 +84,13 @@ protected:
kPCMFormatTag = 1
};
char fFilename[ 512 ];
plFileName fFilename;
FILE * fFileHandle;
plWAVHeader fHeader, fFakeHeader;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
uint32_t fChunkStart;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
uint32_t fChunkStart;
plAudioCore::ChannelSelect fWhichChannel;
uint32_t fChannelAdjust, fChannelOffset;
uint32_t fChannelAdjust, fChannelOffset;
void IError( const char *msg );
bool ISeekToChunk( const char *type, plRIFFChunk *c );

View File

@ -65,7 +65,7 @@ uint8_t plOGGCodec::fDecodeFlags = 0;
//// Constructor/Destructor //////////////////////////////////////////////////
plOGGCodec::plOGGCodec( const char *path, plAudioCore::ChannelSelect whichChan ) : fFileHandle( nil )
plOGGCodec::plOGGCodec( const plFileName &path, plAudioCore::ChannelSelect whichChan ) : fFileHandle( nil )
{
fOggFile = nil;
IOpen( path, whichChan );
@ -112,17 +112,17 @@ bool plOGGCodec::ReadFromHeader(int numBytes, void *data)
return false;
}
void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichChan )
void plOGGCodec::IOpen( const plFileName &path, plAudioCore::ChannelSelect whichChan )
{
hsAssert( path != nil, "Invalid path specified in plOGGCodec reader" );
hsAssert( path.IsValid(), "Invalid path specified in plOGGCodec reader" );
// plNetClientApp::StaticDebugMsg("Ogg Open %s, t=%f, start", path, hsTimer::GetSeconds());
strncpy( fFilename, path, sizeof( fFilename ) );
fFilename = path;
fWhichChannel = whichChan;
/// Open the file as a plain binary stream
fFileHandle = fopen( path, "rb" );
fFileHandle = plFileSystem::Open(path, "rb");
if( fFileHandle != nil )
{
/// Create the OGG data struct

View File

@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plOGGCodec_h
#include "plAudioFileReader.h"
#include "plFileSystem.h"
//// Class Definition ////////////////////////////////////////////////////////
@ -59,7 +60,7 @@ class plOGGCodec : public plAudioFileReader
{
public:
plOGGCodec( const char *path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
plOGGCodec( const plFileName &path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
virtual ~plOGGCodec();
enum DecodeFormat
@ -88,7 +89,7 @@ public:
static void SetDecodeFormat( DecodeFormat f ) { fDecodeFormat = f; }
static void SetDecodeFlag( uint8_t flag, bool on ) { if( on ) fDecodeFlags |= flag; else fDecodeFlags &= ~flag; }
static uint8_t GetDecodeFlags( void ) { return fDecodeFlags; }
static uint8_t GetDecodeFlags( void ) { return fDecodeFlags; }
void ResetWaveHeaderRef() { fCurHeaderPos = 0; }
void BuildActualWaveHeader();
bool ReadFromHeader(int numBytes, void *data); // read from Actual wave header
@ -100,23 +101,23 @@ protected:
kPCMFormatTag = 1
};
char fFilename[ 512 ];
FILE *fFileHandle;
OggVorbis_File *fOggFile;
plFileName fFilename;
FILE *fFileHandle;
OggVorbis_File *fOggFile;
plWAVHeader fHeader, fFakeHeader;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
plAudioCore::ChannelSelect fWhichChannel;
uint32_t fChannelAdjust, fChannelOffset;
uint32_t fChannelAdjust, fChannelOffset;
static DecodeFormat fDecodeFormat;
static uint8_t fDecodeFlags;
uint8_t * fHeadBuf;
static uint8_t fDecodeFlags;
uint8_t * fHeadBuf;
int fCurHeaderPos;
void IError( const char *msg );
void IOpen( const char *path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
void IOpen( const plFileName &path, plAudioCore::ChannelSelect whichChan = plAudioCore::kAll );
};
#endif //_plOGGCodec_h

View File

@ -49,35 +49,31 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plgDispatch.h"
#include "hsResMgr.h"
#include "pnMessage/plRefMsg.h"
#include "plFile/plFileUtils.h"
#include "plFile/hsFiles.h"
#include "plUnifiedTime/plUnifiedTime.h"
#include "plStatusLog/plStatusLog.h"
#include "hsTimer.h"
static void GetFullPath( const char filename[], char *destStr )
static plFileName GetFullPath(const plFileName &filename)
{
char path[ kFolderIterator_MaxPath ];
if (filename.StripFileName().IsValid())
return filename;
if( strchr( filename, '\\' ) != nil )
strcpy( path, filename );
else
sprintf( path, "sfx\\%s", filename );
strcpy( destStr, path );
return plFileName::Join("sfx", filename);
}
//// IGetReader //////////////////////////////////////////////////////////////
// Makes sure the sound is ready to load without any extra processing (like
// decompression or the like), then opens a reader for it.
// fullpath tells the function whether to append 'sfx' to the path or not (we don't want to do this if were providing the full path)
static plAudioFileReader *CreateReader( bool fullpath, const char filename[], plAudioFileReader::StreamType type, plAudioCore::ChannelSelect channel )
static plAudioFileReader *CreateReader( bool fullpath, const plFileName &filename, plAudioFileReader::StreamType type, plAudioCore::ChannelSelect channel )
{
char path[512];
if(fullpath) GetFullPath(filename, path);
plFileName path;
if (fullpath)
path = GetFullPath(filename);
else
strcpy(path, filename);
path = filename;
plAudioFileReader* reader = plAudioFileReader::CreateReader(path, channel, type);
if( reader == nil || !reader->IsValid() )
@ -115,11 +111,11 @@ hsError plSoundPreloader::Run()
if (buf->GetData())
{
reader = CreateReader(true, buf->GetFileName(), buf->GetAudioReaderType(), buf->GetReaderSelect());
reader = CreateReader(true, buf->GetFileName(), buf->GetAudioReaderType(), buf->GetReaderSelect());
if( reader )
{
unsigned readLen = buf->GetAsyncLoadLength() ? buf->GetAsyncLoadLength() : buf->GetDataLength();
unsigned readLen = buf->GetAsyncLoadLength() ? buf->GetAsyncLoadLength() : buf->GetDataLength();
reader->Read( readLen, buf->GetData() );
buf->SetAudioReader(reader); // give sound buffer reader, since we may need it later
}
@ -166,7 +162,7 @@ plSoundBuffer::plSoundBuffer()
IInitBuffer();
}
plSoundBuffer::plSoundBuffer( const char *fileName, uint32_t flags )
plSoundBuffer::plSoundBuffer( const plFileName &fileName, uint32_t flags )
{
IInitBuffer();
SetFileName( fileName );
@ -186,7 +182,6 @@ plSoundBuffer::~plSoundBuffer()
}
}
delete [] fFileName;
UnLoad();
}
@ -194,7 +189,7 @@ void plSoundBuffer::IInitBuffer()
{
fError = false;
fValid = false;
fFileName = nil;
fFileName = "";
fData = nil;
fDataLength = 0;
fFlags = 0;
@ -225,7 +220,7 @@ void plSoundBuffer::Read( hsStream *s, hsResMgr *mgr )
s->ReadLE( &fFlags );
s->ReadLE( &fDataLength );
fFileName = s->ReadSafeString();
fFileName = s->ReadSafeString_TEMP();
s->ReadLE( &fHeader.fFormatTag );
s->ReadLE( &fHeader.fNumChannels );
@ -266,16 +261,10 @@ void plSoundBuffer::Write( hsStream *s, hsResMgr *mgr )
s->WriteLE( fDataLength );
// Truncate the path to just a file name on write
if( fFileName != nil )
{
char *nameOnly = strrchr( fFileName, '\\' );
if( nameOnly != nil )
s->WriteSafeString( nameOnly + 1 );
else
s->WriteSafeString( fFileName );
}
if (fFileName.IsValid())
s->WriteSafeString(fFileName.GetFileName());
else
s->WriteSafeString( "" );
s->WriteSafeString("");
s->WriteLE( fHeader.fFormatTag );
s->WriteLE( fHeader.fNumChannels );
@ -290,7 +279,7 @@ void plSoundBuffer::Write( hsStream *s, hsResMgr *mgr )
//// SetFileName /////////////////////////////////////////////////////////////
void plSoundBuffer::SetFileName( const char *name )
void plSoundBuffer::SetFileName( const plFileName &name )
{
if(fLoading)
{
@ -298,11 +287,7 @@ void plSoundBuffer::SetFileName( const char *name )
return;
}
delete [] fFileName;
if( name != nil )
fFileName = hsStrcpy( name );
else
fFileName = nil;
fFileName = name;
// Data is no longer valid
UnLoad();
@ -325,22 +310,17 @@ plAudioCore::ChannelSelect plSoundBuffer::GetReaderSelect( void ) const
//// IGetFullPath ////////////////////////////////////////////////////////////
// Construct our current full path to our sound.
void plSoundBuffer::IGetFullPath( char *destStr )
plFileName plSoundBuffer::IGetFullPath()
{
if(!fFileName)
if (!fFileName.IsValid())
{
*destStr = 0;
return;
return plFileName();
}
char path[ kFolderIterator_MaxPath ];
if (fFileName.StripFileName().IsValid())
return fFileName;
if( strchr( fFileName, '\\' ) != nil )
strcpy( path, fFileName );
else
sprintf( path, "sfx\\%s", fFileName );
strcpy( destStr, path );
return plFileName::Join("sfx", fFileName);
}
@ -459,8 +439,9 @@ void plSoundBuffer::SetLoaded(bool loaded)
void plSoundBuffer::SetInternalData( plWAVHeader &header, uint32_t length, uint8_t *data )
{
if(fLoading) return;
fFileName = nil;
if (fLoading)
return;
fFileName = "";
fHeader = header;
fFlags = 0;
@ -509,11 +490,9 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::EnsureInternal()
//// IGrabHeaderInfo /////////////////////////////////////////////////////////
bool plSoundBuffer::IGrabHeaderInfo( void )
{
static char path[ 512 ];
if( fFileName != nil )
if (fFileName.IsValid())
{
IGetFullPath( path );
plFileName path = IGetFullPath();
// Go grab from the WAV file
if(!fReader)
@ -545,10 +524,11 @@ bool plSoundBuffer::IGrabHeaderInfo( void )
// fullpath tells the function whether to append 'sfx' to the path or not (we don't want to do this if were providing the full path)
plAudioFileReader *plSoundBuffer::IGetReader( bool fullpath )
{
char path[512];
if(fullpath) IGetFullPath(path);
plFileName path;
if (fullpath)
path = IGetFullPath();
else
strcpy(path, fFileName);
path = fFileName;
// Go grab from the WAV file
plAudioFileReader::StreamType type = plAudioFileReader::kStreamWAV;

View File

@ -56,16 +56,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plAudioCore.h"
#include "plAudioFileReader.h"
#include "hsThread.h"
#include "plFileSystem.h"
//// Class Definition ////////////////////////////////////////////////////////
class plUnifiedTime;
class plAudioFileReader;
class plSoundBuffer : public hsKeyedObject
{
{
public:
plSoundBuffer();
plSoundBuffer( const char *fileName, uint32_t flags = 0 );
plSoundBuffer( const plFileName &fileName, uint32_t flags = 0 );
~plSoundBuffer();
CLASSNAME_REGISTER( plSoundBuffer );
@ -93,14 +94,14 @@ public:
virtual void Write( hsStream *s, hsResMgr *mgr );
plWAVHeader &GetHeader( void ) { return fHeader; }
uint32_t GetDataLength( void ) const { return fDataLength; }
uint32_t GetDataLength( void ) const { return fDataLength; }
void SetDataLength(unsigned length) { fDataLength = length; }
void *GetData( void ) const { return fData; }
const char *GetFileName( void ) const { return fFileName; }
void *GetData( void ) const { return fData; }
plFileName GetFileName( void ) const { return fFileName; }
bool IsValid( void ) const { return fValid; }
float GetDataLengthInSecs( void ) const;
float GetDataLengthInSecs( void ) const;
void SetFileName( const char *name );
void SetFileName( const plFileName &name );
bool HasFlag( uint32_t flag ) { return ( fFlags & flag ) ? true : false; }
void SetFlag( uint32_t flag, bool yes = true ) { if( yes ) fFlags |= flag; else fFlags &= ~flag; }
@ -135,22 +136,22 @@ protected:
bool IGrabHeaderInfo( void );
void IAddBuffers( void *base, void *toAdd, uint32_t lengthInBytes, uint8_t bitsPerSample );
void IGetFullPath( char *destStr );
uint32_t fFlags;
plFileName IGetFullPath();
uint32_t fFlags;
bool fValid;
uint32_t fDataRead;
char *fFileName;
uint32_t fDataRead;
plFileName fFileName;
bool fLoaded;
bool fLoading;
bool fError;
plAudioFileReader * fReader;
uint8_t * fData;
plAudioFileReader * fReader;
uint8_t * fData;
plWAVHeader fHeader;
uint32_t fDataLength;
uint32_t fAsyncLoadLength;
uint32_t fDataLength;
uint32_t fAsyncLoadLength;
plAudioFileReader::StreamType fStreamType;
// for plugins only