RIFF::File Class Reference

RIFF File. More...

#include <RIFF.h>

Inheritance diagram for RIFF::File:

RIFF::List RIFF::Chunk List of all members.

Public Member Functions

 File (uint32_t FileType)
 Create new RIFF file.
 File (const String &path)
 Load existing RIFF file.
stream_mode_t GetMode ()
bool SetMode (stream_mode_t NewMode)
 Change file access mode.
void SetByteOrder (endian_t Endian)
 Set the byte order to be used when saving.
String GetFileName ()
virtual void Save ()
 Save changes to same file.
virtual void Save (const String &path)
 Save changes to another file.
virtual ~File ()
String GetListTypeString ()
 Returns string representation of the lists's id.
uint32_t GetListType ()
 Returns unsigned integer representation of the list's ID.
ChunkGetSubChunk (uint32_t ChunkID)
 Returns subchunk with chunk ID ChunkID within this chunk list.
ListGetSubList (uint32_t ListType)
 Returns sublist chunk with list type ListType within this chunk list.
ChunkGetFirstSubChunk ()
 Returns the first subchunk within the list.
ChunkGetNextSubChunk ()
 Returns the next subchunk within the list.
ListGetFirstSubList ()
 Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
ListGetNextSubList ()
 Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
unsigned int CountSubChunks ()
 Returns number of subchunks within the list.
unsigned int CountSubChunks (uint32_t ChunkID)
 Returns number of subchunks within the list with chunk ID ChunkId.
unsigned int CountSubLists ()
 Returns number of sublists within the list.
unsigned int CountSubLists (uint32_t ListType)
 Returns number of sublists within the list with list type ListType.
ChunkAddSubChunk (uint32_t uiChunkID, uint uiBodySize)
 Creates a new sub chunk.
ListAddSubList (uint32_t uiListType)
 Creates a new list sub chunk.
void DeleteSubChunk (Chunk *pSubChunk)
 Removes a sub chunk.
void MoveSubChunk (Chunk *pSrc, Chunk *pDst)
 Moves a sub chunk.
String GetChunkIDString ()
 Returns the String representation of the chunk's ID (e.g.
uint32_t GetChunkID ()
 Chunk ID in unsigned integer representation.
ListGetParent ()
 Returns pointer to the chunk's parent list chunk.
unsigned long GetSize ()
 Chunk size in bytes (without header, thus the chunk data body).
unsigned long GetNewSize ()
 New chunk size if it was modified with Resize().
unsigned long GetPos ()
 Position within the chunk data body.
unsigned long GetFilePos ()
 Current, actual offset in file.
unsigned long SetPos (unsigned long Where, stream_whence_t Whence=stream_start)
 Sets the position within the chunk body, thus within the data portion of the chunk (in bytes).
unsigned long RemainingBytes ()
 Returns the number of bytes left to read in the chunk body.
stream_state_t GetState ()
 Returns the current state of the chunk object.
unsigned long Read (void *pData, unsigned long WordCount, unsigned long WordSize)
 Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData.
unsigned long ReadInt8 (int8_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 8 Bit signed integer words and copies it into the buffer pointed by pData.
int8_t ReadInt8 ()
 Reads one 8 Bit signed integer word and increments the position within the chunk.
unsigned long ReadUint8 (uint8_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 8 Bit unsigned integer words and copies it into the buffer pointed by pData.
uint8_t ReadUint8 ()
 Reads one 8 Bit unsigned integer word and increments the position within the chunk.
unsigned long ReadInt16 (int16_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData.
int16_t ReadInt16 ()
 Reads one 16 Bit signed integer word and increments the position within the chunk.
unsigned long ReadUint16 (uint16_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pData.
uint16_t ReadUint16 ()
 Reads one 16 Bit unsigned integer word and increments the position within the chunk.
unsigned long ReadInt32 (int32_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData.
int32_t ReadInt32 ()
 Reads one 32 Bit signed integer word and increments the position within the chunk.
unsigned long ReadUint32 (uint32_t *pData, unsigned long WordCount=1)
 Reads WordCount number of 32 Bit unsigned integer words and copies it into the buffer pointed by pData.
uint32_t ReadUint32 ()
 Reads one 32 Bit unsigned integer word and increments the position within the chunk.
unsigned long Write (void *pData, unsigned long WordCount, unsigned long WordSize)
 Writes WordCount number of data words with given WordSize from the buffer pointed by pData.
unsigned long WriteInt8 (int8_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 8 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
unsigned long WriteUint8 (uint8_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 8 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
unsigned long WriteInt16 (int16_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 16 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
unsigned long WriteUint16 (uint16_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 16 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
unsigned long WriteInt32 (int32_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 32 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
unsigned long WriteUint32 (uint32_t *pData, unsigned long WordCount=1)
 Writes WordCount number of 32 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.
void * LoadChunkData ()
 Load chunk body into RAM.
void ReleaseChunkData ()
 Free loaded chunk body from RAM.
void Resize (int iNewSize)
 Resize chunk.

Protected Types

typedef std::map< uint32_t,
RIFF::Chunk * > 
ChunkMap
typedef std::list< Chunk * > ChunkList

Protected Member Functions

void LogAsResized (Chunk *pResizedChunk)
void UnlogResized (Chunk *pResizedChunk)
void ReadHeader (unsigned long fPos)
void WriteHeader (unsigned long fPos)
void LoadSubChunks ()
void LoadSubChunksRecursively ()
virtual unsigned long WriteChunk (unsigned long ulWritePos, unsigned long ulCurrentDataOffset)
 Write list chunk persistently e.g.
virtual void __resetPos ()
 Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.
void DeleteChunkList ()
unsigned long ReadSceptical (void *pData, unsigned long WordCount, unsigned long WordSize)
 Just an internal wrapper for the main Read() method with additional Exception throwing on errors.
void swapBytes_16 (void *Word)
void swapBytes_32 (void *Word)
void swapBytes (void *Word, unsigned long WordSize)
String convertToString (uint32_t word)

Protected Attributes

int hFileRead
 handle / descriptor for reading from file
int hFileWrite
 handle / descriptor for writing to (some) file
String Filename
bool bEndianNative
uint32_t ListType
ChunkListpSubChunks
ChunkMappSubChunksMap
ChunkList::iterator ChunksIterator
ChunkList::iterator ListIterator
uint32_t ChunkID
uint32_t CurrentChunkSize
uint32_t NewChunkSize
ListpParent
FilepFile
unsigned long ulStartPos
unsigned long ulPos
uint8_t * pChunkData
unsigned long ulChunkDataSize

Friends

class Chunk
class List

Detailed Description

RIFF File.

Handles arbitrary RIFF files and provides together with its base classes convenient methods to walk through, read and modify the file's RIFF tree.

Definition at line 319 of file RIFF.h.


Member Typedef Documentation

typedef std::map<uint32_t, RIFF::Chunk*> RIFF::List::ChunkMap [protected, inherited]

Definition at line 293 of file RIFF.h.

typedef std::list<Chunk*> RIFF::List::ChunkList [protected, inherited]

Definition at line 294 of file RIFF.h.


Constructor & Destructor Documentation

RIFF::File::File ( uint32_t  FileType  ) 

Create new RIFF file.

Use this constructor if you want to create a new RIFF file completely "from scratch". Note: there must be no empty chunks or empty list chunks when trying to make the new RIFF file persistent with Save()!

Note: by default, the RIFF file will be saved in native endian format; that is, as a RIFF file on little-endian machines and as a RIFX file on big-endian. To change this behaviour, call SetByteOrder() before calling Save().

Parameters:
FileType - four-byte identifier of the RIFF file type
See also:
AddSubChunk(), AddSubList(), SetByteOrder()

Definition at line 1405 of file RIFF.cpp.

References bEndianNative, hFileRead, hFileWrite, RIFF::List::ListType, RIFF_HEADER_SIZE, RIFF::stream_mode_closed, and RIFF::Chunk::ulStartPos.

RIFF::File::File ( const String path  ) 

Load existing RIFF file.

Loads an existing RIFF file with all its chunks.

Parameters:
path - path and file name of the RIFF file to open
Exceptions:
RIFF::Exception if error occured while trying to load the given RIFF file

Definition at line 1427 of file RIFF.cpp.

References bEndianNative, CHUNK_ID_RIFF, CHUNK_ID_RIFX, RIFF::Chunk::ChunkID, hFileRead, hFileWrite, RIFF::List::ReadHeader(), RIFF_HEADER_SIZE, RIFF::stream_mode_read, and RIFF::Chunk::ulStartPos.

RIFF::File::~File (  )  [virtual]

Definition at line 1771 of file RIFF.cpp.


Member Function Documentation

stream_mode_t RIFF::File::GetMode (  ) 

Definition at line 1474 of file RIFF.cpp.

bool RIFF::File::SetMode ( stream_mode_t  NewMode  ) 

Change file access mode.

Changes files access mode either to read-only mode or to read/write mode.

Parameters:
NewMode - new file access mode
Returns:
true if mode was changed, false if current mode already equals new mode
Exceptions:
RIFF::Exception if new file access mode is unknown

Definition at line 1488 of file RIFF.cpp.

References RIFF::List::__resetPos(), Filename, hFileRead, hFileWrite, RIFF::stream_mode_closed, RIFF::stream_mode_read, and RIFF::stream_mode_read_write.

Referenced by Save().

void RIFF::File::SetByteOrder ( endian_t  Endian  ) 

Set the byte order to be used when saving.

Set the byte order to be used in the file. A value of endian_little will create a RIFF file, endian_big a RIFX file and endian_native will create a RIFF file on little-endian machines and RIFX on big-endian machines.

Parameters:
Endian - endianess to use when file is saved.

Definition at line 1591 of file RIFF.cpp.

References bEndianNative, RIFF::endian_big, and RIFF::endian_little.

Referenced by DLS::File::File().

String RIFF::File::GetFileName (  ) 

Definition at line 1470 of file RIFF.cpp.

References Filename.

Referenced by gig::File::LoadSamples().

void RIFF::File::Save (  )  [virtual]

Save changes to same file.

Make all changes of all chunks persistent by writing them to the actual (same) file. The file might temporarily grow to a higher size than it will have at the end of the saving process, in case chunks were grown.

Exceptions:
RIFF::Exception if there is an empty chunk or empty list chunk or any kind of IO error occured

Definition at line 1609 of file RIFF.cpp.

References _GET_RESIZED_CHUNKS, RIFF::Chunk::GetSize(), hFileRead, hFileWrite, RIFF::List::LoadSubChunksRecursively(), RIFF_HEADER_SIZE, SetMode(), RIFF::stream_mode_read_write, RIFF::Chunk::ulPos, and RIFF::List::WriteChunk().

Referenced by DLS::File::Save().

void RIFF::File::Save ( const String path  )  [virtual]

Save changes to another file.

Make all changes of all chunks persistent by writing them to another file. Caution: this method is optimized for writing to another file, do not use it to save the changes to the same file! Use File::Save() in that case instead! Ignoring this might result in a corrupted file, especially in case chunks were resized!

After calling this method, this File object will be associated with the new file (given by path) afterwards.

Parameters:
path - path and file name where everything should be written to

Definition at line 1698 of file RIFF.cpp.

References _GET_RESIZED_CHUNKS, Filename, hFileRead, hFileWrite, RIFF::List::LoadSubChunksRecursively(), SetMode(), RIFF::stream_mode_read, RIFF::stream_mode_read_write, and RIFF::List::WriteChunk().

void RIFF::File::LogAsResized ( Chunk pResizedChunk  )  [protected]

Definition at line 1792 of file RIFF.cpp.

References _GET_RESIZED_CHUNKS.

Referenced by RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), and RIFF::Chunk::Resize().

void RIFF::File::UnlogResized ( Chunk pResizedChunk  )  [protected]

Definition at line 1796 of file RIFF.cpp.

References _GET_RESIZED_CHUNKS.

Referenced by RIFF::Chunk::~Chunk().

String RIFF::List::GetListTypeString (  )  [inherited]

Returns string representation of the lists's id.

Definition at line 1378 of file RIFF.cpp.

References RIFF::Chunk::convertToString(), and RIFF::List::ListType.

uint32_t RIFF::List::GetListType (  )  [inline, inherited]

Returns unsigned integer representation of the list's ID.

Definition at line 276 of file RIFF.h.

References RIFF::List::ListType.

Referenced by sf2::File::File(), gig::Instrument::Instrument(), DLS::Articulator::LoadArticulations(), gig::Region::LoadDimensionRegions(), gig::File::LoadInstruments(), DLS::File::LoadInstruments(), DLS::Instrument::LoadRegions(), gig::File::LoadSamples(), DLS::File::LoadSamples(), and DLS::Info::UpdateChunks().

Chunk * RIFF::List::GetSubChunk ( uint32_t  ChunkID  )  [inherited]

Returns subchunk with chunk ID ChunkID within this chunk list.

Use this method if you expect only one subchunk of that type in the list. It there are more than one, it's undetermined which one of them will be returned! If there are no subchunks with that desired chunk ID, NULL will be returned.

Parameters:
ChunkID - chunk ID of the sought subchunk
Returns:
pointer to the subchunk or NULL if there is none of that ID

Definition at line 985 of file RIFF.cpp.

References RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunksMap.

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::DimensionRegion::DimensionRegion(), sf2::File::File(), DLS::File::File(), sf2::GetMandatoryChunk(), sf2::Info::Info(), gig::Instrument::Instrument(), DLS::Instrument::Instrument(), DLS::Region::Region(), DLS::Sample::Resize(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Sample::Sample(), DLS::Sampler::Sampler(), gig::File::SetSampleChecksum(), gig::File::UpdateChunks(), gig::Group::UpdateChunks(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Sample::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Instrument::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sample::UpdateChunks(), DLS::Sampler::UpdateChunks(), and DLS::Resource::UpdateChunks().

List * RIFF::List::GetSubList ( uint32_t  ListType  )  [inherited]

Returns sublist chunk with list type ListType within this chunk list.

Use this method if you expect only one sublist chunk of that type in the list. It there are more than one, it's undetermined which one of them will be returned! If there are no sublists with that desired list type, NULL will be returned.

Parameters:
ListType - list type of the sought sublist
Returns:
pointer to the sublist or NULL if there is none of that type

Definition at line 1004 of file RIFF.cpp.

References CHUNK_ID_LIST, RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::Region::AddDimension(), gig::File::AddInstrument(), DLS::File::AddInstrument(), gig::Instrument::AddRegion(), DLS::Instrument::AddRegion(), gig::File::AddSample(), DLS::File::AddSample(), gig::Region::DeleteDimension(), sf2::File::File(), sf2::Info::Info(), DLS::Info::Info(), gig::Instrument::Instrument(), DLS::Articulator::LoadArticulations(), gig::Region::LoadDimensionRegions(), gig::File::LoadGroups(), gig::File::LoadInstruments(), DLS::File::LoadInstruments(), DLS::Instrument::LoadRegions(), gig::File::LoadSamples(), DLS::File::LoadSamples(), gig::File::UpdateChunks(), gig::Group::UpdateChunks(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), and DLS::Info::UpdateChunks().

Chunk * RIFF::List::GetFirstSubChunk (  )  [inherited]

Returns the first subchunk within the list.

You have to call this method before you can call GetNextSubChunk(). Recall it when you want to start from the beginning of the list again.

Returns:
pointer to the first subchunk within the list, NULL otherwise

Definition at line 1029 of file RIFF.cpp.

References RIFF::List::ChunksIterator, RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Referenced by DLS::Articulator::LoadArticulations(), gig::File::LoadGroups(), gig::File::UpdateChunks(), and gig::Group::UpdateChunks().

Chunk * RIFF::List::GetNextSubChunk (  )  [inherited]

Returns the next subchunk within the list.

You have to call GetFirstSubChunk() before you can use this method!

Returns:
pointer to the next subchunk within the list or NULL if end of list is reached

Definition at line 1045 of file RIFF.cpp.

References RIFF::List::ChunksIterator, and RIFF::List::pSubChunks.

Referenced by DLS::Articulator::LoadArticulations(), gig::File::LoadGroups(), gig::File::UpdateChunks(), and gig::Group::UpdateChunks().

List * RIFF::List::GetFirstSubList (  )  [inherited]

Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").

You have to call this method before you can call GetNextSubList(). Recall it when you want to start from the beginning of the list again.

Returns:
pointer to the first sublist within the list, NULL otherwise

Definition at line 1063 of file RIFF.cpp.

References CHUNK_ID_LIST, RIFF::List::ListIterator, RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Referenced by gig::Instrument::Instrument(), gig::Region::LoadDimensionRegions(), gig::File::LoadInstruments(), DLS::File::LoadInstruments(), DLS::Instrument::LoadRegions(), DLS::File::LoadSamples(), and RIFF::List::LoadSubChunksRecursively().

List * RIFF::List::GetNextSubList (  )  [inherited]

Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.

You have to call GetFirstSubList() before you can use this method!

Returns:
pointer to the next sublist within the list, NULL if end of list is reached

Definition at line 1085 of file RIFF.cpp.

References CHUNK_ID_LIST, RIFF::List::ListIterator, and RIFF::List::pSubChunks.

Referenced by gig::Instrument::Instrument(), gig::Region::LoadDimensionRegions(), gig::File::LoadInstruments(), DLS::File::LoadInstruments(), DLS::Instrument::LoadRegions(), gig::File::LoadSamples(), DLS::File::LoadSamples(), and RIFF::List::LoadSubChunksRecursively().

unsigned int RIFF::List::CountSubChunks (  )  [inherited]

Returns number of subchunks within the list.

Definition at line 1103 of file RIFF.cpp.

References RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Referenced by RIFF::List::CountSubLists().

unsigned int RIFF::List::CountSubChunks ( uint32_t  ChunkID  )  [inherited]

Returns number of subchunks within the list with chunk ID ChunkId.

Definition at line 1112 of file RIFF.cpp.

References RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

unsigned int RIFF::List::CountSubLists (  )  [inherited]

Returns number of sublists within the list.

Definition at line 1129 of file RIFF.cpp.

References CHUNK_ID_LIST, and RIFF::List::CountSubChunks().

unsigned int RIFF::List::CountSubLists ( uint32_t  ListType  )  [inherited]

Returns number of sublists within the list with list type ListType.

Definition at line 1137 of file RIFF.cpp.

References CHUNK_ID_LIST, RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Chunk * RIFF::List::AddSubChunk ( uint32_t  uiChunkID,
uint  uiBodySize 
) [inherited]

Creates a new sub chunk.

Creates and adds a new sub chunk to this list chunk. Note that the chunk's body size given by uiBodySize must be greater than zero. You have to call File::Save() to make this change persistent to the actual file and before performing any data write operations on the new chunk!

Parameters:
uiChunkID - chunk ID of the new chunk
uiBodySize - size of the new chunk's body, that is its actual data size (without header)
Exceptions:
RIFF::Exception if uiBodySize equals zero

Definition at line 1165 of file RIFF.cpp.

References RIFF::Chunk::Chunk(), CHUNK_HEADER_SIZE, RIFF::List::LoadSubChunks(), LogAsResized(), RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, RIFF::List::pSubChunks, and RIFF::Chunk::Resize().

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::File::AddInstrument(), gig::File::AddSample(), gig::File::File(), DLS::Sample::Resize(), gig::File::UpdateChunks(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Sample::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Instrument::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sample::UpdateChunks(), DLS::Sampler::UpdateChunks(), and DLS::Resource::UpdateChunks().

List * RIFF::List::AddSubList ( uint32_t  uiListType  )  [inherited]

Creates a new list sub chunk.

Creates and adds a new list sub chunk to this list chunk. Note that you have to add sub chunks / sub list chunks to the new created chunk before trying to make this change persisten to the actual file with File::Save()!

Parameters:
uiListType - list ID of the new list chunk

Definition at line 1204 of file RIFF.cpp.

References CHUNK_ID_LIST, RIFF::List::List(), LIST_HEADER_SIZE, RIFF::List::LoadSubChunks(), LogAsResized(), RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, and RIFF::List::pSubChunks.

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::Region::AddDimension(), gig::File::AddInstrument(), DLS::File::AddInstrument(), gig::Instrument::AddRegion(), DLS::Instrument::AddRegion(), gig::File::AddSample(), DLS::File::AddSample(), gig::Group::UpdateChunks(), gig::Instrument::UpdateChunks(), and DLS::Info::UpdateChunks().

void RIFF::List::DeleteSubChunk ( Chunk pSubChunk  )  [inherited]

Removes a sub chunk.

Removes the sub chunk given by pSubChunk from this list and frees it completely from RAM. The given chunk can either be a normal sub chunk or a list sub chunk. In case the given chunk is a list chunk, all its subchunks (if any) will be removed recursively as well. You should call File::Save() to make this change persistent at any time.

Parameters:
pSubChunk - sub chunk or sub list chunk to be removed

Definition at line 1224 of file RIFF.cpp.

References RIFF::Chunk::GetChunkID(), RIFF::List::LoadSubChunks(), RIFF::List::pSubChunks, and RIFF::List::pSubChunksMap.

Referenced by gig::Region::DeleteDimension().

void RIFF::List::MoveSubChunk ( Chunk pSrc,
Chunk pDst 
) [inherited]

Moves a sub chunk.

Moves a sub chunk from one position in a list to another position in the same list. The pSrc chunk is placed before the pDst chunk.

Parameters:
pSrc - sub chunk to be moved
pDst - the position to move to. pSrc will be placed before pDst. If pDst is 0, pSrc will be placed last in list.

Definition at line 1188 of file RIFF.cpp.

References RIFF::List::LoadSubChunks(), and RIFF::List::pSubChunks.

Referenced by gig::Region::AddDimension(), gig::File::UpdateChunks(), gig::Group::UpdateChunks(), and gig::Region::UpdateChunks().

void RIFF::List::ReadHeader ( unsigned long  fPos  )  [protected, inherited]

Reimplemented from RIFF::Chunk.

Definition at line 1242 of file RIFF.cpp.

References bEndianNative, CHUNK_HEADER_SIZE, RIFF::Chunk::convertToString(), RIFF::Chunk::CurrentChunkSize, hFileRead, RIFF::List::ListType, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, and RIFF::Chunk::ReadHeader().

Referenced by File(), and RIFF::List::List().

void RIFF::List::WriteHeader ( unsigned long  fPos  )  [protected, inherited]

Reimplemented from RIFF::Chunk.

Definition at line 1268 of file RIFF.cpp.

References CHUNK_HEADER_SIZE, hFileWrite, RIFF::List::ListType, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, and RIFF::Chunk::WriteHeader().

Referenced by RIFF::List::WriteChunk().

void RIFF::List::LoadSubChunks (  )  [protected, inherited]

Definition at line 1286 of file RIFF.cpp.

References CHUNK_HEADER_SIZE, CHUNK_ID_LIST, RIFF::Chunk::convertToString(), RIFF::Chunk::GetPos(), RIFF::Chunk::GetSize(), hFileRead, LIST_HEADER_SIZE, RIFF::Chunk::pFile, RIFF::List::pSubChunks, RIFF::List::pSubChunksMap, RIFF::Chunk::Read(), RIFF::Chunk::RemainingBytes(), RIFF::Chunk::SetPos(), RIFF::stream_curpos, RIFF::Chunk::ulPos, and RIFF::Chunk::ulStartPos.

Referenced by RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), RIFF::List::CountSubChunks(), RIFF::List::CountSubLists(), RIFF::List::DeleteSubChunk(), RIFF::List::GetFirstSubChunk(), RIFF::List::GetFirstSubList(), RIFF::List::GetSubChunk(), RIFF::List::GetSubList(), and RIFF::List::MoveSubChunk().

void RIFF::List::LoadSubChunksRecursively (  )  [protected, inherited]

Definition at line 1323 of file RIFF.cpp.

References RIFF::List::GetFirstSubList(), and RIFF::List::GetNextSubList().

Referenced by Save().

unsigned long RIFF::List::WriteChunk ( unsigned long  ulWritePos,
unsigned long  ulCurrentDataOffset 
) [protected, virtual, inherited]

Write list chunk persistently e.g.

to disk.

Stores the list chunk persistently to its actual "physical" file. All subchunks (including sub list chunks) will be stored recursively as well.

Parameters:
ulWritePos - position within the "physical" file where this list chunk should be written to
ulCurrentDataOffset - offset of current (old) data within the file
Returns:
new write position in the "physical" file, that is ulWritePos incremented by this list chunk's new size (including its header size of course)

Reimplemented from RIFF::Chunk.

Definition at line 1342 of file RIFF.cpp.

References RIFF::Chunk::CurrentChunkSize, LIST_HEADER_SIZE, Mode, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, RIFF::List::pSubChunks, RIFF::stream_mode_read_write, RIFF::Chunk::ulStartPos, and RIFF::List::WriteHeader().

Referenced by Save().

void RIFF::List::__resetPos (  )  [protected, virtual, inherited]

Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.

Reimplemented from RIFF::Chunk.

Definition at line 1366 of file RIFF.cpp.

References RIFF::Chunk::__resetPos(), and RIFF::List::pSubChunks.

Referenced by SetMode().

void RIFF::List::DeleteChunkList (  )  [protected, inherited]

Definition at line 957 of file RIFF.cpp.

References RIFF::List::pSubChunks, and RIFF::List::pSubChunksMap.

Referenced by RIFF::List::~List().

String RIFF::Chunk::GetChunkIDString (  )  [inherited]

Returns the String representation of the chunk's ID (e.g.

"RIFF", "LIST").

Definition at line 183 of file RIFF.cpp.

References RIFF::Chunk::ChunkID, and RIFF::Chunk::convertToString().

uint32_t RIFF::Chunk::GetChunkID (  )  [inline, inherited]

Chunk ID in unsigned integer representation.

Definition at line 181 of file RIFF.h.

References RIFF::Chunk::ChunkID.

Referenced by DLS::Articulation::Articulation(), RIFF::List::DeleteSubChunk(), DLS::Articulator::LoadArticulations(), gig::File::LoadGroups(), and sf2::VerifySize().

List* RIFF::Chunk::GetParent (  )  [inline, inherited]

Returns pointer to the chunk's parent list chunk.

Definition at line 182 of file RIFF.h.

References RIFF::Chunk::pParent.

Referenced by gig::Group::~Group(), DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().

unsigned long RIFF::Chunk::GetSize (  )  [inline, inherited]

Chunk size in bytes (without header, thus the chunk data body).

Definition at line 183 of file RIFF.h.

References RIFF::Chunk::CurrentChunkSize.

Referenced by sf2::File::File(), DLS::File::File(), DLS::Sample::GetSize(), gig::Instrument::Instrument(), RIFF::Chunk::LoadChunkData(), RIFF::List::LoadSubChunks(), sf2::Sample::Sample(), DLS::Sample::Sample(), Save(), gig::File::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sampler::UpdateChunks(), sf2::VerifySize(), and gig::Sample::Write().

unsigned long RIFF::Chunk::GetNewSize (  )  [inline, inherited]

New chunk size if it was modified with Resize().

Definition at line 184 of file RIFF.h.

References RIFF::Chunk::NewChunkSize.

Referenced by gig::DimensionRegion::UpdateChunks().

unsigned long RIFF::Chunk::GetPos (  )  [inline, inherited]

Position within the chunk data body.

Definition at line 185 of file RIFF.h.

References RIFF::Chunk::ulPos.

Referenced by sf2::Sample::GetPos(), gig::Sample::GetPos(), RIFF::List::LoadSubChunks(), sf2::Sample::Read(), and gig::Sample::Write().

unsigned long RIFF::Chunk::GetFilePos (  )  [inline, inherited]

Current, actual offset in file.

Definition at line 186 of file RIFF.h.

References RIFF::Chunk::ulPos, and RIFF::Chunk::ulStartPos.

Referenced by gig::File::LoadSamples(), and DLS::File::LoadSamples().

unsigned long RIFF::Chunk::SetPos ( unsigned long  Where,
stream_whence_t  Whence = stream_start 
) [inherited]

Sets the position within the chunk body, thus within the data portion of the chunk (in bytes).

Caution: the position will be reset to zero whenever File::Save() was called.

Parameters:
Where - position offset (in bytes)
Whence - optional: defines to what Where relates to, if omitted Where relates to beginning of the chunk data

Definition at line 199 of file RIFF.cpp.

References RIFF::Chunk::CurrentChunkSize, RIFF::stream_backward, RIFF::stream_curpos, RIFF::stream_end, RIFF::stream_start, and RIFF::Chunk::ulPos.

Referenced by DLS::Articulation::Articulation(), DLS::File::File(), gig::Instrument::Instrument(), RIFF::List::LoadSubChunks(), gig::MidiRuleCtrlTrigger::MidiRuleCtrlTrigger(), RIFF::Chunk::Read(), gig::Sample::Read(), gig::Region::Region(), gig::Sample::Sample(), DLS::Sampler::Sampler(), sf2::Sample::SetPos(), gig::Sample::SetPos(), DLS::Sample::SetPos(), and gig::File::SetSampleChecksum().

unsigned long RIFF::Chunk::RemainingBytes (  )  [inherited]

Returns the number of bytes left to read in the chunk body.

When reading data from the chunk using the Read*() Methods, the position within the chunk data (that is the chunk body) will be incremented by the number of read bytes and RemainingBytes() returns how much data is left to read from the current position to the end of the chunk data.

Returns:
number of bytes left to read

Definition at line 231 of file RIFF.cpp.

References RIFF::Chunk::CurrentChunkSize, and RIFF::Chunk::ulPos.

Referenced by gig::DimensionRegion::DimensionRegion(), RIFF::List::LoadSubChunks(), gig::Sample::Read(), and DLS::Region::Region().

stream_state_t RIFF::Chunk::GetState (  )  [inherited]

Returns the current state of the chunk object.

Following values are possible:

Definition at line 249 of file RIFF.cpp.

References RIFF::Chunk::CurrentChunkSize, hFileRead, RIFF::Chunk::pFile, RIFF::stream_closed, RIFF::stream_end_reached, RIFF::stream_ready, and RIFF::Chunk::ulPos.

unsigned long RIFF::Chunk::Read ( void *  pData,
unsigned long  WordCount,
unsigned long  WordSize 
) [inherited]

Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData.

The buffer has to be allocated and be sure to provide the correct WordSize, as this will be important and taken into account for eventual endian correction (swapping of bytes due to different native byte order of a system). The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of data words to read
WordSize size of each data word to read
Returns:
number of successfully read data words or 0 if end of file reached or error occured

Definition at line 280 of file RIFF.cpp.

References bEndianNative, RIFF::Chunk::CurrentChunkSize, hFileRead, RIFF::Chunk::pFile, RIFF::Chunk::SetPos(), RIFF::stream_curpos, RIFF::Chunk::swapBytes(), RIFF::Chunk::swapBytes_16(), RIFF::Chunk::swapBytes_32(), RIFF::Chunk::ulPos, and RIFF::Chunk::ulStartPos.

Referenced by DLS::Articulation::Articulation(), gig::DimensionRegion::DimensionRegion(), DLS::File::File(), DLS::Instrument::Instrument(), RIFF::List::LoadSubChunks(), sf2::Sample::Read(), gig::Sample::Read(), DLS::Sample::Read(), RIFF::Chunk::ReadSceptical(), DLS::Region::Region(), DLS::Resource::Resource(), gig::Sample::Sample(), and DLS::Sampler::Sampler().

unsigned long RIFF::Chunk::ReadInt8 ( int8_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 8 Bit signed integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 8 Bit signed integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 405 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by gig::DimensionRegion::DimensionRegion(), sf2::LoadString(), and sf2::Sample::Sample().

int8_t RIFF::Chunk::ReadInt8 (  )  [inherited]

Reads one 8 Bit signed integer word and increments the position within the chunk.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 622 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::ReadUint8 ( uint8_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 8 Bit unsigned integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 8 Bit unsigned integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 442 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), gig::MidiRuleCtrlTrigger::MidiRuleCtrlTrigger(), and gig::Region::Region().

uint8_t RIFF::Chunk::ReadUint8 (  )  [inherited]

Reads one 8 Bit unsigned integer word and increments the position within the chunk.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 638 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::ReadInt16 ( int16_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. Endian correction will automatically be done if needed. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 16 Bit signed integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 479 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by gig::DimensionRegion::DimensionRegion(), sf2::File::File(), sf2::Instrument::Instrument(), gig::Instrument::Instrument(), sf2::Preset::Preset(), sf2::Sample::Sample(), gig::Sample::Sample(), and DLS::Sampler::Sampler().

int16_t RIFF::Chunk::ReadInt16 (  )  [inherited]

Reads one 16 Bit signed integer word and increments the position within the chunk.

Endian correction will automatically be done if needed.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 655 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::ReadUint16 ( uint16_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. Endian correction will automatically be done if needed. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 8 Bit unsigned integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 516 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), DLS::Region::Region(), DLS::Sample::Sample(), and DLS::Sampler::Sampler().

uint16_t RIFF::Chunk::ReadUint16 (  )  [inherited]

Reads one 16 Bit unsigned integer word and increments the position within the chunk.

Endian correction will automatically be done if needed.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 672 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::ReadInt32 ( int32_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. Endian correction will automatically be done if needed. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 32 Bit signed integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 553 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), sf2::Preset::Preset(), sf2::Sample::Sample(), gig::Sample::Sample(), and DLS::Sampler::Sampler().

int32_t RIFF::Chunk::ReadInt32 (  )  [inherited]

Reads one 32 Bit signed integer word and increments the position within the chunk.

Endian correction will automatically be done if needed.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 689 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::ReadUint32 ( uint32_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Reads WordCount number of 32 Bit unsigned integer words and copies it into the buffer pointed by pData.

The buffer has to be allocated. Endian correction will automatically be done if needed. The position within the chunk will automatically be incremented.

Parameters:
pData destination buffer
WordCount number of 32 Bit unsigned integers to read
Returns:
number of read integers
Exceptions:
RIFF::Exception if an error occured or less than WordCount integers could be read!

Definition at line 590 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

Referenced by DLS::Articulation::Articulation(), DLS::File::File(), DLS::Instrument::Instrument(), gig::Region::Region(), DLS::Region::Region(), DLS::Sample::Sample(), and DLS::Sampler::Sampler().

uint32_t RIFF::Chunk::ReadUint32 (  )  [inherited]

Reads one 32 Bit unsigned integer word and increments the position within the chunk.

Endian correction will automatically be done if needed.

Returns:
read integer word
Exceptions:
RIFF::Exception if an error occured

Definition at line 706 of file RIFF.cpp.

References RIFF::Chunk::ReadSceptical().

unsigned long RIFF::Chunk::Write ( void *  pData,
unsigned long  WordCount,
unsigned long  WordSize 
) [inherited]

Writes WordCount number of data words with given WordSize from the buffer pointed by pData.

Be sure to provide the correct WordSize, as this will be important and taken into account for eventual endian correction (swapping of bytes due to different native byte order of a system). The position within the chunk will automatically be incremented.

Parameters:
pData source buffer (containing the data)
WordCount number of data words to write
WordSize size of each data word to write
Returns:
number of successfully written data words
Exceptions:
RIFF::Exception if write operation would exceed current chunk size or any IO error occured
See also:
Resize()

Definition at line 338 of file RIFF.cpp.

References bEndianNative, RIFF::Chunk::CurrentChunkSize, hFileWrite, Mode, RIFF::Chunk::pFile, RIFF::stream_mode_read_write, RIFF::Chunk::swapBytes(), RIFF::Chunk::swapBytes_16(), RIFF::Chunk::swapBytes_32(), RIFF::Chunk::ulPos, and RIFF::Chunk::ulStartPos.

Referenced by gig::Sample::Write(), DLS::Sample::Write(), RIFF::Chunk::WriteInt16(), RIFF::Chunk::WriteInt32(), RIFF::Chunk::WriteInt8(), RIFF::Chunk::WriteUint16(), RIFF::Chunk::WriteUint32(), and RIFF::Chunk::WriteUint8().

unsigned long RIFF::Chunk::WriteInt8 ( int8_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 8 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 8 Bit signed integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 426 of file RIFF.cpp.

References RIFF::Chunk::Write().

unsigned long RIFF::Chunk::WriteUint8 ( uint8_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 8 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 8 Bit unsigned integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 463 of file RIFF.cpp.

References RIFF::Chunk::Write().

unsigned long RIFF::Chunk::WriteInt16 ( int16_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 16 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 16 Bit signed integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 500 of file RIFF.cpp.

References RIFF::Chunk::Write().

unsigned long RIFF::Chunk::WriteUint16 ( uint16_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 16 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 16 Bit unsigned integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 537 of file RIFF.cpp.

References RIFF::Chunk::Write().

unsigned long RIFF::Chunk::WriteInt32 ( int32_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 32 Bit signed integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 32 Bit signed integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 574 of file RIFF.cpp.

References RIFF::Chunk::Write().

unsigned long RIFF::Chunk::WriteUint32 ( uint32_t *  pData,
unsigned long  WordCount = 1 
) [inherited]

Writes WordCount number of 32 Bit unsigned integer words from the buffer pointed by pData to the chunk's body, directly to the actual "physical" file.

The position within the chunk will automatically be incremented. Note: you cannot write beyond the boundaries of the chunk, to append data to the chunk call Resize() before.

Parameters:
pData source buffer (containing the data)
WordCount number of 32 Bit unsigned integers to write
Returns:
number of written integers
Exceptions:
RIFF::Exception if an IO error occured
See also:
Resize()

Definition at line 611 of file RIFF.cpp.

References RIFF::Chunk::Write().

Referenced by gig::File::SetSampleChecksum().

void * RIFF::Chunk::LoadChunkData (  )  [inherited]

Load chunk body into RAM.

Loads the whole chunk body into memory. You can modify the data in RAM and save the data by calling File::Save() afterwards.

Caution: the buffer pointer will be invalidated once File::Save() was called. You have to call LoadChunkData() again to get a new, valid pointer whenever File::Save() was called.

You can call LoadChunkData() again if you previously scheduled to enlarge this chunk with a Resize() call. In that case the buffer will be enlarged to the new, scheduled chunk size and you can already place the new chunk data to the buffer and finally call File::Save() to enlarge the chunk physically and write the new data in one rush. This approach is definitely recommended if you have to enlarge and write new data to a lot of chunks.

Returns:
a pointer to the data in RAM on success, NULL otherwise
Exceptions:
Exception if data buffer could not be enlarged
See also:
ReleaseChunkData()

Definition at line 736 of file RIFF.cpp.

References RIFF::Chunk::CurrentChunkSize, Filename, RIFF::Chunk::GetSize(), hFileRead, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pChunkData, RIFF::Chunk::pFile, RIFF::Chunk::ulChunkDataSize, and RIFF::Chunk::ulStartPos.

Referenced by gig::File::LoadGroups(), DLS::Sample::LoadSampleData(), gig::File::UpdateChunks(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Sample::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Instrument::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sample::UpdateChunks(), DLS::Sampler::UpdateChunks(), DLS::Resource::UpdateChunks(), DLS::Articulation::UpdateChunks(), and RIFF::Chunk::WriteChunk().

void RIFF::Chunk::ReleaseChunkData (  )  [inherited]

Free loaded chunk body from RAM.

Frees loaded chunk body data from memory (RAM). You should call File::Save() before calling this method if you modified the data to make the changes persistent.

Definition at line 780 of file RIFF.cpp.

References RIFF::Chunk::pChunkData.

Referenced by DLS::Sample::ReleaseSampleData().

void RIFF::Chunk::Resize ( int  iNewSize  )  [inherited]

Resize chunk.

Resizes this chunk's body, that is the actual size of data possible to be written to this chunk. This call will return immediately and just schedule the resize operation. You should call File::Save() to actually perform the resize operation(s) "physically" to the file. As this can take a while on large files, it is recommended to call Resize() first on all chunks which have to be resized and finally to call File::Save() to perform all those resize operations in one rush.

Caution: You cannot directly write to enlarged chunks before calling File::Save() as this might exceed the current chunk's body boundary!

Parameters:
iNewSize - new chunk body size in bytes (must be greater than zero)
Exceptions:
RIFF::Exception if iNewSize is less than 1
See also:
File::Save()

Definition at line 805 of file RIFF.cpp.

References LogAsResized(), RIFF::Chunk::NewChunkSize, and RIFF::Chunk::pFile.

Referenced by RIFF::List::AddSubChunk(), DLS::Sample::Resize(), gig::File::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Sampler::UpdateChunks(), and DLS::Articulation::UpdateChunks().

unsigned long RIFF::Chunk::ReadSceptical ( void *  pData,
unsigned long  WordCount,
unsigned long  WordSize 
) [protected, inherited]

Just an internal wrapper for the main Read() method with additional Exception throwing on errors.

Definition at line 388 of file RIFF.cpp.

References RIFF::Chunk::Read().

Referenced by RIFF::Chunk::ReadInt16(), RIFF::Chunk::ReadInt32(), RIFF::Chunk::ReadInt8(), RIFF::Chunk::ReadUint16(), RIFF::Chunk::ReadUint32(), and RIFF::Chunk::ReadUint8().

void RIFF::Chunk::swapBytes_16 ( void *  Word  )  [inline, protected, inherited]

Definition at line 230 of file RIFF.h.

Referenced by RIFF::Chunk::Read(), and RIFF::Chunk::Write().

void RIFF::Chunk::swapBytes_32 ( void *  Word  )  [inline, protected, inherited]

Definition at line 235 of file RIFF.h.

Referenced by RIFF::Chunk::Read(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::Write(), and RIFF::Chunk::WriteHeader().

void RIFF::Chunk::swapBytes ( void *  Word,
unsigned long  WordSize 
) [inline, protected, inherited]

Definition at line 243 of file RIFF.h.

Referenced by RIFF::Chunk::Read(), and RIFF::Chunk::Write().

String RIFF::Chunk::convertToString ( uint32_t  word  )  [inline, protected, inherited]

Definition at line 252 of file RIFF.h.

Referenced by RIFF::Chunk::GetChunkIDString(), RIFF::List::GetListTypeString(), RIFF::List::LoadSubChunks(), RIFF::List::ReadHeader(), and RIFF::Chunk::ReadHeader().


Friends And Related Function Documentation

friend class Chunk [friend]

Definition at line 346 of file RIFF.h.

friend class List [friend]

Reimplemented from RIFF::Chunk.

Definition at line 347 of file RIFF.h.


Member Data Documentation

int RIFF::File::hFileRead [protected]

handle / descriptor for reading from file

Definition at line 332 of file RIFF.h.

Referenced by File(), RIFF::Chunk::GetState(), RIFF::Chunk::LoadChunkData(), RIFF::List::LoadSubChunks(), RIFF::Chunk::Read(), RIFF::List::ReadHeader(), RIFF::Chunk::ReadHeader(), Save(), SetMode(), and RIFF::Chunk::WriteChunk().

int RIFF::File::hFileWrite [protected]

handle / descriptor for writing to (some) file

Definition at line 333 of file RIFF.h.

Referenced by File(), Save(), SetMode(), RIFF::Chunk::Write(), RIFF::Chunk::WriteChunk(), RIFF::List::WriteHeader(), and RIFF::Chunk::WriteHeader().

String RIFF::File::Filename [protected]

Definition at line 341 of file RIFF.h.

Referenced by GetFileName(), RIFF::Chunk::LoadChunkData(), Save(), and SetMode().

bool RIFF::File::bEndianNative [protected]

Definition at line 342 of file RIFF.h.

Referenced by File(), RIFF::Chunk::Read(), RIFF::List::ReadHeader(), RIFF::Chunk::ReadHeader(), SetByteOrder(), RIFF::Chunk::Write(), and RIFF::Chunk::WriteHeader().

uint32_t RIFF::List::ListType [protected, inherited]

Definition at line 296 of file RIFF.h.

Referenced by File(), RIFF::List::GetListType(), RIFF::List::GetListTypeString(), RIFF::List::List(), RIFF::List::ReadHeader(), and RIFF::List::WriteHeader().

ChunkList* RIFF::List::pSubChunks [protected, inherited]

Definition at line 297 of file RIFF.h.

Referenced by RIFF::List::__resetPos(), RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), RIFF::List::CountSubChunks(), RIFF::List::CountSubLists(), RIFF::List::DeleteChunkList(), RIFF::List::DeleteSubChunk(), RIFF::List::GetFirstSubChunk(), RIFF::List::GetFirstSubList(), RIFF::List::GetNextSubChunk(), RIFF::List::GetNextSubList(), RIFF::List::GetSubList(), RIFF::List::List(), RIFF::List::LoadSubChunks(), RIFF::List::MoveSubChunk(), and RIFF::List::WriteChunk().

ChunkMap* RIFF::List::pSubChunksMap [protected, inherited]

Definition at line 298 of file RIFF.h.

Referenced by RIFF::List::DeleteChunkList(), RIFF::List::DeleteSubChunk(), RIFF::List::GetSubChunk(), RIFF::List::List(), and RIFF::List::LoadSubChunks().

ChunkList::iterator RIFF::List::ChunksIterator [protected, inherited]

Definition at line 299 of file RIFF.h.

Referenced by RIFF::List::GetFirstSubChunk(), and RIFF::List::GetNextSubChunk().

ChunkList::iterator RIFF::List::ListIterator [protected, inherited]

Definition at line 300 of file RIFF.h.

Referenced by RIFF::List::GetFirstSubList(), and RIFF::List::GetNextSubList().

uint32_t RIFF::Chunk::ChunkID [protected, inherited]

Definition at line 215 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), File(), RIFF::Chunk::GetChunkID(), RIFF::Chunk::GetChunkIDString(), RIFF::Chunk::ReadHeader(), and RIFF::Chunk::WriteHeader().

uint32_t RIFF::Chunk::CurrentChunkSize [protected, inherited]

Definition at line 216 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), RIFF::Chunk::GetSize(), RIFF::Chunk::GetState(), RIFF::Chunk::LoadChunkData(), RIFF::Chunk::Read(), RIFF::List::ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::RemainingBytes(), RIFF::Chunk::SetPos(), RIFF::Chunk::Write(), RIFF::List::WriteChunk(), and RIFF::Chunk::WriteChunk().

uint32_t RIFF::Chunk::NewChunkSize [protected, inherited]

Definition at line 217 of file RIFF.h.

Referenced by RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), RIFF::Chunk::Chunk(), RIFF::Chunk::GetNewSize(), RIFF::Chunk::LoadChunkData(), RIFF::List::ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::Resize(), RIFF::List::WriteChunk(), RIFF::Chunk::WriteChunk(), RIFF::List::WriteHeader(), and RIFF::Chunk::WriteHeader().

List* RIFF::Chunk::pParent [protected, inherited]

Definition at line 218 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), and RIFF::Chunk::GetParent().

File* RIFF::Chunk::pFile [protected, inherited]

Definition at line 219 of file RIFF.h.

Referenced by RIFF::List::AddSubChunk(), RIFF::List::AddSubList(), RIFF::Chunk::Chunk(), RIFF::Chunk::GetState(), RIFF::Chunk::LoadChunkData(), RIFF::List::LoadSubChunks(), RIFF::Chunk::Read(), RIFF::List::ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::Resize(), RIFF::Chunk::Write(), RIFF::List::WriteChunk(), RIFF::Chunk::WriteChunk(), RIFF::List::WriteHeader(), RIFF::Chunk::WriteHeader(), and RIFF::Chunk::~Chunk().

unsigned long RIFF::Chunk::ulStartPos [protected, inherited]

Definition at line 220 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), File(), RIFF::Chunk::GetFilePos(), RIFF::List::List(), RIFF::Chunk::LoadChunkData(), RIFF::List::LoadSubChunks(), RIFF::Chunk::Read(), RIFF::Chunk::Write(), RIFF::List::WriteChunk(), and RIFF::Chunk::WriteChunk().

unsigned long RIFF::Chunk::ulPos [protected, inherited]

Definition at line 221 of file RIFF.h.

Referenced by RIFF::Chunk::__resetPos(), RIFF::Chunk::Chunk(), RIFF::Chunk::GetFilePos(), RIFF::Chunk::GetPos(), RIFF::Chunk::GetState(), RIFF::List::LoadSubChunks(), RIFF::Chunk::Read(), RIFF::Chunk::RemainingBytes(), Save(), RIFF::Chunk::SetPos(), RIFF::Chunk::Write(), and RIFF::Chunk::WriteChunk().

uint8_t* RIFF::Chunk::pChunkData [protected, inherited]

Definition at line 222 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), RIFF::Chunk::LoadChunkData(), RIFF::Chunk::ReleaseChunkData(), RIFF::Chunk::WriteChunk(), and RIFF::Chunk::~Chunk().

unsigned long RIFF::Chunk::ulChunkDataSize [protected, inherited]

Definition at line 223 of file RIFF.h.

Referenced by RIFF::Chunk::Chunk(), and RIFF::Chunk::LoadChunkData().


The documentation for this class was generated from the following files:
Generated on Sun May 1 03:22:48 2011 for libgig by  doxygen 1.5.2