DMP File Format

From vgmrips

Extracted from: http://www.delek.com.ar/soft/deflemask/DMP_SPECS.txt

Delek @ 2015. Leonardo Demartino.
Specs for DMP (DefleMask Preset Format, for DefleMask 11 and above)

I wrote this text file looking at the source code, any suggestion or request can be done at:
- http://www.delek.com.ar/forum
- http://www.facebook.com/Delek.Page
- http://www.twitter.com/_Delek
- http://www.soundcloud.com/Delek_Music
- deeleek (at) gmail (.) com

------------------------------------------------------------------------------------------------

"//" means a comment line, not actual information of the format.
// I added tabulations for better reading, also you will find IF statements that you should follow. Systems have different things to read and save.

//START OF DMP FORMAT

	1 Byte:   FILE_VERSION, must be 10 (0x0A) for DefleMask 11
	1 Byte:   Instrument Mode (1=FM, 0=STANDARD)
	//PER INSTRUMENT MODE DATA
		//IF INSTRUMENT MODE IS STANDARD ( = 0)
			//IF NOT SYSTEM_GAMEBOY (Game Boy uses STD instruments but has internal ADSR Volume, do not read VOLUME MACRO for it)
				//VOLUME MACRO
				1 Byte: ENVELOPE_SIZE (0 - 127)
				Repeat this ENVELOPE_SIZE times
					4 Bytes: ENVELOPE_VALUE
				//IF ENVELOPE_SIZE > 0
					1 Byte: LOOP_POSITION (-1 = NO LOOP)

			//ARPEGGIO MACRO
			1 Byte: ENVELOPE_SIZE (0 - 127)
			Repeat this ENVELOPE_SIZE times
				4 Bytes: ENVELOPE_VALUE (signed int, offset=12)
			//IF ENVELOPE_SIZE > 0
				1 Byte: LOOP_POSITION (-1 = NO LOOP)
			1 Byte: ARPEGGIO MACRO MODE (0 = Normal, 1 = Fixed)

			//DUTY/NOISE MACRO
			1 Byte: ENVELOPE_SIZE (0 - 127)
			Repeat this ENVELOPE_SIZE times
				4 Bytes: ENVELOPE_VALUE
			//IF ENVELOPE_SIZE > 0
				1 Byte: LOOP_POSITION (-1 = NO LOOP)


			//WAVETABLE MACRO
			1 Byte: ENVELOPE_SIZE (0 - 127)
			Repeat this ENVELOPE_SIZE times
				4 Bytes: ENVELOPE_VALUE
			//IF ENVELOPE_SIZE > 0
				1 Byte: LOOP_POSITION (-1 = NO LOOP)

			//PER SYSTEM DATA
				//IF SYSTEM IS C64
					1 Byte: Triangle Wave Enabled
					1 Byte: Saw Wave Enabled
					1 Byte: Pulse Wave Enabled
					1 Byte: Noise Wave Enabled
					1 Byte: Attack
					1 Byte: Decay
					1 Byte: Sustain
					1 Byte: Release
					1 Byte: Pulse Width
					1 Byte: Ring Modulation Enabled
					1 Byte: Sync Modulation Enabled
					1 Byte: To Filter
					1 Byte: Volume Macro To Filter Cutoff Enabled
					1 Byte: Use Filter Values From Instrument
					//FILTER GLOBALS
					1 Byte: Filter Resonance
					1 Byte: Filter Cutoff
					1 Byte: Filter High Pass
					1 Byte: Filter Low Pass
					1 Byte: Filter CH2 Off
				//IF SYSTEM_GAMEBOY
					1 Byte: Envelope Volume
					1 Byte: Envelope Direction
					1 Byte: Envelope Length
					1 Byte: Sound Length
		//IF INSTRUMENT MODE IS FM ( = 1)
			1 Byte: LFO (FMS on YM2612, PMS on YM2151)
			1 Byte: FB
			1 Byte: ALG
			1 Byte: LFO2 (AMS on YM2612, AMS on YM2151)

			Repeat this TOTAL_OPERATORS times
				1 Byte: MULT
				1 Byte: TL
				1 Byte: AR
				1 Byte: DR
				1 Byte: SL
				1 Byte: RR
				1 Byte: AM
				1 Byte: RS
				1 Byte: DT (DT2<<4 | DT on YM2151)
				1 Byte: D2R
				1 Byte: SSGEG_Enabled <<3 | SSGEG
//END OF DMP FORMAT