#include <RIFF.h>
Public Member Functions | |
List (File *pFile, unsigned long StartPos, List *Parent) | |
String | GetListTypeString () |
Returns string representation of the lists's id. | |
uint32_t | GetListType () |
Returns unsigned integer representation of the list's ID. | |
Chunk * | GetSubChunk (uint32_t ChunkID) |
Returns subchunk with chunk ID ChunkID within this chunk list. | |
List * | GetSubList (uint32_t ListType) |
Returns sublist chunk with list type ListType within this chunk list. | |
Chunk * | GetFirstSubChunk () |
Returns the first subchunk within the list. | |
Chunk * | GetNextSubChunk () |
Returns the next subchunk within the list. | |
List * | GetFirstSubList () |
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST"). | |
List * | GetNextSubList () |
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. | |
Chunk * | AddSubChunk (uint32_t uiChunkID, uint uiBodySize) |
List * | AddSubList (uint32_t uiListType) |
void | DeleteSubChunk (Chunk *pSubChunk) |
void | MoveSubChunk (Chunk *pSrc, Chunk *pDst) |
virtual | ~List () |
String | GetChunkIDString () |
Returns the String representation of the chunk's ID (e.g. | |
uint32_t | GetChunkID () |
List * | GetParent () |
Chunk ID in unsigned integer representation. | |
unsigned long | GetSize () |
Returns pointer to the chunk's parent list chunk. | |
unsigned long | GetNewSize () |
Chunk size in bytes (without header, thus the chunk data body). | |
unsigned long | GetPos () |
New chunk size if it was modified with Resize(). | |
unsigned long | GetFilePos () |
Position within the chunk data body. | |
unsigned long | SetPos (unsigned long Where, stream_whence_t Whence=stream_start) |
Current, actual offset in file. | |
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 () |
void | ReleaseChunkData () |
void | Resize (int iNewSize) |
Protected Types | |
typedef std::map < uint32_t, RIFF::Chunk * > | ChunkMap |
typedef std::list < Chunk * > | ChunkList |
Protected Member Functions | |
List (File *pFile) | |
List (File *pFile, List *pParent, uint32_t uiListID) | |
void | ReadHeader (unsigned long fPos) |
void | WriteHeader (unsigned long fPos) |
void | LoadSubChunks () |
void | LoadSubChunksRecursively () |
virtual unsigned long | WriteChunk (unsigned long ulWritePos, unsigned long ulCurrentDataOffset) |
virtual void | __resetPos () |
Sets List Chunk's read/write position to zero and causes all sub chunks to do the same. | |
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 | |
uint32_t | ListType |
ChunkList * | pSubChunks |
ChunkMap * | pSubChunksMap |
ChunkList::iterator | ChunksIterator |
ChunkList::iterator | ListIterator |
uint32_t | ChunkID |
uint32_t | CurrentChunkSize |
uint32_t | NewChunkSize |
List * | pParent |
File * | pFile |
unsigned long | ulStartPos |
unsigned long | ulPos |
uint8_t * | pChunkData |
unsigned long | ulChunkDataSize |
Friends | |
class | List |
Definition at line 209 of file RIFF.h.
typedef std::map<uint32_t, RIFF::Chunk*> RIFF::List::ChunkMap [protected] |
typedef std::list<Chunk*> RIFF::List::ChunkList [protected] |
Definition at line 923 of file RIFF.cpp.
References LIST_HEADER_SIZE, pSubChunks, pSubChunksMap, ReadHeader(), and RIFF::Chunk::ulStartPos.
Referenced by AddSubList().
RIFF::List::~List | ( | ) | [virtual] |
RIFF::List::List | ( | File * | pFile | ) | [protected] |
String RIFF::List::GetListTypeString | ( | ) |
Returns string representation of the lists's id.
Definition at line 1352 of file RIFF.cpp.
References RIFF::Chunk::convertToString(), and ListType.
Referenced by RIFF::__resolveChunkPath().
uint32_t RIFF::List::GetListType | ( | ) | [inline] |
Returns unsigned integer representation of the list's ID.
Definition at line 213 of file RIFF.h.
References ListType.
Referenced by CountSubLists(), GetSubList(), 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 | ) |
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.
ChunkID | - chunk ID of the sought subchunk |
Definition at line 968 of file RIFF.cpp.
References LoadSubChunks(), and pSubChunksMap.
Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::DimensionRegion::DimensionRegion(), DLS::File::File(), gig::Instrument::Instrument(), DLS::Instrument::Instrument(), gig::Region::Region(), DLS::Region::Region(), DLS::Sample::Resize(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Sample::Sample(), DLS::Sampler::Sampler(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Sample::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Instrument::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sample::UpdateChunks(), and DLS::Sampler::UpdateChunks().
List * RIFF::List::GetSubList | ( | uint32_t | ListType | ) |
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.
ListType | - list type of the sought sublist |
Definition at line 987 of file RIFF.cpp.
References CHUNK_ID_LIST, GetListType(), LoadSubChunks(), and pSubChunks.
Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::File::AddInstrument(), DLS::File::AddInstrument(), gig::Instrument::AddRegion(), DLS::Instrument::AddRegion(), gig::File::AddSample(), DLS::File::AddSample(), 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(), DLS::Instrument::MoveRegion(), gig::Region::Region(), gig::Group::UpdateChunks(), gig::Instrument::UpdateChunks(), and DLS::Info::UpdateChunks().
Chunk * RIFF::List::GetFirstSubChunk | ( | ) |
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.
Definition at line 1012 of file RIFF.cpp.
References ChunksIterator, LoadSubChunks(), and pSubChunks.
Referenced by DLS::Articulator::LoadArticulations(), and gig::File::LoadGroups().
Chunk * RIFF::List::GetNextSubChunk | ( | ) |
Returns the next subchunk within the list.
You have to call GetFirstSubChunk() before you can use this method!
Definition at line 1028 of file RIFF.cpp.
References ChunksIterator, and pSubChunks.
Referenced by DLS::Articulator::LoadArticulations(), and gig::File::LoadGroups().
List * RIFF::List::GetFirstSubList | ( | ) |
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.
Definition at line 1046 of file RIFF.cpp.
References CHUNK_ID_LIST, ListIterator, LoadSubChunks(), and 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 LoadSubChunksRecursively().
List * RIFF::List::GetNextSubList | ( | ) |
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!
Definition at line 1068 of file RIFF.cpp.
References CHUNK_ID_LIST, ListIterator, and 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 LoadSubChunksRecursively().
unsigned int RIFF::List::CountSubChunks | ( | ) |
Returns number of subchunks within the list.
Definition at line 1086 of file RIFF.cpp.
References LoadSubChunks(), and pSubChunks.
Referenced by CountSubLists().
unsigned int RIFF::List::CountSubChunks | ( | uint32_t | ChunkID | ) |
Returns number of subchunks within the list with chunk ID ChunkId.
Definition at line 1095 of file RIFF.cpp.
References LoadSubChunks(), and pSubChunks.
unsigned int RIFF::List::CountSubLists | ( | ) |
Returns number of sublists within the list.
Definition at line 1112 of file RIFF.cpp.
References CHUNK_ID_LIST, and CountSubChunks().
unsigned int RIFF::List::CountSubLists | ( | uint32_t | ListType | ) |
Returns number of sublists within the list with list type ListType.
Definition at line 1120 of file RIFF.cpp.
References CHUNK_ID_LIST, GetListType(), LoadSubChunks(), and pSubChunks.
Chunk * RIFF::List::AddSubChunk | ( | uint32_t | uiChunkID, | |
uint | uiBodySize | |||
) |
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!
uiChunkID | - chunk ID of the new chunk | |
uiBodySize | - size of the new chunk's body, that is its actual data size (without header) |
RIFF::Exception | if uiBodySize equals zero |
Definition at line 1148 of file RIFF.cpp.
References RIFF::Chunk::Chunk(), LoadSubChunks(), RIFF::Chunk::pFile, pSubChunks, and RIFF::Chunk::Resize().
Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::Sample::Resize(), gig::Instrument::UpdateChunks(), gig::Region::UpdateChunks(), gig::DimensionRegion::UpdateChunks(), gig::Sample::UpdateChunks(), DLS::File::UpdateChunks(), DLS::Instrument::UpdateChunks(), DLS::Region::UpdateChunks(), DLS::Sample::UpdateChunks(), and DLS::Sampler::UpdateChunks().
List * RIFF::List::AddSubList | ( | uint32_t | uiListType | ) |
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()!
uiListType | - list ID of the new list chunk |
Definition at line 1185 of file RIFF.cpp.
References CHUNK_ID_LIST, List(), LoadSubChunks(), RIFF::Chunk::pFile, and 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::Region(), gig::Group::UpdateChunks(), gig::Instrument::UpdateChunks(), and DLS::Info::UpdateChunks().
void RIFF::List::DeleteSubChunk | ( | Chunk * | pSubChunk | ) |
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.
pSubChunk | - sub chunk or sub list chunk to be removed |
Definition at line 1203 of file RIFF.cpp.
References RIFF::Chunk::GetChunkID(), LoadSubChunks(), pSubChunks, and pSubChunksMap.
Referenced by DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().
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.
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 1169 of file RIFF.cpp.
References LoadSubChunks(), and pSubChunks.
Referenced by DLS::Instrument::MoveRegion().
void RIFF::List::ReadHeader | ( | unsigned long | fPos | ) | [protected] |
Reimplemented from RIFF::Chunk.
Definition at line 1221 of file RIFF.cpp.
References RIFF::File::bEndianNative, CHUNK_HEADER_SIZE, RIFF::Chunk::convertToString(), RIFF::Chunk::CurrentChunkSize, RIFF::File::hFileRead, ListType, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, and RIFF::Chunk::ReadHeader().
Referenced by RIFF::File::File(), and List().
void RIFF::List::WriteHeader | ( | unsigned long | fPos | ) | [protected] |
Reimplemented from RIFF::Chunk.
Definition at line 1246 of file RIFF.cpp.
References CHUNK_HEADER_SIZE, RIFF::File::hFileWrite, ListType, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, and RIFF::Chunk::WriteHeader().
Referenced by WriteChunk().
void RIFF::List::LoadSubChunks | ( | ) | [protected] |
Definition at line 1264 of file RIFF.cpp.
References CHUNK_HEADER_SIZE, CHUNK_ID_LIST, RIFF::Chunk::convertToString(), RIFF::Chunk::GetPos(), RIFF::Chunk::GetSize(), RIFF::File::hFileRead, LIST_HEADER_SIZE, RIFF::Chunk::pFile, pSubChunks, pSubChunksMap, RIFF::Chunk::Read(), RIFF::Chunk::RemainingBytes(), RIFF::Chunk::SetPos(), RIFF::stream_curpos, RIFF::Chunk::ulPos, and RIFF::Chunk::ulStartPos.
Referenced by AddSubChunk(), AddSubList(), CountSubChunks(), CountSubLists(), DeleteSubChunk(), GetFirstSubChunk(), GetFirstSubList(), GetSubChunk(), GetSubList(), and MoveSubChunk().
void RIFF::List::LoadSubChunksRecursively | ( | ) | [protected] |
Definition at line 1297 of file RIFF.cpp.
References GetFirstSubList(), and GetNextSubList().
Referenced by RIFF::File::Save().
unsigned long RIFF::List::WriteChunk | ( | unsigned long | ulWritePos, | |
unsigned long | ulCurrentDataOffset | |||
) | [protected, virtual] |
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.
ulWritePos | - position within the "physical" file where this list chunk should be written to | |
ulCurrentDataOffset | - offset of current (old) data within the file |
Reimplemented from RIFF::Chunk.
Definition at line 1316 of file RIFF.cpp.
References RIFF::Chunk::CurrentChunkSize, LIST_HEADER_SIZE, RIFF::File::Mode, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pFile, pSubChunks, RIFF::stream_mode_read_write, RIFF::Chunk::ulStartPos, and WriteHeader().
Referenced by RIFF::File::Save().
void RIFF::List::__resetPos | ( | ) | [protected, virtual] |
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 1340 of file RIFF.cpp.
References RIFF::Chunk::__resetPos(), and pSubChunks.
Referenced by RIFF::File::SetMode().
String RIFF::Chunk::GetChunkIDString | ( | ) | [inherited] |
Returns the String representation of the chunk's ID (e.g.
"RIFF", "LIST").
Definition at line 175 of file RIFF.cpp.
References RIFF::Chunk::ChunkID, and RIFF::Chunk::convertToString().
uint32_t RIFF::Chunk::GetChunkID | ( | ) | [inline, inherited] |
Definition at line 122 of file RIFF.h.
References RIFF::Chunk::ChunkID.
Referenced by DLS::Articulation::Articulation(), DeleteSubChunk(), DLS::Articulator::LoadArticulations(), and gig::File::LoadGroups().
List* RIFF::Chunk::GetParent | ( | ) | [inline, inherited] |
Chunk ID in unsigned integer representation.
Definition at line 123 of file RIFF.h.
References RIFF::Chunk::pParent.
Referenced by RIFF::__resolveChunkPath(), gig::Group::~Group(), DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().
unsigned long RIFF::Chunk::GetSize | ( | ) | [inline, inherited] |
Returns pointer to the chunk's parent list chunk.
Definition at line 124 of file RIFF.h.
References RIFF::Chunk::CurrentChunkSize.
Referenced by DLS::File::File(), DLS::Sample::GetSize(), RIFF::Chunk::LoadChunkData(), LoadSubChunks(), DLS::Sample::Sample(), RIFF::File::Save(), gig::DimensionRegion::UpdateChunks(), and DLS::Region::UpdateChunks().
unsigned long RIFF::Chunk::GetNewSize | ( | ) | [inline, inherited] |
Chunk size in bytes (without header, thus the chunk data body).
Definition at line 125 of file RIFF.h.
References RIFF::Chunk::NewChunkSize.
unsigned long RIFF::Chunk::GetPos | ( | ) | [inline, inherited] |
New chunk size if it was modified with Resize().
Definition at line 126 of file RIFF.h.
References RIFF::Chunk::ulPos.
Referenced by gig::Sample::GetPos(), and LoadSubChunks().
unsigned long RIFF::Chunk::GetFilePos | ( | ) | [inline, inherited] |
Position within the chunk data body.
Definition at line 127 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] |
Current, actual offset in file.
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.
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 191 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(), LoadSubChunks(), RIFF::Chunk::Read(), gig::Sample::Read(), gig::Region::Region(), gig::Sample::Sample(), DLS::Sampler::Sampler(), gig::Sample::SetPos(), DLS::Sample::SetPos(), and RIFF::Chunk::Write().
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.
Definition at line 223 of file RIFF.cpp.
References RIFF::Chunk::CurrentChunkSize, and RIFF::Chunk::ulPos.
Referenced by gig::DimensionRegion::DimensionRegion(), 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 241 of file RIFF.cpp.
References RIFF::Chunk::CurrentChunkSize, RIFF::File::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.
pData | destination buffer | |
WordCount | number of data words to read | |
WordSize | size of each data word to read |
Definition at line 272 of file RIFF.cpp.
References RIFF::File::bEndianNative, RIFF::Chunk::CurrentChunkSize, RIFF::File::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(), LoadSubChunks(), 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.
pData | destination buffer | |
WordCount | number of 8 Bit signed integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 396 of file RIFF.cpp.
References RIFF::Chunk::ReadSceptical().
Referenced by gig::DimensionRegion::DimensionRegion().
int8_t RIFF::Chunk::ReadInt8 | ( | ) | [inherited] |
Reads one 8 Bit signed integer word and increments the position within the chunk.
RIFF::Exception | if an error occured |
Definition at line 613 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.
pData | destination buffer | |
WordCount | number of 8 Bit unsigned integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 433 of file RIFF.cpp.
References RIFF::Chunk::ReadSceptical().
Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), and gig::Region::Region().
uint8_t RIFF::Chunk::ReadUint8 | ( | ) | [inherited] |
Reads one 8 Bit unsigned integer word and increments the position within the chunk.
RIFF::Exception | if an error occured |
Definition at line 629 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.
pData | destination buffer | |
WordCount | number of 16 Bit signed integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 470 of file RIFF.cpp.
References RIFF::Chunk::ReadSceptical().
Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), 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.
RIFF::Exception | if an error occured |
Definition at line 646 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.
pData | destination buffer | |
WordCount | number of 8 Bit unsigned integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 507 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.
RIFF::Exception | if an error occured |
Definition at line 663 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.
pData | destination buffer | |
WordCount | number of 32 Bit signed integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 544 of file RIFF.cpp.
References RIFF::Chunk::ReadSceptical().
Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), 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.
RIFF::Exception | if an error occured |
Definition at line 680 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.
pData | destination buffer | |
WordCount | number of 32 Bit unsigned integers to read |
RIFF::Exception | if an error occured or less than WordCount integers could be read! |
Definition at line 581 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.
RIFF::Exception | if an error occured |
Definition at line 697 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.
pData | source buffer (containing the data) | |
WordCount | number of data words to write | |
WordSize | size of each data word to write |
RIFF::Exception | if write operation would exceed current chunk size or any IO error occured |
Definition at line 329 of file RIFF.cpp.
References RIFF::File::bEndianNative, RIFF::Chunk::CurrentChunkSize, RIFF::File::hFileWrite, RIFF::File::Mode, RIFF::Chunk::pFile, RIFF::Chunk::SetPos(), RIFF::stream_curpos, 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 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.
pData | source buffer (containing the data) | |
WordCount | number of 8 Bit signed integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 417 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.
pData | source buffer (containing the data) | |
WordCount | number of 8 Bit unsigned integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 454 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.
pData | source buffer (containing the data) | |
WordCount | number of 16 Bit signed integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 491 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.
pData | source buffer (containing the data) | |
WordCount | number of 16 Bit unsigned integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 528 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.
pData | source buffer (containing the data) | |
WordCount | number of 32 Bit signed integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 565 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.
pData | source buffer (containing the data) | |
WordCount | number of 32 Bit unsigned integers to write |
RIFF::Exception | if an IO error occured |
Definition at line 602 of file RIFF.cpp.
References RIFF::Chunk::Write().
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.
Exception | if data buffer could not be enlarged |
Definition at line 727 of file RIFF.cpp.
References RIFF::Chunk::CurrentChunkSize, RIFF::File::Filename, RIFF::Chunk::GetSize(), RIFF::File::hFileRead, RIFF::Chunk::NewChunkSize, RIFF::Chunk::pChunkData, RIFF::Chunk::pFile, RIFF::Chunk::ulChunkDataSize, and RIFF::Chunk::ulStartPos.
Referenced by DLS::Sample::LoadSampleData(), 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::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 771 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!
iNewSize | - new chunk body size in bytes (must be greater than zero) |
RIFF::Exception | if iNewSize is less than 1 |
Definition at line 796 of file RIFF.cpp.
References RIFF::__resolveChunkPath(), RIFF::File::LogAsResized(), RIFF::Chunk::NewChunkSize, and RIFF::Chunk::pFile.
Referenced by AddSubChunk(), DLS::Sample::Resize(), DLS::File::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 379 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] |
void RIFF::Chunk::swapBytes_32 | ( | void * | Word | ) | [inline, protected, inherited] |
Definition at line 176 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] |
String RIFF::Chunk::convertToString | ( | uint32_t | word | ) | [inline, protected, inherited] |
Definition at line 193 of file RIFF.h.
Referenced by RIFF::Chunk::GetChunkIDString(), GetListTypeString(), LoadSubChunks(), ReadHeader(), and RIFF::Chunk::ReadHeader().
friend class List [friend, inherited] |
uint32_t RIFF::List::ListType [protected] |
Definition at line 233 of file RIFF.h.
Referenced by RIFF::File::File(), GetListType(), GetListTypeString(), List(), ReadHeader(), and WriteHeader().
ChunkList* RIFF::List::pSubChunks [protected] |
Definition at line 234 of file RIFF.h.
Referenced by __resetPos(), AddSubChunk(), AddSubList(), CountSubChunks(), CountSubLists(), DeleteSubChunk(), GetFirstSubChunk(), GetFirstSubList(), GetNextSubChunk(), GetNextSubList(), GetSubList(), List(), LoadSubChunks(), MoveSubChunk(), WriteChunk(), and ~List().
ChunkMap* RIFF::List::pSubChunksMap [protected] |
Definition at line 235 of file RIFF.h.
Referenced by DeleteSubChunk(), GetSubChunk(), List(), LoadSubChunks(), and ~List().
ChunkList::iterator RIFF::List::ChunksIterator [protected] |
ChunkList::iterator RIFF::List::ListIterator [protected] |
uint32_t RIFF::Chunk::ChunkID [protected, inherited] |
Definition at line 156 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), RIFF::File::File(), RIFF::Chunk::GetChunkID(), RIFF::Chunk::GetChunkIDString(), RIFF::Chunk::ReadHeader(), and RIFF::Chunk::WriteHeader().
uint32_t RIFF::Chunk::CurrentChunkSize [protected, inherited] |
Definition at line 157 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), RIFF::Chunk::GetSize(), RIFF::Chunk::GetState(), RIFF::Chunk::LoadChunkData(), RIFF::Chunk::Read(), ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::RemainingBytes(), RIFF::Chunk::SetPos(), RIFF::Chunk::Write(), WriteChunk(), RIFF::Chunk::WriteChunk(), and RIFF::Chunk::~Chunk().
uint32_t RIFF::Chunk::NewChunkSize [protected, inherited] |
Definition at line 158 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), RIFF::Chunk::GetNewSize(), RIFF::Chunk::LoadChunkData(), ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::Resize(), WriteChunk(), RIFF::Chunk::WriteChunk(), WriteHeader(), RIFF::Chunk::WriteHeader(), and RIFF::Chunk::~Chunk().
List* RIFF::Chunk::pParent [protected, inherited] |
Definition at line 159 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), and RIFF::Chunk::GetParent().
File* RIFF::Chunk::pFile [protected, inherited] |
Definition at line 160 of file RIFF.h.
Referenced by AddSubChunk(), AddSubList(), RIFF::Chunk::GetState(), RIFF::Chunk::LoadChunkData(), LoadSubChunks(), RIFF::Chunk::Read(), ReadHeader(), RIFF::Chunk::ReadHeader(), RIFF::Chunk::Resize(), RIFF::Chunk::Write(), WriteChunk(), RIFF::Chunk::WriteChunk(), WriteHeader(), RIFF::Chunk::WriteHeader(), and RIFF::Chunk::~Chunk().
unsigned long RIFF::Chunk::ulStartPos [protected, inherited] |
Definition at line 161 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), RIFF::File::File(), RIFF::Chunk::GetFilePos(), List(), RIFF::Chunk::LoadChunkData(), LoadSubChunks(), RIFF::Chunk::Read(), RIFF::Chunk::Write(), WriteChunk(), and RIFF::Chunk::WriteChunk().
unsigned long RIFF::Chunk::ulPos [protected, inherited] |
Definition at line 162 of file RIFF.h.
Referenced by RIFF::Chunk::__resetPos(), RIFF::Chunk::Chunk(), RIFF::Chunk::GetFilePos(), RIFF::Chunk::GetPos(), RIFF::Chunk::GetState(), LoadSubChunks(), RIFF::Chunk::Read(), RIFF::Chunk::RemainingBytes(), RIFF::File::Save(), RIFF::Chunk::SetPos(), RIFF::Chunk::Write(), and RIFF::Chunk::WriteChunk().
uint8_t* RIFF::Chunk::pChunkData [protected, inherited] |
Definition at line 163 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 164 of file RIFF.h.
Referenced by RIFF::Chunk::Chunk(), and RIFF::Chunk::LoadChunkData().