libdmf  0.0.1
A library for processing Deflemask (dmf) files
libdmf.h File Reference

Main library file. More...

#include <stdlib.h>
Include dependency graph for libdmf.h:

Go to the source code of this file.

Classes

struct  FM_operator
 
struct  instrument
 
struct  wavetable
 
struct  note_command
 
struct  note_row
 
struct  note_channel
 
struct  sample
 
struct  dmf
 

Macros

#define MAX_DMF_SIZE   16777216
 The maximum size (in bytes) of the decompressed DMF.
 
#define SYSTEM_GENESIS   0x02
 (SYSTEM_TOTAL_CHANNELS 10)
 
#define SYSTEM_GENESIS_EXT_CH3   0x12
 (SYSTEM_TOTAL_CHANNELS 13)
 
#define SYSTEM_SMS   0x03
 (SYSTEM_TOTAL_CHANNELS 4)
 
#define SYSTEM_GAMEBOY   0x04
 (SYSTEM_TOTAL_CHANNELS 4)
 
#define SYSTEM_PCENGINE   0x05
 (SYSTEM_TOTAL_CHANNELS 6)
 
#define SYSTEM_NES   0x06
 (SYSTEM_TOTAL_CHANNELS 5)
 
#define SYSTEM_C64_SID_8580   0x07
 (SYSTEM_TOTAL_CHANNELS 3)
 
#define SYSTEM_C64_SID_6581   0x47
 (SYSTEM_TOTAL_CHANNELS 3) Supposed to be 0x17 was 71
 
#define SYSTEM_YM2151   0x08
 (SYSTEM_TOTAL_CHANNELS 13)
 
#define REIGON_PAL   0x00
 The PAL Reigon. (Perfection At Last)
 
#define REIGON_NTSC   0x01
 The NTSC Reigon. (Never The Same Colour)
 
#define MODE_STD   0x00
 Standard mode.
 
#define MODE_FM   0x01
 Frequency Modulation mode.
 

Functions

int openDmfFileIntoBuffer (char *filename, unsigned char *dest, size_t *length)
 Use a filename to open a file into a memory buffer. More...
 
int decompressDMF (unsigned char *src, size_t src_length, unsigned char *dest)
 Takes buffer from openDmfFileIntoBuffer() and decompresses it using miniz.h. More...
 
int openDMF (char *filename, unsigned char *dest)
 A combination of openDmfFileIntoBuffer() and decompressDMF() More...
 
int parseDMF (unsigned char *decompressed_dmf, dmf *dest)
 Parse an uncompressed buffer into the dmf type. More...
 
int fileToDmfType (char *filename, dmf *dest)
 A combination of openDMF() and parseDMF(). Takes a file and puts it int the dmf type. More...
 
int dmfToBuffer (dmf src, unsigned char *dest, size_t *size)
 The opposite of parseDMF(). Converts dmf type to uncompressed dmf file. More...
 
int compressDMF (const unsigned char *src, size_t src_length, unsigned char *dest, size_t *dest_length)
 The opposite of decompressDMF(). Converts an uncompressed buffer to a compressed buffer. More...
 
int writeDMF (char *filename, dmf src)
 A combination of compressDMF() and dmfToBuffer(). Converts dmf type to compressed buffer and writes it to file. More...
 
void displayDMF (dmf song)
 Print out everything to do with a dmf. More...
 
int verifyDMF (char *filename)
 Verify a DMF's integrety (or for that matter libdmf's :/) More...
 
int freeDMF (dmf *src)
 Free a DMF's resources. More...
 

Detailed Description

Main library file.

Function Documentation

◆ compressDMF()

int compressDMF ( const unsigned char *  src,
size_t  src_length,
unsigned char *  dest,
size_t *  dest_length 
)

The opposite of decompressDMF(). Converts an uncompressed buffer to a compressed buffer.

Parameters
srcThe source buffer.
src_lengthThe length of the source buffer
destdestination buffer.
dest_lengthA variable that gets filled with the size of the destination buffer.

◆ decompressDMF()

int decompressDMF ( unsigned char *  src,
size_t  src_length,
unsigned char *  dest 
)

Takes buffer from openDmfFileIntoBuffer() and decompresses it using miniz.h.

Parameters
srcThe source buffer.
src_lengthThe length of the source buffer.
destA destination buffers.

◆ displayDMF()

void displayDMF ( dmf  song)

Print out everything to do with a dmf.

Parameters
songthe dmf to print

◆ dmfToBuffer()

int dmfToBuffer ( dmf  src,
unsigned char *  dest,
size_t *  size 
)

The opposite of parseDMF(). Converts dmf type to uncompressed dmf file.

Parameters
srcThe source dmf
destdestination buffer.
sizeA variable that gets filled with the size of the destination.

◆ fileToDmfType()

int fileToDmfType ( char *  filename,
dmf dest 
)

A combination of openDMF() and parseDMF(). Takes a file and puts it int the dmf type.

Parameters
filenameThe path to the file to open.
destdestination dmf.

◆ freeDMF()

int freeDMF ( dmf src)

Free a DMF's resources.

Parameters
srcSource DMF.

◆ openDMF()

int openDMF ( char *  filename,
unsigned char *  dest 
)

A combination of openDmfFileIntoBuffer() and decompressDMF()

Parameters
filenameThe path to the file to open.
destThe destination buffer.

◆ openDmfFileIntoBuffer()

int openDmfFileIntoBuffer ( char *  filename,
unsigned char *  dest,
size_t *  length 
)

Use a filename to open a file into a memory buffer.

Parameters
filenameThe path to the file to open.
destThe buffer write to.
lengthA variable that gets filled with the size of the destination.

◆ parseDMF()

int parseDMF ( unsigned char *  decompressed_dmf,
dmf dest 
)

Parse an uncompressed buffer into the dmf type.

Parameters
decompressed_dmfuncompressed buffer to use as input.
destdestination dmf.

◆ verifyDMF()

int verifyDMF ( char *  filename)

Verify a DMF's integrety (or for that matter libdmf's :/)

Parameters
filenameThe path to open, verify and close.

◆ writeDMF()

int writeDMF ( char *  filename,
dmf  src 
)

A combination of compressDMF() and dmfToBuffer(). Converts dmf type to compressed buffer and writes it to file.

Parameters
filenameThe path of the file to write to.
srcThe source dmf.