libgig  4.0.0
RIFF::Chunk Class Reference

Ordinary RIFF Chunk. More...

#include <RIFF.h>

Inheritance diagram for RIFF::Chunk:
RIFF::List RIFF::File

Public Member Functions

 Chunk (File *pFile, unsigned long StartPos, List *Parent)
 
String GetChunkIDString ()
 Returns the String representation of the chunk's ID (e.g. More...
 
uint32_t GetChunkID ()
 Chunk ID in unsigned integer representation. More...
 
FileGetFile ()
 Returns pointer to the chunk's File object. More...
 
ListGetParent ()
 Returns pointer to the chunk's parent list chunk. More...
 
unsigned long GetSize () const
 Chunk size in bytes (without header, thus the chunk data body) More...
 
unsigned long GetNewSize ()
 New chunk size if it was modified with Resize(). More...
 
unsigned long GetPos ()
 Position within the chunk data body. More...
 
unsigned long GetFilePos ()
 Current, actual offset in file. More...
 
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). More...
 
unsigned long RemainingBytes ()
 Returns the number of bytes left to read in the chunk body. More...
 
stream_state_t GetState ()
 Returns the current state of the chunk object. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int8_t ReadInt8 ()
 Reads one 8 Bit signed integer word and increments the position within the chunk. More...
 
uint8_t ReadUint8 ()
 Reads one 8 Bit unsigned integer word and increments the position within the chunk. More...
 
int16_t ReadInt16 ()
 Reads one 16 Bit signed integer word and increments the position within the chunk. More...
 
uint16_t ReadUint16 ()
 Reads one 16 Bit unsigned integer word and increments the position within the chunk. More...
 
int32_t ReadInt32 ()
 Reads one 32 Bit signed integer word and increments the position within the chunk. More...
 
uint32_t ReadUint32 ()
 Reads one 32 Bit unsigned integer word and increments the position within the chunk. More...
 
void ReadString (String &s, int size)
 Reads a null-padded string of size characters and copies it into the string s. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void * LoadChunkData ()
 Load chunk body into RAM. More...
 
void ReleaseChunkData ()
 Free loaded chunk body from RAM. More...
 
void Resize (int iNewSize)
 Resize chunk. More...
 
virtual ~Chunk ()
 

Protected Member Functions

 Chunk (File *pFile)
 
 Chunk (File *pFile, List *pParent, uint32_t uiChunkID, uint uiBodySize)
 
void ReadHeader (unsigned long fPos)
 
void WriteHeader (unsigned long fPos)
 
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. More...
 
void swapBytes_16 (void *Word)
 
void swapBytes_32 (void *Word)
 
void swapBytes (void *Word, unsigned long WordSize)
 
String convertToString (uint32_t word)
 
virtual unsigned long WriteChunk (unsigned long ulWritePos, unsigned long ulCurrentDataOffset, progress_t *pProgress=NULL)
 Write chunk persistently e.g. More...
 
virtual void __resetPos ()
 Sets Chunk's read/write position to zero. More...
 

Protected Attributes

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 List
 

Detailed Description

Ordinary RIFF Chunk.

Provides convenient methods to access data of ordinary RIFF chunks in general.

Definition at line 205 of file RIFF.h.

Constructor & Destructor Documentation

§ Chunk() [1/3]

RIFF::Chunk::Chunk ( File pFile,
unsigned long  StartPos,
List Parent 
)

Definition at line 86 of file RIFF.cpp.

References CHUNK_HEADER_SIZE.

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

§ ~Chunk()

RIFF::Chunk::~Chunk ( )
virtual

Definition at line 113 of file RIFF.cpp.

§ Chunk() [2/3]

RIFF::Chunk::Chunk ( File pFile)
protected

Definition at line 72 of file RIFF.cpp.

References CHUNK_ID_RIFF.

§ Chunk() [3/3]

RIFF::Chunk::Chunk ( File pFile,
List pParent,
uint32_t  uiChunkID,
uint  uiBodySize 
)
protected

Definition at line 101 of file RIFF.cpp.

Member Function Documentation

§ __resetPos()

void RIFF::Chunk::__resetPos ( )
protectedvirtual

Sets Chunk's read/write position to zero.

Reimplemented in RIFF::List.

Definition at line 956 of file RIFF.cpp.

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

§ convertToString()

String RIFF::Chunk::convertToString ( uint32_t  word)
inlineprotected

§ GetChunkID()

uint32_t RIFF::Chunk::GetChunkID ( )
inline

§ GetChunkIDString()

String RIFF::Chunk::GetChunkIDString ( )

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

"RIFF", "LIST").

Definition at line 199 of file RIFF.cpp.

§ GetFile()

File* RIFF::Chunk::GetFile ( )
inline

Returns pointer to the chunk's File object.

Definition at line 210 of file RIFF.h.

Referenced by Korg::KMPRegion::FullSampleFileName().

§ GetFilePos()

unsigned long RIFF::Chunk::GetFilePos ( )
inline

Current, actual offset in file.

Definition at line 215 of file RIFF.h.

References RIFF::stream_start.

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

§ GetNewSize()

unsigned long RIFF::Chunk::GetNewSize ( )
inline

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

Definition at line 213 of file RIFF.h.

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

§ GetParent()

List* RIFF::Chunk::GetParent ( )
inline

Returns pointer to the chunk's parent list chunk.

Definition at line 211 of file RIFF.h.

Referenced by gig::ScriptGroup::DeleteScript(), gig::File::DeleteScriptGroup(), DLS::Instrument::~Instrument(), DLS::Region::~Region(), and DLS::Sample::~Sample().

§ GetPos()

§ GetSize()

§ GetState()

stream_state_t RIFF::Chunk::GetState ( )

Returns the current state of the chunk object.

Following values are possible:

Definition at line 265 of file RIFF.cpp.

References RIFF::stream_closed, RIFF::stream_end_reached, and RIFF::stream_ready.

§ LoadChunkData()

void * RIFF::Chunk::LoadChunkData ( )

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
Exceptionif data buffer could not be enlarged
See also
ReleaseChunkData()

Definition at line 774 of file RIFF.cpp.

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

§ Read()

unsigned long RIFF::Chunk::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.

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
pDatadestination buffer
WordCountnumber of data words to read
WordSizesize 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 296 of file RIFF.cpp.

References RIFF::stream_curpos.

Referenced by DLS::Articulation::Articulation(), gig::DimensionRegion::DimensionRegion(), RIFF::File::File(), DLS::File::File(), DLS::Instrument::Instrument(), RIFF::List::LoadSubChunks(), gig::MidiRuleAlternator::MidiRuleAlternator(), Korg::KSFSample::Read(), DLS::Sample::Read(), gig::Sample::Read(), sf2::ReadSample(), Korg::readText(), DLS::Region::Region(), DLS::Resource::Resource(), gig::Sample::Sample(), and DLS::Sampler::Sampler().

§ ReadHeader()

void RIFF::Chunk::ReadHeader ( unsigned long  fPos)
protected

Definition at line 118 of file RIFF.cpp.

References CHUNK_ID_RIFF, and CHUNK_ID_RIFX.

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

§ ReadInt16() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 16 Bit signed integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 500 of file RIFF.cpp.

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

§ ReadInt16() [2/2]

int16_t RIFF::Chunk::ReadInt16 ( )

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::Exceptionif an error occured

Definition at line 693 of file RIFF.cpp.

§ ReadInt32() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 32 Bit signed integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 574 of file RIFF.cpp.

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

§ ReadInt32() [2/2]

int32_t RIFF::Chunk::ReadInt32 ( )

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::Exceptionif an error occured

Definition at line 727 of file RIFF.cpp.

§ ReadInt8() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 8 Bit signed integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 426 of file RIFF.cpp.

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

§ ReadInt8() [2/2]

int8_t RIFF::Chunk::ReadInt8 ( )

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

Returns
read integer word
Exceptions
RIFF::Exceptionif an error occured

Definition at line 660 of file RIFF.cpp.

§ ReadSceptical()

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

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

Definition at line 409 of file RIFF.cpp.

§ ReadString()

void RIFF::Chunk::ReadString ( String s,
int  size 
)

Reads a null-padded string of size characters and copies it into the string s.

The position within the chunk will automatically be incremented.

Parameters
sdestination string
sizenumber of characters to read
Exceptions
RIFF::Exceptionif an error occured or less than size characters could be read!

Definition at line 628 of file RIFF.cpp.

Referenced by gig::MidiRuleAlternator::MidiRuleAlternator().

§ ReadUint16() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 8 Bit unsigned integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 537 of file RIFF.cpp.

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

§ ReadUint16() [2/2]

uint16_t RIFF::Chunk::ReadUint16 ( )

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::Exceptionif an error occured

Definition at line 710 of file RIFF.cpp.

§ ReadUint32() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 32 Bit unsigned integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 611 of file RIFF.cpp.

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

§ ReadUint32() [2/2]

uint32_t RIFF::Chunk::ReadUint32 ( )

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::Exceptionif an error occured

Definition at line 744 of file RIFF.cpp.

§ ReadUint8() [1/2]

unsigned long RIFF::Chunk::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.

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

Parameters
pDatadestination buffer
WordCountnumber of 8 Bit unsigned integers to read
Returns
number of read integers
Exceptions
RIFF::Exceptionif an error occured or less than WordCount integers could be read!

Definition at line 463 of file RIFF.cpp.

Referenced by gig::DimensionRegion::DimensionRegion(), gig::Instrument::Instrument(), Korg::KMPInstrument::KMPInstrument(), Korg::KMPRegion::KMPRegion(), Korg::KSFSample::KSFSample(), gig::MidiRuleAlternator::MidiRuleAlternator(), gig::MidiRuleCtrlTrigger::MidiRuleCtrlTrigger(), gig::MidiRuleLegato::MidiRuleLegato(), gig::Region::Region(), gig::Script::Script(), and gig::Sample::UpdateChunks().

§ ReadUint8() [2/2]

uint8_t RIFF::Chunk::ReadUint8 ( )

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

Returns
read integer word
Exceptions
RIFF::Exceptionif an error occured

Definition at line 676 of file RIFF.cpp.

§ ReleaseChunkData()

void RIFF::Chunk::ReleaseChunkData ( )

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 818 of file RIFF.cpp.

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

§ RemainingBytes()

unsigned long RIFF::Chunk::RemainingBytes ( )

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 247 of file RIFF.cpp.

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

§ Resize()

void RIFF::Chunk::Resize ( int  iNewSize)

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::Exceptionif iNewSize is less than 1
See also
File::Save()

Definition at line 843 of file RIFF.cpp.

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

§ SetPos()

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

§ swapBytes()

void RIFF::Chunk::swapBytes ( void *  Word,
unsigned long  WordSize 
)
inlineprotected

Definition at line 273 of file RIFF.h.

§ swapBytes_16()

void RIFF::Chunk::swapBytes_16 ( void *  Word)
inlineprotected

Definition at line 260 of file RIFF.h.

§ swapBytes_32()

void RIFF::Chunk::swapBytes_32 ( void *  Word)
inlineprotected

Definition at line 265 of file RIFF.h.

§ Write()

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

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
pDatasource buffer (containing the data)
WordCountnumber of data words to write
WordSizesize of each data word to write
Returns
number of successfully written data words
Exceptions
RIFF::Exceptionif write operation would exceed current chunk size or any IO error occured
See also
Resize()

Definition at line 359 of file RIFF.cpp.

References RIFF::stream_curpos, and RIFF::stream_mode_read_write.

Referenced by DLS::Sample::Write(), and gig::Sample::Write().

§ WriteChunk()

unsigned long RIFF::Chunk::WriteChunk ( unsigned long  ulWritePos,
unsigned long  ulCurrentDataOffset,
progress_t pProgress = NULL 
)
protectedvirtual

Write chunk persistently e.g.

to disk.

Stores the chunk persistently to its actual "physical" file.

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

Reimplemented in RIFF::List.

Definition at line 864 of file RIFF.cpp.

References CHUNK_HEADER_SIZE, and RIFF::stream_mode_read_write.

§ WriteHeader()

void RIFF::Chunk::WriteHeader ( unsigned long  fPos)
protected

Definition at line 161 of file RIFF.cpp.

References CHUNK_ID_RIFF, and CHUNK_ID_RIFX.

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

§ WriteInt16()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 16 Bit signed integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 521 of file RIFF.cpp.

§ WriteInt32()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 32 Bit signed integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 595 of file RIFF.cpp.

§ WriteInt8()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 8 Bit signed integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 447 of file RIFF.cpp.

§ WriteUint16()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 16 Bit unsigned integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 558 of file RIFF.cpp.

§ WriteUint32()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 32 Bit unsigned integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 649 of file RIFF.cpp.

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::File::SetSampleChecksum(), and gig::Instrument::UpdateScriptFileOffsets().

§ WriteUint8()

unsigned long RIFF::Chunk::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.

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
pDatasource buffer (containing the data)
WordCountnumber of 8 Bit unsigned integers to write
Returns
number of written integers
Exceptions
RIFF::Exceptionif an IO error occured
See also
Resize()

Definition at line 484 of file RIFF.cpp.

Friends And Related Function Documentation

§ List

friend class List
friend

Definition at line 294 of file RIFF.h.

Member Data Documentation

§ ChunkID

uint32_t RIFF::Chunk::ChunkID
protected

Definition at line 245 of file RIFF.h.

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

§ CurrentChunkSize

uint32_t RIFF::Chunk::CurrentChunkSize
protected

Definition at line 246 of file RIFF.h.

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

§ NewChunkSize

uint32_t RIFF::Chunk::NewChunkSize
protected

§ pChunkData

uint8_t* RIFF::Chunk::pChunkData
protected

Definition at line 252 of file RIFF.h.

§ pFile

§ pParent

List* RIFF::Chunk::pParent
protected

Definition at line 248 of file RIFF.h.

§ ulChunkDataSize

unsigned long RIFF::Chunk::ulChunkDataSize
protected

Definition at line 253 of file RIFF.h.

§ ulPos

unsigned long RIFF::Chunk::ulPos
protected

Definition at line 251 of file RIFF.h.

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

§ ulStartPos

unsigned long RIFF::Chunk::ulStartPos
protected

The documentation for this class was generated from the following files: