libgig  4.4.1
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, file_offset_t StartPos, List *Parent)
 
String GetChunkIDString () const
 Returns the String representation of the chunk's ID (e.g. More...
 
uint32_t GetChunkID () const
 Chunk ID in unsigned integer representation.
 
FileGetFile () const
 Returns pointer to the chunk's File object.
 
ListGetParent () const
 Returns pointer to the chunk's parent list chunk.
 
file_offset_t GetSize () const
 Chunk size in bytes (without header, thus the chunk data body)
 
file_offset_t GetNewSize () const
 New chunk size if it was modified with Resize(), otherwise value returned will be equal to GetSize().
 
file_offset_t GetPos () const
 Current read/write position within the chunk data body (starting with 0). More...
 
file_offset_t GetFilePos () const
 Current, actual offset in file of current chunk data body read/write position. More...
 
file_offset_t SetPos (file_offset_t 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...
 
file_offset_t RemainingBytes () const
 Returns the number of bytes left to read in the chunk body. More...
 
stream_state_t GetState () const
 Returns the current state of the chunk object. More...
 
file_offset_t Read (void *pData, file_offset_t WordCount, file_offset_t WordSize)
 Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData. More...
 
file_offset_t ReadInt8 (int8_t *pData, file_offset_t WordCount=1)
 Reads WordCount number of 8 Bit signed integer words and copies it into the buffer pointed by pData. More...
 
file_offset_t ReadUint8 (uint8_t *pData, file_offset_t WordCount=1)
 Reads WordCount number of 8 Bit unsigned integer words and copies it into the buffer pointed by pData. More...
 
file_offset_t ReadInt16 (int16_t *pData, file_offset_t WordCount=1)
 Reads WordCount number of 16 Bit signed integer words and copies it into the buffer pointed by pData. More...
 
file_offset_t ReadUint16 (uint16_t *pData, file_offset_t WordCount=1)
 Reads WordCount number of 16 Bit unsigned integer words and copies it into the buffer pointed by pData. More...
 
file_offset_t ReadInt32 (int32_t *pData, file_offset_t WordCount=1)
 Reads WordCount number of 32 Bit signed integer words and copies it into the buffer pointed by pData. More...
 
file_offset_t ReadUint32 (uint32_t *pData, file_offset_t 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...
 
file_offset_t Write (void *pData, file_offset_t WordCount, file_offset_t WordSize)
 Writes WordCount number of data words with given WordSize from the buffer pointed by pData. More...
 
file_offset_t WriteInt8 (int8_t *pData, file_offset_t 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...
 
file_offset_t WriteUint8 (uint8_t *pData, file_offset_t 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...
 
file_offset_t WriteInt16 (int16_t *pData, file_offset_t 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...
 
file_offset_t WriteUint16 (uint16_t *pData, file_offset_t 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...
 
file_offset_t WriteInt32 (int32_t *pData, file_offset_t 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...
 
file_offset_t WriteUint32 (uint32_t *pData, file_offset_t 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 (file_offset_t NewSize)
 Resize chunk. More...
 

Protected Member Functions

 Chunk (File *pFile)
 
 Chunk (File *pFile, List *pParent, uint32_t uiChunkID, file_offset_t ullBodySize)
 
void ReadHeader (file_offset_t filePos)
 
void WriteHeader (file_offset_t filePos)
 
file_offset_t ReadSceptical (void *pData, file_offset_t WordCount, file_offset_t WordSize)
 Just an internal wrapper for the main Read() method with additional Exception throwing on errors. More...
 
virtual file_offset_t RequiredPhysicalSize (int fileOffsetSize)
 Returns the actual total size in bytes (including header) of this Chunk if being stored to a file. More...
 
virtual file_offset_t WriteChunk (file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t *pProgress=NULL)
 Write chunk persistently e.g. More...
 
virtual void __resetPos ()
 Sets Chunk's read/write position to zero.
 

Static Protected Member Functions

static String convertToString (uint32_t word)
 

Protected Attributes

uint32_t ChunkID
 
file_offset_t ullCurrentChunkSize
 
file_offset_t ullNewChunkSize
 
ListpParent
 
FilepFile
 
file_offset_t ullStartPos
 
uint8_t * pChunkData
 
file_offset_t ullChunkDataSize
 
struct RIFF::Chunk::ChunkPos chunkPos
 

Detailed Description

Ordinary RIFF Chunk.

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

Definition at line 179 of file RIFF.h.

Member Function Documentation

◆ GetChunkIDString()

String RIFF::Chunk::GetChunkIDString ( ) const

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

"RIFF", "LIST").

Definition at line 288 of file RIFF.cpp.

References RIFF::File::IsIOPerThread().

◆ GetFilePos()

file_offset_t RIFF::Chunk::GetFilePos ( ) const

Current, actual offset in file of current chunk data body read/write position.

See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 324 of file RIFF.cpp.

Referenced by DLS::File::__ensureMandatoryChunksExist(), gig::Instrument::DeleteMidiRule(), gig::File::DeleteSample(), and DLS::File::GetNextSample().

◆ GetPos()

◆ GetState()

stream_state_t RIFF::Chunk::GetState ( ) const

Returns the current state of the chunk object.

Following values are possible:

  • RIFF::stream_ready : chunk data can be read (this is the usual case)
  • RIFF::stream_closed : the data stream was closed somehow, no more reading possible
  • RIFF::stream_end_reached : already reached the end of the chunk data, no more reading possible without SetPos()
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 410 of file RIFF.cpp.

References RIFF::File::FileHandle().

◆ 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()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 960 of file RIFF.cpp.

References RIFF::File::FileHandle().

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

◆ Read()

file_offset_t RIFF::Chunk::Read ( void *  pData,
file_offset_t  WordCount,
file_offset_t  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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 441 of file RIFF.cpp.

References RIFF::File::FileHandle().

Referenced by DLS::Articulation::Articulation(), DLS::Resource::CopyAssign(), gig::Region::CopyAssign(), gig::File::DeleteSample(), RIFF::File::File(), DLS::File::File(), DLS::Instrument::Instrument(), Korg::KSFSample::Read(), DLS::Sample::Read(), gig::Sample::Read(), DLS::Resource::Resource(), gig::Sample::Sample(), DLS::Sample::UpdateChunks(), and DLS::File::UpdateChunks().

◆ ReadInt16() [1/2]

file_offset_t RIFF::Chunk::ReadInt16 ( int16_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 671 of file RIFF.cpp.

Referenced by DLS::Resource::CopyAssign(), gig::Region::CopyAssign(), gig::File::DeleteSample(), gig::ScriptGroup::DeleteScript(), gig::Sample::Sample(), and sf2::VerifySize().

◆ 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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 875 of file RIFF.cpp.

◆ ReadInt32() [1/2]

file_offset_t RIFF::Chunk::ReadInt32 ( int32_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 749 of file RIFF.cpp.

Referenced by DLS::Resource::CopyAssign(), gig::File::DeleteSample(), gig::ScriptGroup::DeleteScript(), gig::Sample::Sample(), and sf2::VerifySize().

◆ 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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 911 of file RIFF.cpp.

◆ ReadInt8() [1/2]

file_offset_t RIFF::Chunk::ReadInt8 ( int8_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 593 of file RIFF.cpp.

Referenced by Korg::KSFSample::FrameSize(), Korg::removeFileTypeExtension(), and sf2::VerifySize().

◆ 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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 840 of file RIFF.cpp.

◆ ReadSceptical()

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

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

Definition at line 575 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 occurred or less than size characters could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 806 of file RIFF.cpp.

Referenced by gig::Region::CopyAssign(), and gig::File::DeleteSample().

◆ ReadUint16() [1/2]

file_offset_t RIFF::Chunk::ReadUint16 ( uint16_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 710 of file RIFF.cpp.

Referenced by DLS::Resource::CopyAssign(), gig::Region::CopyAssign(), gig::ScriptGroup::DeleteScript(), DLS::Sample::UpdateChunks(), and sf2::VerifySize().

◆ 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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 893 of file RIFF.cpp.

◆ ReadUint32() [1/2]

file_offset_t RIFF::Chunk::ReadUint32 ( uint32_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 788 of file RIFF.cpp.

Referenced by DLS::Articulation::Articulation(), DLS::Resource::CopyAssign(), gig::Region::CopyAssign(), gig::ScriptGroup::DeleteScript(), DLS::File::File(), DLS::Instrument::Instrument(), Korg::removeFileTypeExtension(), gig::DimensionRegion::SetVCFVelocityScale(), and DLS::Sample::UpdateChunks().

◆ 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 occurred
See also
File::IsIOPerThread() for multi-threaded streamings

Definition at line 929 of file RIFF.cpp.

◆ ReadUint8() [1/2]

file_offset_t RIFF::Chunk::ReadUint8 ( uint8_t *  pData,
file_offset_t  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 occurred or less than WordCount integers could be read!
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 632 of file RIFF.cpp.

Referenced by gig::Region::CopyAssign(), gig::ScriptGroup::DeleteScript(), Korg::KSFSample::FrameSize(), Korg::removeFileTypeExtension(), gig::DimensionRegion::SetVCFVelocityScale(), 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 occurred
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 857 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 1009 of file RIFF.cpp.

Referenced by DLS::Sample::ReleaseSampleData(), and DLS::Sample::~Sample().

◆ RemainingBytes()

file_offset_t RIFF::Chunk::RemainingBytes ( ) const

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
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 376 of file RIFF.cpp.

Referenced by gig::Sample::Read(), DLS::Sample::UpdateChunks(), and gig::Sample::UpdateChunks().

◆ RequiredPhysicalSize()

file_offset_t RIFF::Chunk::RequiredPhysicalSize ( int  fileOffsetSize)
protectedvirtual

Returns the actual total size in bytes (including header) of this Chunk if being stored to a file.

Parameters
fileOffsetSize- RIFF file offset size (in bytes) assumed when being saved to a file

Reimplemented in RIFF::List.

Definition at line 391 of file RIFF.cpp.

◆ Resize()

void RIFF::Chunk::Resize ( file_offset_t  NewSize)

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
NewSize- new chunk body size in bytes (must be greater than zero)
Exceptions
RIFF::Exceptionif NewSize is less than 1 or unrealistic large
See also
File::Save()

Definition at line 1034 of file RIFF.cpp.

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

◆ SetPos()

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

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
See also
File::IsIOPerThread() for multi-threaded streaming

Definition at line 341 of file RIFF.cpp.

Referenced by DLS::File::__ensureMandatoryChunksExist(), DLS::Articulation::Articulation(), DLS::Resource::CopyAssign(), DLS::Sample::CopyAssign(), gig::Region::CopyAssign(), gig::File::DeleteSample(), gig::ScriptGroup::DeleteScript(), RIFF::File::File(), DLS::File::File(), DLS::Instrument::Instrument(), gig::Sample::Read(), DLS::Resource::Resource(), DLS::Sample::Sample(), gig::Sample::Sample(), Korg::KSFSample::SetPos(), DLS::Sample::SetPos(), gig::Sample::SetPos(), gig::File::SetSampleChecksum(), gig::DimensionRegion::SetVCFVelocityScale(), DLS::Sample::UpdateChunks(), gig::Sample::UpdateChunks(), gig::Instrument::UpdateChunks(), and sf2::VerifySize().

◆ Write()

file_offset_t RIFF::Chunk::Write ( void *  pData,
file_offset_t  WordCount,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 517 of file RIFF.cpp.

References RIFF::File::FileHandlePair().

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

◆ WriteChunk()

file_offset_t RIFF::Chunk::WriteChunk ( file_offset_t  ullWritePos,
file_offset_t  ullCurrentDataOffset,
progress_t pProgress = NULL 
)
protectedvirtual

Write chunk persistently e.g.

to disk.

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

Parameters
ullWritePos- position within the "physical" file where this chunk should be written to
ullCurrentDataOffset- 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 ullWritePos incremented by this chunk's new size (including its header size of course)
See also
File::IsIOPerThread() for multi-threaded streaming

Reimplemented in RIFF::List.

Definition at line 1057 of file RIFF.cpp.

References __resetPos(), RIFF::File::FileHandlePair(), and RIFF::File::FileOffsetSize.

◆ WriteInt16()

file_offset_t RIFF::Chunk::WriteInt16 ( int16_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 693 of file RIFF.cpp.

◆ WriteInt32()

file_offset_t RIFF::Chunk::WriteInt32 ( int32_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 771 of file RIFF.cpp.

◆ WriteInt8()

file_offset_t RIFF::Chunk::WriteInt8 ( int8_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 615 of file RIFF.cpp.

◆ WriteUint16()

file_offset_t RIFF::Chunk::WriteUint16 ( uint16_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 732 of file RIFF.cpp.

◆ WriteUint32()

file_offset_t RIFF::Chunk::WriteUint32 ( uint32_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 828 of file RIFF.cpp.

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

◆ WriteUint8()

file_offset_t RIFF::Chunk::WriteUint8 ( uint8_t *  pData,
file_offset_t  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 occurred
See also
Resize()
File::IsIOPerThread() for multi-threaded streaming

Definition at line 654 of file RIFF.cpp.


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