Midi Parser
A simple library that reads and parses binary MIDI files
BaseChunk Class Reference

A base class for any chunk. More...

#include <BaseChunk.h>

Inheritance diagram for BaseChunk:
HeaderChunk TrackChunk

Public Member Functions

 BaseChunk (const char *filePath, long addr)
 
 BaseChunk (const BaseChunk &chunk)
 
 ~BaseChunk ()
 
char * getName () const
 
int getLength () const
 
long getByteLength () const
 

Protected Attributes

char * name {}
 
uint32_t length {}
 
long byteLength {}
 

Detailed Description

A base class for any chunk.

Constructor & Destructor Documentation

◆ BaseChunk() [1/2]

BaseChunk::BaseChunk ( const char *  filePath,
long  addr 
)

Reads the Midi file and constructs the chunk object

Parameters
filePathA path to the file to read the chunk data from
addrAn address of the chunk in bytes

◆ BaseChunk() [2/2]

BaseChunk::BaseChunk ( const BaseChunk chunk)

Copies the chunk

Parameters
chunkChunk to copy from

◆ ~BaseChunk()

BaseChunk::~BaseChunk ( )

Destroys the chunk object

Member Function Documentation

◆ getByteLength()

long BaseChunk::getByteLength ( ) const

Returns the length of the chunk

Returns
Length of the chunk with name and length bytes included

◆ getLength()

int BaseChunk::getLength ( ) const

Returns the length of the chunk

Returns
Length of the chunk, excluding the name and the length itself

◆ getName()

char * BaseChunk::getName ( ) const

Returns the name of the chunk

Returns
A pointer to the chunk name. A name is always 4 characters long

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