Isle
Loading...
Searching...
No Matches
MXIOINFO Class Reference

[AI] A wrapper for low-level file I/O, abstracting MMIOINFO functionality, and providing additional buffer and chunk management geared toward wave and RIFF file manipulation. More...

#include <mxio.h>

Public Member Functions

 MXIOINFO ()
 [AI] Constructs a new MXIOINFO instance and initializes all struct members to zero. More...
 
 ~MXIOINFO ()
 [AI] Destructor, closes the file and releases all memory associated with buffers if necessary. More...
 
MxU16 Open (const char *p_filename, MxULong p_flags)
 [AI] Opens a file for buffered/unbuffered I/O, initializing MMIOINFO and (optionally) internal buffer based on flags. More...
 
MxU16 Close (MxLong p_unused)
 [AI] Closes the file and releases its resources, including buffer memory if owned. More...
 
MxLong Read (void *p_buf, MxLong p_len)
 [AI] Reads a number of bytes from the file or buffer into the destination buffer. More...
 
MxLong Write (void *p_buf, MxLong p_len)
 [AI] Writes data to the file or internal buffer. More...
 
MxLong Seek (MxLong p_offset, MxLong p_origin)
 [AI] Seeks to a specific position in the file (or file buffer). More...
 
MxU16 SetBuffer (char *p_buf, MxLong p_len, MxLong p_unused)
 [AI] Changes the buffer used for internal I/O (applies and releases old buffer if owned). More...
 
MxU16 Flush (MxU16 p_unused)
 [AI] Flushes contents of the buffer to disk if necessary (e.g., if data is dirty). More...
 
MxU16 Advance (MxU16 p_option)
 [AI] Advances the buffer state for reading/writing the next block, committing dirty writes and loading/refreshing as necessary. More...
 
MxU16 Descend (MMCKINFO *p_chunkInfo, const MMCKINFO *p_parentInfo, MxU16 p_descend)
 [AI] Descends into a specific RIFF or LIST chunk in a hierarchical file, reading chunk headers and updating MMCKINFO accordingly. More...
 
MxU16 Ascend (MMCKINFO *p_chunkInfo, MxU16 p_ascend)
 [AI] Ascends from a chunk in a hierarchical file, correcting chunk size and finishing the chunk correctly. More...
 
MxU16 CreateChunk (MMCKINFO *p_chunkInfo, MxU16 p_create)
 [AI] Creates a new hierarchical chunk (RIFF or LIST or other type), writing initial chunk header. More...
 

Public Attributes

MMIOINFO m_info
 [AI] Underlying MMIOINFO structure used for buffered and low-level file I/O. More...
 
HFILE m_file
 [AI] File handle used when MMIOINFO is not used as a file (HFILE abstraction). More...
 

Detailed Description

[AI] A wrapper for low-level file I/O, abstracting MMIOINFO functionality, and providing additional buffer and chunk management geared toward wave and RIFF file manipulation.

[AI] MXIOINFO manages opening, reading, writing, seeking, and closing files at a low level, optionally using an internal buffer for efficiency. It also provides chunk-based access, suitable for managing hierarchical file formats like RIFF (common for audio/video assets). This class also manages chunk and pad byte considerations when traversing file structures.

Definition at line 22 of file mxio.h.

Constructor & Destructor Documentation

◆ MXIOINFO()

MXIOINFO::MXIOINFO ( )

[AI] Constructs a new MXIOINFO instance and initializes all struct members to zero.

Definition at line 24 of file mxio.cpp.

◆ ~MXIOINFO()

MXIOINFO::~MXIOINFO ( )

[AI] Destructor, closes the file and releases all memory associated with buffers if necessary.

Definition at line 31 of file mxio.cpp.

Member Function Documentation

◆ Advance()

MxU16 MXIOINFO::Advance ( MxU16  p_option)

[AI] Advances the buffer state for reading/writing the next block, committing dirty writes and loading/refreshing as necessary.

Parameters
p_optionIndicates MMIO_READ or MMIO_WRITE operation. [AI]
Returns
MMSYSERR_NOERROR on success. [AI]

Definition at line 390 of file mxio.cpp.

◆ Ascend()

MxU16 MXIOINFO::Ascend ( MMCKINFO *  p_chunkInfo,
MxU16  p_ascend 
)

[AI] Ascends from a chunk in a hierarchical file, correcting chunk size and finishing the chunk correctly.

Parameters
p_chunkInfoChunk structure to ascend out from (also receives size fixup). [AI]
p_ascendNot used; reserved for future/protocol compatibility. [AI]
Returns
MMSYSERR_NOERROR on success. [AI]

Definition at line 553 of file mxio.cpp.

◆ Close()

MxU16 MXIOINFO::Close ( MxLong  p_unused)

[AI] Closes the file and releases its resources, including buffer memory if owned.

Parameters
p_unusedReserved/ignored. [AI]
Returns
MMSYSERR_NOERROR on success. [AI]

Definition at line 85 of file mxio.cpp.

◆ CreateChunk()

MxU16 MXIOINFO::CreateChunk ( MMCKINFO *  p_chunkInfo,
MxU16  p_create 
)

[AI] Creates a new hierarchical chunk (RIFF or LIST or other type), writing initial chunk header.

Parameters
p_chunkInfoChunk structure to initialize. [AI]
p_createMMIO_CREATERIFF, MMIO_CREATELIST, or default. [AI]
Returns
MMSYSERR_NOERROR on success. [AI]

Definition at line 617 of file mxio.cpp.

◆ Descend()

MxU16 MXIOINFO::Descend ( MMCKINFO *  p_chunkInfo,
const MMCKINFO *  p_parentInfo,
MxU16  p_descend 
)

[AI] Descends into a specific RIFF or LIST chunk in a hierarchical file, reading chunk headers and updating MMCKINFO accordingly.

Parameters
p_chunkInfoThe chunk information structure to fill. [AI]
p_parentInfoThe parent chunk, or NULL for top-level. [AI]
p_descendMMIO_FINDLIST, MMIO_FINDRIFF, or 0 for untyped. [AI]
Returns
Status code; MMIOERR_CANNOTREAD, MMIOERR_CHUNKNOTFOUND, or success. [AI]

Definition at line 464 of file mxio.cpp.

◆ Flush()

MxU16 MXIOINFO::Flush ( MxU16  p_unused)

[AI] Flushes contents of the buffer to disk if necessary (e.g., if data is dirty).

Parameters
p_unusedIgnored. [AI]
Returns
Status code; MMIOERR_CANNOTWRITE if a write failed. [AI]

Definition at line 338 of file mxio.cpp.

◆ Open()

MxU16 MXIOINFO::Open ( const char *  p_filename,
MxULong  p_flags 
)

[AI] Opens a file for buffered/unbuffered I/O, initializing MMIOINFO and (optionally) internal buffer based on flags.

Parameters
p_filenameThe filename (path) to open. [AI]
p_flagsFlags determining mode (MMIO_ALLOCBUF, MMIO_READ, MMIO_WRITE, etc). [AI]
Returns
MMIOERR_CANNOTOPEN (failed) or MMSYSERR_NOERROR (success). [AI]

Definition at line 38 of file mxio.cpp.

◆ Read()

MxLong MXIOINFO::Read ( void *  p_buf,
MxLong  p_len 
)

[AI] Reads a number of bytes from the file or buffer into the destination buffer.

Parameters
p_bufPointer to the buffer to read data into. [AI]
p_lenNumber of bytes to read. [AI]
Returns
The number of bytes actually read; 0 on error or end of file. [AI]

Definition at line 107 of file mxio.cpp.

◆ Seek()

MxLong MXIOINFO::Seek ( MxLong  p_offset,
MxLong  p_origin 
)

[AI] Seeks to a specific position in the file (or file buffer).

Parameters
p_offsetByte offset to seek to (absolute or relative as determined by p_origin). [AI]
p_originOne of SEEK_SET/SEEK_CUR/SEEK_END. [AI]
Returns
The resulting absolute file position, or -1 on failure. [AI]

Definition at line 215 of file mxio.cpp.

◆ SetBuffer()

MxU16 MXIOINFO::SetBuffer ( char *  p_buf,
MxLong  p_len,
MxLong  p_unused 
)

[AI] Changes the buffer used for internal I/O (applies and releases old buffer if owned).

Parameters
p_bufPointer to new buffer. [AI]
p_lenLength of buffer, in bytes. [AI]
p_unusedIgnored. [AI]
Returns
MMSYSERR_NOERROR on success. [AI]

Definition at line 318 of file mxio.cpp.

◆ Write()

MxLong MXIOINFO::Write ( void *  p_buf,
MxLong  p_len 
)

[AI] Writes data to the file or internal buffer.

Parameters
p_bufBuffer containing data to write. [AI]
p_lenNumber of bytes to write. [AI]
Returns
The number of bytes actually written, or 0 on error. [AI]

Definition at line 157 of file mxio.cpp.

Member Data Documentation

◆ m_file

HFILE MXIOINFO::m_file

[AI] File handle used when MMIOINFO is not used as a file (HFILE abstraction).

Definition at line 131 of file mxio.h.

◆ m_info

MMIOINFO MXIOINFO::m_info

[AI] Underlying MMIOINFO structure used for buffered and low-level file I/O.

[AI] In MXIOINFO, 'hmmio' (in MMIOINFO) is used as an HFILE rather than an HMMIO, supporting custom I/O operations.

Definition at line 125 of file mxio.h.


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