11 #ifndef _DMF_PARSER_H_    12 #define _DMF_PARSER_H_    16 #define MAX_DMF_SIZE           16777216     19 #define SYSTEM_GENESIS         0x02     20 #define SYSTEM_GENESIS_EXT_CH3 0x12     21 #define SYSTEM_SMS             0x03     22 #define SYSTEM_GAMEBOY         0x04     23 #define SYSTEM_PCENGINE        0x05     24 #define SYSTEM_NES             0x06     25 #define SYSTEM_C64_SID_8580    0x07     26 #define SYSTEM_C64_SID_6581    0x47     27 #define SYSTEM_YM2151          0x08     29 #define REIGON_PAL             0x00     30 #define REIGON_NTSC            0x01     77             unsigned int *volume_envelope; 
   236 int decompressDMF(
unsigned char *src, 
size_t src_length, 
unsigned char *dest);
   244 int openDMF(
char *filename, 
unsigned char *dest);
   251 int parseDMF(
unsigned char *decompressed_dmf, 
dmf *dest);
   274 int compressDMF(
const unsigned char *src, 
size_t src_length, 
unsigned char *dest, 
size_t *dest_length);
   309 #endif // _DMF_PARSER_H_ unsigned char c64_decay
C64 shite, see the name of this member. 
Definition: libdmf.h:106
 
unsigned int size
The size of the sample in unsigned ints. 
Definition: libdmf.h:171
 
unsigned int * wavetable_envelope
Actual wavetable envelope. 
Definition: libdmf.h:96
 
unsigned int * data
Array of ints containing the wavetable data. 
Definition: libdmf.h:135
 
unsigned char c64_filter_ch2_off
C64 shite, see the name of this member. 
Definition: libdmf.h:121
 
wavetable * wavetables
The wavetable data. 
Definition: libdmf.h:220
 
unsigned char gb_envelope_length
GB shite, see the name of this member. 
Definition: libdmf.h:125
 
unsigned char c64_pulse_wave_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:103
 
unsigned char volume_envelope_size
Definition: libdmf.h:76
 
int fileToDmfType(char *filename, dmf *dest)
A combination of openDMF() and parseDMF(). Takes a file and puts it int the dmf type. 
Definition: dmfParser.c:353
 
unsigned char wavetable_envelope_size
Size of the wavetable envelope. Ranges from [0 - 127]. 
Definition: libdmf.h:95
 
unsigned char c64_filter_resonance
C64 shite, see the name of this member. 
Definition: libdmf.h:116
 
int parseDMF(unsigned char *decompressed_dmf, dmf *dest)
Parse an uncompressed buffer into the dmf type. 
Definition: dmfParser.c:56
 
signed short code
The command for a row. 
Definition: libdmf.h:143
 
unsigned char c64_ring_modulation_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:110
 
unsigned char LFO2
Low Frequency Oscillator 2 (AMS on YM2612, AMS on YM2151) 
Definition: libdmf.h:66
 
int writeDMF(char *filename, dmf src)
A combination of compressDMF() and dmfToBuffer(). Converts dmf type to compressed buffer and writes i...
Definition: dmfParser.c:659
 
int openDMF(char *filename, unsigned char *dest)
A combination of openDmfFileIntoBuffer() and decompressDMF() 
Definition: dmfParser.c:41
 
unsigned char c64_use_filter_values_from_instrument
C64 shite, see the name of this member. 
Definition: libdmf.h:114
 
unsigned int * duty_noise_envelope
Actual duty/noise envelope. 
Definition: libdmf.h:91
 
FM_operator * FM_operators
The operator data. 
Definition: libdmf.h:72
 
unsigned char TL
Total level, the highest amplitude of the waveform. 
Definition: libdmf.h:46
 
unsigned char mode
The mode (0 = STD, 1 = FM) 
Definition: libdmf.h:60
 
int decompressDMF(unsigned char *src, size_t src_length, unsigned char *dest)
Takes buffer from openDmfFileIntoBuffer() and decompresses it using miniz.h. 
Definition: dmfParser.c:28
 
note_channel * channels
Actual note data. 
Definition: libdmf.h:222
 
unsigned char name_length
The length of the name of the instrument. 
Definition: libdmf.h:58
 
unsigned char gb_sound_length
GB shite, see the name of this member. 
Definition: libdmf.h:126
 
int openDmfFileIntoBuffer(char *filename, unsigned char *dest, size_t *length)
Use a filename to open a file into a memory buffer. 
Definition: dmfParser.c:4
 
unsigned char total_wavetables
Total number of wavetables in the dmf. 
Definition: libdmf.h:219
 
unsigned char pitch
Deflemasks weird pitch thing. 
Definition: libdmf.h:176
 
signed char wavetable_loop_position
The loop position of the wavetable envelope. -1 = NO_LOOP. 
Definition: libdmf.h:97
 
unsigned char c64_release
C64 shite, see the name of this member. 
Definition: libdmf.h:108
 
unsigned char c64_filter_band_pass
C64 shite, see the name of this member. 
Definition: libdmf.h:119
 
unsigned char LFO
Low Frequency Oscillator 1 (FMS on YM2612, PMS on YM2151) 
Definition: libdmf.h:65
 
unsigned short custom_hz
The actual custom framerate. 
Definition: libdmf.h:210
 
signed char volume_loop_position
The loop position of the volume envelope. -1 = NO_LOOP. 
Definition: libdmf.h:81
 
unsigned char AR
Attack rate, the angle of initial amplitude increase. 
Definition: libdmf.h:41
 
unsigned char time_base
Base Time. 
Definition: libdmf.h:204
 
unsigned short * data
Actual sample data. 
Definition: libdmf.h:180
 
int verifyDMF(char *filename)
Verify a DMF's integrety (or for that matter libdmf's :/) 
Definition: test.c:218
 
unsigned char SL
The amplitude at which the slower amplitude decrease starts. 
Definition: libdmf.h:45
 
unsigned char c64_pulse_width
C64 shite, see the name of this member. 
Definition: libdmf.h:109
 
unsigned char total_samples
Total number of samples in the dmf. 
Definition: libdmf.h:224
 
sample * samples
Actual sample data. 
Definition: libdmf.h:225
 
unsigned char c64_attack
C64 shite, see the name of this member. 
Definition: libdmf.h:105
 
char * author
The author of the dmf. 
Definition: libdmf.h:198
 
unsigned char ** pattern_matrix_value
The pattern matrix data, it runs down and then across. 
Definition: libdmf.h:214
 
unsigned char c64_saw_wave_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:102
 
signed char arpeggio_loop_position
The loop position of the arpeggio envelope. -1 = NO_LOOP. 
Definition: libdmf.h:86
 
signed short volume
The volume of the note. -1 if empty. 
Definition: libdmf.h:153
 
unsigned char name_length
The length of the dmf's name. 
Definition: libdmf.h:194
 
unsigned char highlight_A
Row highlight A. 
Definition: libdmf.h:200
 
unsigned char rate
Bitrate of the sample. 
Definition: libdmf.h:175
 
unsigned char bits
Bit depth of sample. (8 or 16) 
Definition: libdmf.h:178
 
unsigned char author_length
The length of the dmf's author's name. 
Definition: libdmf.h:197
 
unsigned char c64_volume_macro_to_filter_cutoff_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:113
 
unsigned char custom_hz_on
Whether or not the dmf has a custom framerate. 
Definition: libdmf.h:209
 
unsigned char * name
The name of the instrument. 
Definition: libdmf.h:59
 
unsigned char name_length
Length of the sample name. 
Definition: libdmf.h:172
 
unsigned char c64_sustain
C64 shite, see the name of this member. 
Definition: libdmf.h:107
 
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. 
Definition: dmfParser.c:648
 
unsigned short note
The note. Ranges from [1-12]. 1 = C#, 12 = C. 
Definition: libdmf.h:151
 
unsigned char gb_envelope_direction
GB shite, see the name of this member. 
Definition: libdmf.h:124
 
signed short value
The value of that command. 
Definition: libdmf.h:144
 
unsigned char FB
The feedback for operator 1. 
Definition: libdmf.h:64
 
unsigned char arpeggio_macro_mode
The arpeggio macro mode (0 = Normal, 1 = Fixed) 
Definition: libdmf.h:87
 
unsigned char DT2
Detune 2 used only on the YM2151 see DT. 
Definition: libdmf.h:47
 
unsigned char amp
The volume of the sample. 
Definition: libdmf.h:177
 
unsigned char c64_filter_low_pass
C64 shite, see the name of this member. 
Definition: libdmf.h:120
 
char * name
The name of the dmf. 
Definition: libdmf.h:195
 
unsigned char AM
Amplitude Modulation enable, whether or not this operator will allow itself to be modified by the LFO...
Definition: libdmf.h:40
 
unsigned char effect_columns_count
Number of effect columns for that channel. 
Definition: libdmf.h:162
 
void displayDMF(dmf song)
Print out everything to do with a dmf. 
Definition: test.c:5
 
signed char duty_noise_loop_position
The loop position of the duty/noise envelope. -1 = NO_LOOP. 
Definition: libdmf.h:92
 
unsigned char DT
Detune, a number between -3 and 3. Positive is a sharper detune, whilst negative is lower...
Definition: libdmf.h:49
 
unsigned short octave
The octave of the note. 
Definition: libdmf.h:152
 
note_row ** rows
An array of array of rows, first go down the pattern matrix, then the pattern. 
Definition: libdmf.h:163
 
unsigned char system
The console this dmf is written for. 
Definition: libdmf.h:190
 
int dmfToBuffer(dmf src, unsigned char *dest, size_t *size)
The opposite of parseDMF(). Converts dmf type to uncompressed dmf file. 
Definition: dmfParser.c:365
 
note_command * commands
A list of commands. 
Definition: libdmf.h:154
 
instrument * instruments
The instrument data. 
Definition: libdmf.h:217
 
signed int * arpeggio_envelope
Actual arpeggio envelope. 
Definition: libdmf.h:85
 
unsigned char c64_sync_modulation_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:111
 
int total_rows_per_pattern
The total rows in a pattern (defualt 64) 
Definition: libdmf.h:212
 
unsigned char tick_time_1
Speed variable 1. e.g. tick_time_1/tick_time_2. 
Definition: libdmf.h:205
 
unsigned char MULT
A multiplier to the frequency. 
Definition: libdmf.h:43
 
unsigned char system_total_channels
The number of channels in that system. 
Definition: libdmf.h:191
 
unsigned char duty_noise_envelope_size
Size of the duty/noise envelope. Ranges from [0 - 127]. 
Definition: libdmf.h:90
 
unsigned char D2R
The angle of secondary amplitude decrease. This will continue indefinitely unless ‘key off’ occurs...
Definition: libdmf.h:50
 
signed short instrument
The instrument of the note. -1 if empty. 
Definition: libdmf.h:155
 
unsigned char gb_envelope_volume
GB shite, see the name of this member. 
Definition: libdmf.h:123
 
unsigned char c64_to_filter
C64 shite, see the name of this member. 
Definition: libdmf.h:112
 
unsigned char c64_noise_wave_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:104
 
unsigned char c64_filter_high_pass
C64 shite, see the name of this member. 
Definition: libdmf.h:118
 
unsigned char tick_time_2
Speed variable 2. e.g. tick_time_1/tick_time_2. 
Definition: libdmf.h:206
 
unsigned char * name
The name of the sample. 
Definition: libdmf.h:173
 
unsigned char RR
The final angle of amplitude decrease, after ‘key off’. 
Definition: libdmf.h:44
 
unsigned char total_rows_in_pattern_matrix
The number of rows in the pattern matrix. 
Definition: libdmf.h:213
 
unsigned char ALG
The FM Algorithm. 
Definition: libdmf.h:63
 
unsigned char reigon
The reigon of the dmf. 0 = PAL, 1 = NTSC. 
Definition: libdmf.h:208
 
int freeDMF(dmf *src)
Free a DMF's resources. 
Definition: dmfParser.c:679
 
unsigned int size
Size of the wavetable. 
Definition: libdmf.h:134
 
unsigned char total_instruments
Total number of instruments in the dmf. 
Definition: libdmf.h:216
 
unsigned char highlight_B
Row highlight B. 
Definition: libdmf.h:201
 
unsigned char c64_triangle_wave_enabled
C64 shite, see the name of this member. 
Definition: libdmf.h:101
 
unsigned char arpeggio_envelope_size
Size of arpeggio envelope. Ranges from [0 - 127]. 
Definition: libdmf.h:84
 
unsigned char DR
The angle of initial amplitude decrease. 
Definition: libdmf.h:42
 
unsigned char c64_filter_cutoff
C64 shite, see the name of this member. 
Definition: libdmf.h:117
 
unsigned char SSGMODE
The SSG mode (BIT 4 = 0 Disabled, 1 Enabled, BITS 0,1,2 SSG_MODE) 
Definition: libdmf.h:51
 
unsigned char RS
Rate scaling, the degree to which envelopes become shorter as frequencies become higher. 
Definition: libdmf.h:48