Define Device (
	Manufacturer "Akai"
	Device "S612"
	MaxChannel 9
	Updates Final
)

Define Font "Numbers" (
	Name "Helvetica.font"
	Size 9
)

Define Font "Topaz2p" (
	Name "Topaz2p.font"
	Size 8
)

Define Window "Page_Select" (
	Position 0 14
	Size 640 24
)

Define Window "Parameters" (
	Position 0 41
	Size 640 359
)

Define Midi "Settings" (
	Loadable
	Data (
		F0h 'SYSEX
		47h 'AKAI ID
		Byte 'CHANNEL
		44h 'DAT
		20h 'S612
		41h 'Settings Data
		00h 'RVRCP
		00h
		02h
		01h
		3Fh 'RVRCBC
		01h
		7Ch
		00h
		02h 'Replay Mode
		00h '
		08h 'Attack Direction
		00h '
		18h 'Recirc Direction
		00h '
		Bytes 6 'Undefined
		00h 'RSTRAM
		00h
		02h
		01h
		3Fh 'Initial Byte Count
		01h
		7Ch
		00h
		Bytes 2 'Mono/Poly
		Bytes 2 'Undefined
		Bytes 2 'Vibrato Rate
		Bytes 2 'Vibrato Depth
		Bytes 4 'Vibrato Buildup Increment
		Bytes 2 'Filter Semitones Below Nyquist Frequency
		Bytes 2 'Release Time
		Bytes 2 'Fine Pitch Offset
		Bytes 2 'Transpose Offset
		00h 'DATLIM
		00h
		7Fh
		01h
		3Fh 'REP
		01h
		7Ch
		00h
		Bytes 8 'Undefined
		F7h
	)
	Midi (
		Data (
			2 CHANNEL
		)
	)
)

Define Link "FinePitch" (
	Type Numbers (
		Font "Numbers"
		Position 0 -12
		Size 100 8
		MinValue -100
		Skip 12.5
		LevelText "cents"
	)
)

Define Link "Polyphony" (
	Type Texts (
		Font "Numbers"
		Position 0 -12
		Size 100 8
		Data (
			"Polyphonic"
			"Monophonic"
		)
		DataValues (
			00h FFh
		)
	)
)

Define Link "ReplayMode" (
	Type Texts (
		Font "Numbers"
		Position 0 -12
		Size 100 8
		Data (
			"One Shot"
			"Forward Loop"
			"Alternating Loop"
		)
		DataValues (
			02h 03h 01h
		)
	)
)

Define Link "TransposeOffset" (
	Type Numbers (
		Font "Numbers"
		Position 0 -12
		Size 100 8
		MinValue -24
		Skip 1
	)
)

Define Link "ReCalc" (
	Type ARexx (
		File "modules/Akai/S612.rexx"
	)
)


Window "Page_Select" (
	Border (
		Position 0 0
		Size 640 24
		Fill 3
	)

	Text "AKAI - S-612" (
		Position 535 14
		Color 2
		Shadow
	)
)


Window "Parameters" (
	Border (
		Position 52 0
		Position2 295 47
		Frame 3D-Recess
	)
	Border (
		Position 52 46
		Position2 295 62
		Fill 3
		Frame 3D-Recess
	)
	Text "Waveform" (
		Position 145 57
	)

	Text "Start Page" (
		Position 80 14
	)
	Gadget "StartPage" ( '1
		Position 69 30
		Font "Numbers"
		Type Slider (
			Range 0 125
			Size 100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
			Link "ReCalc"
		)
		Midi "Settings" (
			Data (
			' 26 0 Byte
			' 27 0 Byte
				28 VALUE Offset 130 XBits baaaaaaa
			)
			Send
		)
	)
	Text "End Page" (
		Position 199 14
	)
	Gadget "EndPage" ( '2
		Position 179 30
		Font "Numbers"
		Type Slider (
			Range 0 125
			Size 100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
			Link "ReCalc"
		)
		Midi "Settings" (
			Data (
			' 54 0 Byte
			' 55 0 Byte
				56 VALUE Offset 130 XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 68 71
		Position2 311 162
		Frame 3D-Recess
	)
	Border (
		Position 68 161
		Position2 311 177
		Fill 3
		Frame 3D-Recess
	)
	Text "Loop" (
		Position 176 172
	)
	Text "Page" (
		Position 120 85
	)
	Gadget "LoopStartPage" ( '3
		Position 85 101
		Font "Numbers"
		Type Slider (
			Range 0 125
			Size 100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
			Link "ReCalc"
		)
		Midi "Settings" (
			Data (
			' 6 LoopStartByte 0-6
			' 7 LoopStartByte 7
				8 VALUE Offset 130 XBits baaaaaaa
			)
			Send
		)
	)
	Text "Byte" (
		Position 232 85
	)
	Gadget "LoopStartByte" ( '4
		Position 195 101
		Font "Numbers"
		Type Slider (
			Range 0 255
			Size 100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
			Link "ReCalc"
		)
		Midi "Settings" (
			Data (
				6 VALUE XBits baaaaaaa
			' 8 LoopStartPage 0-6
			' 9 LoopStartPage 7
			)
			Send
		)
	)
	Text "Replay Mode" (
		Position 150 129
	)
	Gadget "ReplayMode" (
		Position 142 145
		Font "Numbers"
		Type Slider (
			Range 0 2
			Size 100 12
			Direction HORIZONTAL
			Link "ReplayMode"
		)
		Midi "Settings" (
			Data (
				14 VALUE XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 305 0
		Position2 438 47
		Frame 3D-Recess
	)
	Border (
		Position 305 46
		Position2 438 62
		Fill 3
		Frame 3D-Recess
	)
	Text "Polyphony" (
		Position 341 57
	)
	Gadget "Polyphony" (
		Position 322 30
		Type Slider (
			Range 0 1
			Size 100 12
			Direction HORIZONTAL
			Link "Polyphony"
		)
		Midi "Settings" (
			Data (
				34 VALUE XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 448 0
		Position2 581 47
		Frame 3D-Recess
	)
	Border (
		Position 448 46
		Position2 581 62
		Fill 3
		Frame 3D-Recess
	)
	Text "Envelope" (
		Position 488 57
	)
	Text "Release Time" (
		Position 473 14
	)
	Gadget "ReleaseTime" (
		Position 465 30
		Font "Numbers"
		Type Slider (
			Range 0 254
			Size  100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
		)
		Midi "Settings" (
			Data (
				48 VALUE XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 321 71
		Position2 564 162
		Frame 3D-Recess
	)
	Border (
		Position 321 161
		Position2 564 177
		Fill 3
		Frame 3D-Recess
	)
	Text "Vibrato" (
		Position 419 172
	)
	Text "Rate" (
		Position 373 85
	)
	Gadget "VibratoRate" (
		Position 338 101
		Font "Numbers"
		Type Slider (
			Range 0 19
			Size  100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
		)
		Midi "Settings" (
			Data (
				38 VALUE XBits baaaaaaa
			)
			Send
		)
	)
	Text "Buildup" (
		Position 475 85
	)
	Gadget "VibratoBuildup" (
		Position 448 101
		Font "Numbers"
		Type Slider (
			Range 0 1020
			Size  100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
		)
	)
	Text "Depth" (
		Position 426 129
	)
	Gadget "VibratoDepth" (
		Position 395 145
		Font "Numbers"
		Type Slider (
			Range 0 254
			Size  100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
		)
		Midi "Settings" (
			Data (
				40 VALUE XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 103 186
		Position2 346 233
		Frame 3D-Recess
	)
	Border (
		Position 103 232
		Position2 346 248
		Fill 3
		Frame 3D-Recess
	)
	Text "Tuning" (
		Position 204 243
	)
	Text "Transpose" (
		Position 136 200
	)
	Gadget "Transpose" (
		Position 120 216
		Font "Numbers"
		Type Slider (
			Range 0 60
			Size  100 12
			Direction HORIZONTAL
  		Link "TransposeOffset"
		)
		Midi "Settings" (
			Data (
				52 VALUE Signed XBits baaaaaaa
			)
			Send
		)
	)
	Text "Fine Pitch" (
		Position 245 200
	)
	Gadget "FinePitch" (
		Position 230 216
		Font "Numbers"
		Type Slider (
			Range 0 16
			Size  100 12
			Direction HORIZONTAL
  		Link "FinePitch"
		)
		Midi "Settings" (
			Data (
				50 VALUE Signed XBits baaaaaaa
			)
			Send
		)
	)


	Border (
		Position 356 186
		Position2 526 233
		Frame 3D-Recess
	)
	Border (
		Position 356 232
		Position2 526 248
		Fill 3
		Frame 3D-Recess
	)
	Text "Filter" (
		Position 425 243
	)
	Text "Below Nyquist Freq." (
		Position 373 200
	)
	Gadget "Filter" (
		Position 392 216
		Font "Numbers"
		Type Slider (
			Range 0 63
			Size  100 12
			Direction HORIZONTAL
			LevelPlace ABOVE
			LevelText "semitones"
		)
		Midi "Settings" (
			Data (
				46 VALUE XBits baaaaaaa
			)
			Send
		)
	)
)
