2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-15 10:54:18 +00:00

Convert custom HeadSpin integer types to standard types from stdint.h

This commit is contained in:
2012-01-19 21:19:26 -05:00
parent a0d54e2644
commit 5027b5a4ac
1301 changed files with 14497 additions and 14532 deletions

View File

@ -54,12 +54,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plWAVHeader
{
public:
UInt16 fFormatTag;
UInt16 fNumChannels;
UInt32 fNumSamplesPerSec;
UInt32 fAvgBytesPerSec;
UInt16 fBlockAlign;
UInt16 fBitsPerSample;
uint16_t fFormatTag;
uint16_t fNumChannels;
uint32_t fNumSamplesPerSec;
uint32_t fAvgBytesPerSec;
uint16_t fBlockAlign;
uint16_t fBitsPerSample;
enum
{

View File

@ -164,11 +164,11 @@ void plAudioFileReader::ICacheFile(const char* path, bool noOverwrite, plAudioCo
return;
}
UInt8 buffer[4096];
UInt32 numLeft;
uint8_t buffer[4096];
uint32_t numLeft;
while ((numLeft = reader->NumBytesLeft()) > 0)
{
UInt32 toRead = (numLeft < sizeof(buffer)) ? numLeft : sizeof(buffer);
uint32_t toRead = (numLeft < sizeof(buffer)) ? numLeft : sizeof(buffer);
reader->Read(toRead, buffer);
writer->Write(toRead, buffer);
}

View File

@ -73,15 +73,15 @@ public:
virtual void Open(){}
virtual void Close( void ) = 0;
virtual UInt32 GetDataSize( void ) = 0;
virtual uint32_t GetDataSize( void ) = 0;
virtual float GetLengthInSecs( void ) = 0;
virtual hsBool SetPosition( UInt32 numBytes ) = 0;
virtual hsBool Read( UInt32 numBytes, void *buffer ) = 0;
virtual UInt32 NumBytesLeft( void ) = 0;
virtual hsBool SetPosition( uint32_t numBytes ) = 0;
virtual hsBool Read( uint32_t numBytes, void *buffer ) = 0;
virtual uint32_t NumBytesLeft( void ) = 0;
virtual hsBool OpenForWriting( const char *path, plWAVHeader &header ) { return false; }
virtual UInt32 Write( UInt32 bytes, void *buffer ) { return 0; }
virtual uint32_t Write( uint32_t bytes, void *buffer ) { return 0; }
virtual hsBool IsValid( void ) = 0;

View File

@ -86,7 +86,7 @@ plBufferedFileReader::plBufferedFileReader( const char *path, plAudioCore::Chann
fHeader = reader->GetHeader();
fBufferSize = reader->GetDataSize();
fBuffer = TRACKED_NEW UInt8[ fBufferSize ];
fBuffer = TRACKED_NEW uint8_t[ fBufferSize ];
//plProfile_NewMem( SndBufferedMem, fBufferSize );
if( fBuffer == nil )
{
@ -141,7 +141,7 @@ float plBufferedFileReader::GetLengthInSecs( void )
return (float)fBufferSize / (float)fHeader.fAvgBytesPerSec;
}
hsBool plBufferedFileReader::SetPosition( UInt32 numBytes )
hsBool plBufferedFileReader::SetPosition( uint32_t numBytes )
{
hsAssert( IsValid(), "SetPosition() called on an invalid RAM buffer" );
@ -155,7 +155,7 @@ hsBool plBufferedFileReader::SetPosition( UInt32 numBytes )
return true;
}
hsBool plBufferedFileReader::Read( UInt32 numBytes, void *buffer )
hsBool plBufferedFileReader::Read( uint32_t numBytes, void *buffer )
{
hsAssert( IsValid(), "Read() called on an invalid RAM buffer" );
@ -174,7 +174,7 @@ hsBool plBufferedFileReader::Read( UInt32 numBytes, void *buffer )
return valid;
}
UInt32 plBufferedFileReader::NumBytesLeft( void )
uint32_t plBufferedFileReader::NumBytesLeft( void )
{
hsAssert( IsValid(), "NumBytesLeft() called on an invalid RAM buffer" );

View File

@ -64,18 +64,18 @@ public:
virtual plWAVHeader &GetHeader( void );
virtual void Close( void );
virtual UInt32 GetDataSize( void ) { return fBufferSize; }
virtual uint32_t GetDataSize( void ) { return fBufferSize; }
virtual float GetLengthInSecs( void );
virtual hsBool SetPosition( UInt32 numBytes );
virtual hsBool Read( UInt32 numBytes, void *buffer );
virtual UInt32 NumBytesLeft( void );
virtual hsBool SetPosition( uint32_t numBytes );
virtual hsBool Read( uint32_t numBytes, void *buffer );
virtual uint32_t NumBytesLeft( void );
virtual hsBool IsValid( void ) { return ( fBuffer != nil ) ? true : false; }
protected:
UInt32 fBufferSize;
UInt8 *fBuffer;
uint32_t fBufferSize;
uint8_t *fBuffer;
plWAVHeader fHeader;
UInt32 fCursor;
uint32_t fCursor;
void IError( const char *msg );
};

View File

@ -117,7 +117,7 @@ void plCachedFileReader::Close()
}
}
UInt32 plCachedFileReader::GetDataSize()
uint32_t plCachedFileReader::GetDataSize()
{
hsAssert(IsValid(), "GetDataSize() called on an invalid cache file");
@ -131,7 +131,7 @@ float plCachedFileReader::GetLengthInSecs()
return (float)fDataLength / (float)fHeader.fAvgBytesPerSec;
}
hsBool plCachedFileReader::SetPosition(UInt32 numBytes)
hsBool plCachedFileReader::SetPosition(uint32_t numBytes)
{
hsAssert(IsValid(), "SetPosition() called on an invalid cache file");
@ -142,7 +142,7 @@ hsBool plCachedFileReader::SetPosition(UInt32 numBytes)
return !fseek(fFileHandle, sizeof(plWAVHeader) + fCurPosition, SEEK_SET);
}
hsBool plCachedFileReader::Read(UInt32 numBytes, void *buffer)
hsBool plCachedFileReader::Read(uint32_t numBytes, void *buffer)
{
hsAssert(IsValid(), "Read() called on an invalid cache file");
@ -154,7 +154,7 @@ hsBool plCachedFileReader::Read(UInt32 numBytes, void *buffer)
return numRead >= numBytes;
}
UInt32 plCachedFileReader::NumBytesLeft()
uint32_t plCachedFileReader::NumBytesLeft()
{
hsAssert(IsValid(), "NumBytesLeft() called on an invalid cache file");
hsAssert(fCurPosition <= fDataLength, "Invalid position while reading");
@ -187,7 +187,7 @@ hsBool plCachedFileReader::OpenForWriting(const char *path, plWAVHeader &header)
return fFileHandle != nil;
}
UInt32 plCachedFileReader::Write(UInt32 bytes, void* buffer)
uint32_t plCachedFileReader::Write(uint32_t bytes, void* buffer)
{
hsAssert(IsValid(), "Write() called on an invalid cache file");
@ -196,5 +196,5 @@ UInt32 plCachedFileReader::Write(UInt32 bytes, void* buffer)
fCurPosition += written;
fDataLength += written;
return (UInt32)written;
return (uint32_t)written;
}

View File

@ -68,15 +68,15 @@ public:
virtual void Close();
virtual UInt32 GetDataSize();
virtual uint32_t GetDataSize();
virtual float GetLengthInSecs();
virtual hsBool SetPosition(UInt32 numBytes);
virtual hsBool Read(UInt32 numBytes, void *buffer);
virtual UInt32 NumBytesLeft();
virtual hsBool SetPosition(uint32_t numBytes);
virtual hsBool Read(uint32_t numBytes, void *buffer);
virtual uint32_t NumBytesLeft();
virtual hsBool OpenForWriting(const char *path, plWAVHeader &header);
virtual UInt32 Write(UInt32 bytes, void *buffer);
virtual uint32_t Write(uint32_t bytes, void *buffer);
virtual hsBool IsValid() { return fFileHandle != nil; }
@ -89,8 +89,8 @@ protected:
char fFilename[512];
FILE * fFileHandle;
plWAVHeader fHeader;
UInt32 fDataLength;
UInt32 fCurPosition;
uint32_t fDataLength;
uint32_t fCurPosition;
void IError(const char *msg);
};

View File

@ -64,12 +64,12 @@ class plRIFFChunk
{
public:
char fID[ 4 ];
UInt32 fSize;
uint32_t fSize;
void Read( FILE *fp )
{
fread( fID, 1, 4, fp );
fread( &fSize, sizeof( UInt32 ), 1, fp );
fread( &fSize, sizeof( uint32_t ), 1, fp );
}
bool IsA( const char *type )
@ -185,8 +185,8 @@ plFastWAV::plFastWAV( const char *path, plAudioCore::ChannelSelect whichChan ) :
fFakeHeader = fHeader;
fFakeHeader.fAvgBytesPerSec /= fChannelAdjust;
fFakeHeader.fNumChannels /= (UInt16)fChannelAdjust;
fFakeHeader.fBlockAlign /= (UInt16)fChannelAdjust;
fFakeHeader.fNumChannels /= (uint16_t)fChannelAdjust;
fFakeHeader.fBlockAlign /= (uint16_t)fChannelAdjust;
SetPosition( 0 );
// fCurrDataPos = 0;
@ -265,7 +265,7 @@ float plFastWAV::GetLengthInSecs( void )
return (float)( fDataSize / fChannelAdjust ) / (float)fHeader.fAvgBytesPerSec;
}
hsBool plFastWAV::SetPosition( UInt32 numBytes )
hsBool plFastWAV::SetPosition( uint32_t numBytes )
{
hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" );
@ -277,7 +277,7 @@ hsBool plFastWAV::SetPosition( UInt32 numBytes )
return ( fseek( fFileHandle, fDataStartPos + fCurrDataPos, SEEK_SET ) == 0 ) ? true : false;
}
hsBool plFastWAV::Read( UInt32 numBytes, void *buffer )
hsBool plFastWAV::Read( uint32_t numBytes, void *buffer )
{
hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" );
@ -285,9 +285,9 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer )
if( fWhichChannel != plAudioCore::kAll )
{
size_t numRead, sampleSize = fHeader.fBlockAlign / fChannelAdjust;
static UInt8 trashBuffer[ 32 ];
static uint8_t trashBuffer[ 32 ];
UInt32 numBytesFull = numBytes;
uint32_t numBytesFull = numBytes;
if( fCurrDataPos + ( numBytes * fChannelAdjust ) > fDataSize )
numBytesFull -= sampleSize;
@ -302,7 +302,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer )
if( thisRead != sampleSize )
return false;
buffer = (void *)( (UInt8 *)buffer + sampleSize );
buffer = (void *)( (uint8_t *)buffer + sampleSize );
fCurrDataPos += sampleSize * fChannelAdjust;
}
@ -321,7 +321,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer )
if( thisRead != sampleSize )
return false;
buffer = (void *)( (UInt8 *)buffer + sampleSize );
buffer = (void *)( (uint8_t *)buffer + sampleSize );
fCurrDataPos += sampleSize;
}
@ -341,7 +341,7 @@ hsBool plFastWAV::Read( UInt32 numBytes, void *buffer )
return true;
}
UInt32 plFastWAV::NumBytesLeft( void )
uint32_t plFastWAV::NumBytesLeft( void )
{
hsAssert( IsValid(), "GetHeader() called on an invalid WAV file" );
hsAssert( fCurrDataPos <= fDataSize, "Invalid current position while reading WAV file" );

View File

@ -68,12 +68,12 @@ public:
virtual void Open();
virtual void Close( void );
virtual UInt32 GetDataSize( void ) { return fDataSize / fChannelAdjust; }
virtual uint32_t GetDataSize( void ) { return fDataSize / fChannelAdjust; }
virtual float GetLengthInSecs( void );
virtual hsBool SetPosition( UInt32 numBytes );
virtual hsBool Read( UInt32 numBytes, void *buffer );
virtual UInt32 NumBytesLeft( void );
virtual hsBool SetPosition( uint32_t numBytes );
virtual hsBool Read( uint32_t numBytes, void *buffer );
virtual uint32_t NumBytesLeft( void );
virtual hsBool IsValid( void ) { return ( fFileHandle != nil ) ? true : false; }
@ -86,10 +86,10 @@ protected:
char fFilename[ 512 ];
FILE * fFileHandle;
plWAVHeader fHeader, fFakeHeader;
UInt32 fDataStartPos, fCurrDataPos, fDataSize;
UInt32 fChunkStart;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
uint32_t fChunkStart;
plAudioCore::ChannelSelect fWhichChannel;
UInt32 fChannelAdjust, fChannelOffset;
uint32_t fChannelAdjust, fChannelOffset;
void IError( const char *msg );
bool ISeekToChunk( const char *type, plRIFFChunk *c );

View File

@ -61,7 +61,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnNetCommon/plNetApp.h"
plOGGCodec::DecodeFormat plOGGCodec::fDecodeFormat = plOGGCodec::k16bitSigned;
UInt8 plOGGCodec::fDecodeFlags = 0;
uint8_t plOGGCodec::fDecodeFlags = 0;
//// Constructor/Destructor //////////////////////////////////////////////////
@ -82,7 +82,7 @@ void plOGGCodec::BuildActualWaveHeader()
int factdata = 0;
int size = fDataSize+48; // size of data with header except for first four bytes
fHeadBuf = (UInt8 *) ALLOC(56);
fHeadBuf = (uint8_t *) ALLOC(56);
memcpy(fHeadBuf, "RIFF", 4);
memcpy(fHeadBuf+4, &size, 4);
memcpy(fHeadBuf+8, "WAVE", 4);
@ -155,7 +155,7 @@ void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichCha
/// because we end up waiting for 1 more sample than we actually have. So, on the
/// assumption that OGG is just slightly wrong sometimes, we just subtract 1 sample
/// from what it tells us. As Brice put it, who's going to miss 1/40,000'ths of a second?
fDataSize = (UInt32)(( ov_pcm_total( fOggFile, -1 ) - 1 ) * fHeader.fBlockAlign);
fDataSize = (uint32_t)(( ov_pcm_total( fOggFile, -1 ) - 1 ) * fHeader.fBlockAlign);
/// Channel select
if( fWhichChannel != plAudioCore::kAll )
@ -173,8 +173,8 @@ void plOGGCodec::IOpen( const char *path, plAudioCore::ChannelSelect whichCha
/// Construct our fake header for channel adjustment
fFakeHeader = fHeader;
fFakeHeader.fAvgBytesPerSec /= fChannelAdjust;
fFakeHeader.fNumChannels /= (UInt16)fChannelAdjust;
fFakeHeader.fBlockAlign /= (UInt16)fChannelAdjust;
fFakeHeader.fNumChannels /= (uint16_t)fChannelAdjust;
fFakeHeader.fBlockAlign /= (uint16_t)fChannelAdjust;
SetPosition( 0 );
}
@ -227,7 +227,7 @@ float plOGGCodec::GetLengthInSecs( void )
return (float)ov_time_total( fOggFile, -1 );
}
hsBool plOGGCodec::SetPosition( UInt32 numBytes )
hsBool plOGGCodec::SetPosition( uint32_t numBytes )
{
hsAssert( IsValid(), "GetHeader() called on an invalid OGG file" );
@ -263,7 +263,7 @@ hsBool plOGGCodec::SetPosition( UInt32 numBytes )
return true;
}
hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer )
hsBool plOGGCodec::Read( uint32_t numBytes, void *buffer )
{
hsAssert( IsValid(), "GetHeader() called on an invalid OGG file" );
// plNetClientApp::StaticDebugMsg("Ogg Read, t=%f, start", hsTimer::GetSeconds());
@ -332,7 +332,7 @@ hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer )
for (i = 0; i < thisRead; i += sampleSize * 2)
{
memcpy(buffer, &trashBuffer[i + sampleOffset], sampleSize);
buffer = (void*)((UInt8*)buffer + sampleSize);
buffer = (void*)((uint8_t*)buffer + sampleSize);
numBytes -= sampleSize;
}
@ -343,7 +343,7 @@ hsBool plOGGCodec::Read( UInt32 numBytes, void *buffer )
return true;
}
UInt32 plOGGCodec::NumBytesLeft( void )
uint32_t plOGGCodec::NumBytesLeft( void )
{
if(!IsValid())
{
@ -351,5 +351,5 @@ UInt32 plOGGCodec::NumBytesLeft( void )
return 0;
}
return (UInt32)(( fDataSize - ( ov_pcm_tell( fOggFile ) * fHeader.fBlockAlign ) ) / fChannelAdjust);
return (uint32_t)(( fDataSize - ( ov_pcm_tell( fOggFile ) * fHeader.fBlockAlign ) ) / fChannelAdjust);
}

View File

@ -77,18 +77,18 @@ public:
virtual void Close( void );
virtual UInt32 GetDataSize( void ) { return fDataSize / fChannelAdjust; }
virtual uint32_t GetDataSize( void ) { return fDataSize / fChannelAdjust; }
virtual float GetLengthInSecs( void );
virtual hsBool SetPosition( UInt32 numBytes );
virtual hsBool Read( UInt32 numBytes, void *buffer );
virtual UInt32 NumBytesLeft( void );
virtual hsBool SetPosition( uint32_t numBytes );
virtual hsBool Read( uint32_t numBytes, void *buffer );
virtual uint32_t NumBytesLeft( void );
virtual hsBool IsValid( void ) { return ( fOggFile != nil ) ? true : false; }
static void SetDecodeFormat( DecodeFormat f ) { fDecodeFormat = f; }
static void SetDecodeFlag( UInt8 flag, hsBool on ) { if( on ) fDecodeFlags |= flag; else fDecodeFlags &= ~flag; }
static UInt8 GetDecodeFlags( void ) { return fDecodeFlags; }
static void SetDecodeFlag( uint8_t flag, hsBool on ) { if( on ) fDecodeFlags |= flag; else fDecodeFlags &= ~flag; }
static uint8_t GetDecodeFlags( void ) { return fDecodeFlags; }
void ResetWaveHeaderRef() { fCurHeaderPos = 0; }
void BuildActualWaveHeader();
bool ReadFromHeader(int numBytes, void *data); // read from Actual wave header
@ -105,14 +105,14 @@ protected:
OggVorbis_File *fOggFile;
plWAVHeader fHeader, fFakeHeader;
UInt32 fDataStartPos, fCurrDataPos, fDataSize;
uint32_t fDataStartPos, fCurrDataPos, fDataSize;
plAudioCore::ChannelSelect fWhichChannel;
UInt32 fChannelAdjust, fChannelOffset;
uint32_t fChannelAdjust, fChannelOffset;
static DecodeFormat fDecodeFormat;
static UInt8 fDecodeFlags;
UInt8 * fHeadBuf;
static uint8_t fDecodeFlags;
uint8_t * fHeadBuf;
int fCurHeaderPos;
void IError( const char *msg );

View File

@ -166,7 +166,7 @@ plSoundBuffer::plSoundBuffer()
IInitBuffer();
}
plSoundBuffer::plSoundBuffer( const char *fileName, UInt32 flags )
plSoundBuffer::plSoundBuffer( const char *fileName, uint32_t flags )
{
IInitBuffer();
SetFileName( fileName );
@ -237,7 +237,7 @@ void plSoundBuffer::Read( hsStream *s, hsResMgr *mgr )
fValid = false;
if( !( fFlags & kIsExternal ) )
{
fData = TRACKED_NEW UInt8[ fDataLength ];
fData = TRACKED_NEW uint8_t[ fDataLength ];
if( fData == nil )
fFlags |= kIsExternal;
else
@ -360,7 +360,7 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::AsyncLoad(plAudioFileReader::Stream
fStreamType = type;
if(fData == nil )
{
fData = TRACKED_NEW UInt8[ fAsyncLoadLength ? fAsyncLoadLength : fDataLength ];
fData = TRACKED_NEW uint8_t[ fAsyncLoadLength ? fAsyncLoadLength : fDataLength ];
if( fData == nil )
return kError;
}
@ -418,9 +418,9 @@ void plSoundBuffer::UnLoad( void )
//// IRoundDataPos ///////////////////////////////////////////////////////////
void plSoundBuffer::RoundDataPos( UInt32 &pos )
void plSoundBuffer::RoundDataPos( uint32_t &pos )
{
UInt32 extra = pos & ( fHeader.fBlockAlign - 1 );
uint32_t extra = pos & ( fHeader.fBlockAlign - 1 );
pos -= extra;
}
@ -457,7 +457,7 @@ void plSoundBuffer::SetLoaded(bool loaded)
//// SetInternalData /////////////////////////////////////////////////////////
void plSoundBuffer::SetInternalData( plWAVHeader &header, UInt32 length, UInt8 *data )
void plSoundBuffer::SetInternalData( plWAVHeader &header, uint32_t length, uint8_t *data )
{
if(fLoading) return;
fFileName = nil;
@ -465,7 +465,7 @@ void plSoundBuffer::SetInternalData( plWAVHeader &header, UInt32 length, UInt
fFlags = 0;
fDataLength = length;
fData = TRACKED_NEW UInt8[ length ];
fData = TRACKED_NEW uint8_t[ length ];
memcpy( fData, data, length );
fValid = true;
@ -477,7 +477,7 @@ plSoundBuffer::ELoadReturnVal plSoundBuffer::EnsureInternal()
{
if( fData == nil )
{
fData = TRACKED_NEW UInt8[fDataLength ];
fData = TRACKED_NEW uint8_t[fDataLength ];
if( fData == nil )
return kError;
}

View File

@ -65,7 +65,7 @@ class plSoundBuffer : public hsKeyedObject
{
public:
plSoundBuffer();
plSoundBuffer( const char *fileName, UInt32 flags = 0 );
plSoundBuffer( const char *fileName, uint32_t flags = 0 );
~plSoundBuffer();
CLASSNAME_REGISTER( plSoundBuffer );
@ -87,13 +87,13 @@ public:
kPending,
};
void RoundDataPos( UInt32 &pos );
void RoundDataPos( uint32_t &pos );
virtual void Read( hsStream *s, hsResMgr *mgr );
virtual void Write( hsStream *s, hsResMgr *mgr );
plWAVHeader &GetHeader( void ) { return fHeader; }
UInt32 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; }
@ -101,8 +101,8 @@ public:
hsScalar GetDataLengthInSecs( void ) const;
void SetFileName( const char *name );
hsBool HasFlag( UInt32 flag ) { return ( fFlags & flag ) ? true : false; }
void SetFlag( UInt32 flag, hsBool yes = true ) { if( yes ) fFlags |= flag; else fFlags &= ~flag; }
hsBool HasFlag( uint32_t flag ) { return ( fFlags & flag ) ? true : false; }
void SetFlag( uint32_t flag, hsBool yes = true ) { if( yes ) fFlags |= flag; else fFlags &= ~flag; }
// Must be called until return value is kSuccess. starts an asynchronous load first time called. returns kSuccess when finished.
ELoadReturnVal AsyncLoad( plAudioFileReader::StreamType type, unsigned length = 0 );
@ -121,7 +121,7 @@ public:
unsigned GetAsyncLoadLength() { return fAsyncLoadLength ? fAsyncLoadLength : fDataLength; }
// for plugins only
void SetInternalData( plWAVHeader &header, UInt32 length, UInt8 *data );
void SetInternalData( plWAVHeader &header, uint32_t length, uint8_t *data );
ELoadReturnVal EnsureInternal( );
void SetError() { fError = true; }
@ -134,12 +134,12 @@ protected:
void IInitBuffer();
hsBool IGrabHeaderInfo( void );
void IAddBuffers( void *base, void *toAdd, UInt32 lengthInBytes, UInt8 bitsPerSample );
void IAddBuffers( void *base, void *toAdd, uint32_t lengthInBytes, uint8_t bitsPerSample );
void IGetFullPath( char *destStr );
UInt32 fFlags;
uint32_t fFlags;
hsBool fValid;
UInt32 fDataRead;
uint32_t fDataRead;
char *fFileName;
bool fLoaded;
@ -147,10 +147,10 @@ protected:
bool fError;
plAudioFileReader * fReader;
UInt8 * fData;
uint8_t * fData;
plWAVHeader fHeader;
UInt32 fDataLength;
UInt32 fAsyncLoadLength;
uint32_t fDataLength;
uint32_t fAsyncLoadLength;
plAudioFileReader::StreamType fStreamType;
// for plugins only

View File

@ -51,21 +51,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <string.h>
plSoundDeswizzler::plSoundDeswizzler( void *srcPtr, UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize )
plSoundDeswizzler::plSoundDeswizzler( void *srcPtr, uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize )
{
fNumSamples = srcLength / sampleSize;
fSampleSize = sampleSize;
fStride = fSampleSize * numChannels;
fData = (UInt8 *)srcPtr;
fData = (uint8_t *)srcPtr;
fOwnsData = false;
}
plSoundDeswizzler::plSoundDeswizzler( UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize )
plSoundDeswizzler::plSoundDeswizzler( uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize )
{
fNumSamples = srcLength / sampleSize;
fSampleSize = sampleSize;
fStride = fSampleSize * numChannels;
fData = TRACKED_NEW UInt8[ srcLength ];
fData = TRACKED_NEW uint8_t[ srcLength ];
fOwnsData = true;
}
@ -75,11 +75,11 @@ plSoundDeswizzler::~plSoundDeswizzler()
delete [] fData;
}
void plSoundDeswizzler::Extract( UInt8 channelSelect, void *dest, UInt32 numBytesToProcess )
void plSoundDeswizzler::Extract( uint8_t channelSelect, void *dest, uint32_t numBytesToProcess )
{
UInt8 *srcPtr = fData + channelSelect * fSampleSize;
UInt8 *destPtr = (UInt8 *)dest;
UInt32 i;
uint8_t *srcPtr = fData + channelSelect * fSampleSize;
uint8_t *destPtr = (uint8_t *)dest;
uint32_t i;
if( numBytesToProcess == 0 )

View File

@ -57,16 +57,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plSoundDeswizzler
{
public:
plSoundDeswizzler( void *srcPtr, UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize );
plSoundDeswizzler( UInt32 srcLength, UInt8 numChannels, UInt32 sampleSize );
plSoundDeswizzler( void *srcPtr, uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize );
plSoundDeswizzler( uint32_t srcLength, uint8_t numChannels, uint32_t sampleSize );
~plSoundDeswizzler();
void *GetSourceBuffer( void ) const { return fData; }
void Extract( UInt8 channelSelect, void *destPtr, UInt32 numBytesToProcess = 0 );
void Extract( uint8_t channelSelect, void *destPtr, uint32_t numBytesToProcess = 0 );
protected:
UInt8 *fData;
UInt32 fNumSamples, fSampleSize, fStride;
uint8_t *fData;
uint32_t fNumSamples, fSampleSize, fStride;
hsBool fOwnsData;
};

View File

@ -273,18 +273,18 @@ HRESULT CWaveFile::OpenFromMemory( BYTE* pbData, ULONG ulDataSize,
(Actually, in the latter case, dwChunkStart is also set to 0, and only dwBlockStart is used). Again, I want to emphasize that you can avoid
all of this unnecessary crap if you avoid hassling with compressed files, or Wave Lists, and instead stick to the sensible basics.
The dwChunkStart field specifies the byte offset of the start of the 'data' or 'slnt' chunk which actually contains the waveform data to
which this CuePoint refers. This offset is relative to the start of the first chunk within the Wave List. (ie, It's the byte offset, within
The dwChunkStart field specifies the uint8_t offset of the start of the 'data' or 'slnt' chunk which actually contains the waveform data to
which this CuePoint refers. This offset is relative to the start of the first chunk within the Wave List. (ie, It's the uint8_t offset, within
the Wave List, of where the 'data' or 'slnt' chunk of interest appears. The first chunk within the List would be at an offset of 0).
The dwBlockStart field specifies the byte offset of the start of the block containing the position. This offset is relative to the start of
The dwBlockStart field specifies the uint8_t offset of the start of the block containing the position. This offset is relative to the start of
the waveform data within the 'data' or 'slnt' chunk.
The dwSampleOffset field specifies the sample offset of the cue point relative to the start of the block. In an uncompressed file, this
equates to simply being the offset within the waveformData array. Unfortunately, the WAVE documentation is much too ambiguous, and doesn't
define what it means by the term "sample offset". This could mean a byte offset, or it could mean counting the sample points (for example,
define what it means by the term "sample offset". This could mean a uint8_t offset, or it could mean counting the sample points (for example,
in a 16-bit wave, every 2 bytes would be 1 sample point), or it could even mean sample frames (as the loop offsets in AIFF are specified).
Who knows? The guy who conjured up the Cue chunk certainly isn't saying. I'm assuming that it's a byte offset, like the above 2 fields.
Who knows? The guy who conjured up the Cue chunk certainly isn't saying. I'm assuming that it's a uint8_t offset, like the above 2 fields.
*/
class CuePoint
@ -356,7 +356,7 @@ HRESULT CWaveFile::ReadMMIO()
return DXTRACE_ERR( TEXT("mmioRead"), E_FAIL );
// Allocate the waveformatex, but if its not pcm format, read the next
// word, and thats how many extra bytes to allocate.
// uint16_t, and thats how many extra bytes to allocate.
if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM )
{
m_pwfx = (WAVEFORMATEX*)( TRACKED_NEW CHAR[ sizeof( WAVEFORMATEX ) ] );
@ -483,7 +483,7 @@ HRESULT CWaveFile::ReadMMIO()
newMarker->fOffset = myCueList[i].fOffset * fSecsPerSample;
}
}
int stringSize = size - sizeof(DWORD); // text string is size of chunck - size of the size word
int stringSize = size - sizeof(DWORD); // text string is size of chunck - size of the size uint16_t
newMarker->fName = TRACKED_NEW char[ stringSize];
strcpy(newMarker->fName, (char*)(bp + 12));
@ -979,7 +979,7 @@ void CWaveFile::Close( void )
IClose();
}
UInt32 CWaveFile::GetDataSize( void )
uint32_t CWaveFile::GetDataSize( void )
{
hsAssert( false, "Unsupported" );
return 0;
@ -991,29 +991,29 @@ float CWaveFile::GetLengthInSecs( void )
return 0.f;
}
hsBool CWaveFile::SetPosition( UInt32 numBytes )
hsBool CWaveFile::SetPosition( uint32_t numBytes )
{
hsAssert( false, "Unsupported" );
return false;
}
hsBool CWaveFile::Read( UInt32 numBytes, void *buffer )
hsBool CWaveFile::Read( uint32_t numBytes, void *buffer )
{
hsAssert( false, "Unsupported" );
return false;
}
UInt32 CWaveFile::NumBytesLeft( void )
uint32_t CWaveFile::NumBytesLeft( void )
{
hsAssert( false, "Unsupported" );
return 0;
}
UInt32 CWaveFile::Write( UInt32 bytes, void *buffer )
uint32_t CWaveFile::Write( uint32_t bytes, void *buffer )
{
UINT written;
Write( (DWORD)bytes, (BYTE *)buffer, &written );
return (UInt32)written;
return (uint32_t)written;
}
hsBool CWaveFile::IsValid( void )
@ -1066,14 +1066,14 @@ public:
LabelChunk--
The ID is always 'labl'. chunkSize is the number of bytes in the chunk, not counting the 8 bytes used by ID and Size fields nor any possible
pad byte needed to make the chunk an even size (ie, chunkSize is the number of remaining bytes in the chunk after the chunkSize field, not
pad uint8_t needed to make the chunk an even size (ie, chunkSize is the number of remaining bytes in the chunk after the chunkSize field, not
counting any trailing pad byte).
The dwIdentifier field contains a unique number (ie, different than the ID number of any other Label chunk). This field should correspond
with the dwIndentifier field of some CuePoint stored in the Cue chunk. In other words, this Label chunk contains the text label associated
with that CuePoint structure with the same ID number.
The dwText array contains the text label. It should be a null-terminated string. (The null byte is included in the chunkSize, therefore the
length of the string, including the null byte, is chunkSize - 4).
The dwText array contains the text label. It should be a null-terminated string. (The null uint8_t is included in the chunkSize, therefore the
length of the string, including the null uint8_t, is chunkSize - 4).
*/

View File

@ -96,13 +96,13 @@ public:
virtual hsBool OpenForWriting( const char *path, plWAVHeader &header );
virtual plWAVHeader &GetHeader( void );
virtual void Close( void );
virtual UInt32 GetDataSize( void );
virtual uint32_t GetDataSize( void );
virtual float GetLengthInSecs( void );
virtual hsBool SetPosition( UInt32 numBytes );
virtual hsBool Read( UInt32 numBytes, void *buffer );
virtual UInt32 NumBytesLeft( void );
virtual UInt32 Write( UInt32 bytes, void *buffer );
virtual hsBool SetPosition( uint32_t numBytes );
virtual hsBool Read( uint32_t numBytes, void *buffer );
virtual uint32_t NumBytesLeft( void );
virtual uint32_t Write( uint32_t bytes, void *buffer );
virtual hsBool IsValid( void );
WAVEFORMATEX* m_pwfx; // Pointer to WAVEFORMATEX structure