Ypoc 250
GLP
Thilo Schneider
Moving Head
unit Ypoc250;
interface
// Standard procedures
procedure InitDevice(Device: String);
procedure FormShow;
procedure FormRefresh(channel:Integer);
procedure FormClose;
// Procedures for device control
procedure LampOn;
procedure LampOff;
procedure Reset;
// Procedures for controlling basic settings
procedure PositionXYChange(Top, Left: Integer);
procedure DimmerChange();
procedure ColorBoxChange();
procedure GoboChange();
procedure GoboRotChange();
procedure PrismChange();
procedure ShutterChange();
procedure FocusChange();
procedure SpecialChange();
procedure MovementChange();
procedure SpeedChange();
implementation
var
DontRefresh:boolean;
procedure InitDevice(Device: String);
begin
end;
procedure FormShow;
begin
end;
procedure FormRefresh(channel:Integer);
var
val: Integer;
begin
if not DontRefresh then
begin
case channel of
0, 1, 2, 3: // Position
begin
PositionXY.Left := round(Fadenkreuz.Width * (get_channel('pan') + get_channel('panfine') / 256) / 255) - (PositionXY.Width div 2);
PositionXY.Top := round(Fadenkreuz.Height * (get_channel('tilt') + get_channel('tiltfine') / 256) / 255) - (PositionXY.Height div 2);
end;
4: // Color
begin
val := get_channel('color1');
case val of
0..47:
begin
colorbox.itemindex := val div 4;
case val mod 4 of
0..1: colordropdown.itemindex := 0;
2..3: colordropdown.itemindex := 1;
end;
end;
48..63:
begin
colorbox.itemindex := 0;
colordropdown.itemindex := 0;
end;
64..111:
begin
colorbox.itemindex := (val-64) div 4;
case val mod 4 of
0..1: colordropdown.itemindex := 2;
2..3: colordropdown.itemindex := 3;
end;
end;
112..127:
begin
colorbox.itemindex := 0;
colordropdown.itemindex := 2;
end;
128..191:
begin
colordropdown.itemindex := 4;
colorslider.position := val - 128;
end;
192..253:
begin
colordropdown.itemindex := 5;
colorslider.position := 253 - val;
end;
254:
begin
colordropdown.itemindex := 6;
end;
255:
begin
colordropdown.itemindex := 7;
end;
end;
end;
5: // Gobo
begin
val := get_channel('gobo1');
case val of
0..55:
begin
gobo1box.itemindex := val div 8;
goboslider.position := 0;
end;
56..63:
begin
gobo1box.itemindex := 0;
goboslider.position := 0;
end;
64..119:
begin
gobo1box.itemindex := (val-64) div 8;
goboslider.position := 63;
end;
120..127:
begin
gobo1box.itemindex := 0;
goboslider.position := 63;
end;
128..191:
begin
gobo1box.itemindex := 7;
goboslider.position := val - 128;
end;
192..253:
begin
gobo1box.itemindex := 8;
goboslider.position := 253 - val;
end;
254: gobo1box.itemindex := 9;
255: gobo1box.itemindex := 10;
end;
end;
6: // Gobo Rotation
begin
val := get_channel('gobo1rot');
case val of
0..131:
begin
goborotbox.itemindex := 0;
goborotslider.position := Round((val)/1.31);
end;
132..191:
begin
goborotbox.itemindex := 1;
goborotslider.position := Round((val - 132)/0.59);
end;
192..253:
begin
goborotbox.itemindex := 2;
goborotslider.position := Round((253 - val)/0.61);
end;
254: goborotbox.itemindex := 3;
255: goborotbox.itemindex := 4;
end;
end;
7: // Prism
begin
val := get_channel('prisma');
case val of
0..5: prismbox.itemindex := 0;
6..129:
begin
prismbox.itemindex := 1;
prismslider.position := Round((val - 6)/1.23);
end;
130..191:
begin
prismbox.itemindex := 2;
prismslider.position := Round((val - 130)/0.61);
end;
192..253:
begin
prismbox.itemindex := 3;
prismslider.position := Round((253 - val)/0.61);
end;
254: prismbox.itemindex := 4;
255: prismbox.itemindex := 5;
end;
end;
8: // Shutter
begin
val := get_channel('shutter');
case val of
0..15: shutterbox.itemindex := 0;
16..31:
begin
shutterbox.itemindex := 1;
shutterslider.position := Round((val - 16)/0.075);
end;
32..47:
begin
shutterbox.itemindex := 2;
shutterslider.position := Round((47 - val)/0.075);
end;
48..239:
begin
shutterbox.itemindex := 3;
shutterslider.position := Round((val - 48)/0.96)
end;
240..255: shutterbox.itemindex := 4;
end;
end;
9: // Dimmer
begin
dimmerslider.position := get_channel('dimmer');
end;
10: // Focus
begin
focusslider.position := get_channel('focus');
end;
11: // Special
begin
val := get_channel('special1');
case val of
0..15: specialbox.itemindex := 0;
16..31:
begin
specialbox.itemindex := 1;
specialslider.position := val - 16;
end;
32..47:
begin
specialbox.itemindex := 2;
specialslider.position := val - 32;
end;
48..63:
begin
specialbox.itemindex := 3;
specialslider.position := val - 48;
end;
64..79:
begin
specialbox.itemindex := 4;
specialslider.position := val - 64;
end;
80..95:
begin
specialbox.itemindex := 5;
specialslider.position := val - 80;
end;
96..111: specialbox.itemindex := 6;
112..127: specialbox.itemindex := 7;
128..255: specialbox.itemindex := 0;
end;
end;
12: // Movement
begin
val := get_channel('special2');
case val of
0: movementbox.itemindex := 0;
1..255:
begin
movementbox.itemindex := (val div 32) + 1;
movementsizebox.itemindex := (val mod 32) div 8;
movementphasebox.itemindex := (val mod 8) div 2;
end;
end;
end;
13: // Speed
begin
speedslider.position := get_channel('speed');
end;
14: // Laser
begin
val := get_channel('special3');
case val of
0..15: laserbox.itemindex := 0;
16..31: laserbox.itemindex := 1;
32..47: laserbox.itemindex := 2;
48..127:
begin
laserbox.itemindex := 3;
laserslider.position := Round((val - 48)/0.79)
end;
128..239:
begin
laserbox.itemindex := 4;
laserslider.position := Round((val - 128)/1.11)
end;
240..255: laserbox.itemindex := 5;
end;
end;
end;
end;
DontRefresh := false;
end;
procedure FormClose;
begin
end;
procedure LampOn;
begin
set_channel('shutter', 255, 255, 0);
end;
procedure LampOff;
begin
if MessageDlg('Do you really want to switch of the lamp of this Ypoc250 device?', mtConfirmation,[mbYes,mbNo],0) = mrYes then
begin
set_channel('special1', 231, 231, 0);
set_channel('shutter', 0, 0, 0);
end;
end;
procedure Reset;
begin
if MessageDlg('Do you really want to reset this Ypoc250 device?',mtConfirmation,[mbYes,mbNo],0) = mrYes then
begin
set_channel('special1', 255, 255, 0);
end;
end;
procedure PositionXYChange(Top, Left: Integer);
var
pan, tilt : Double;
begin
// Some prefer polar coordinates, however, this implements plain cartesian coordinates.
pan := ((PositionXY.Left + (PositionXY.Width div 2)) / fadenkreuz.Width) * 255;
tilt := ((PositionXY.Top + (PositionXY.Height div 2)) / fadenkreuz.Height) * 255;
// Ausgabe
if panmirror.checked then
begin
dontrefresh:=true;
set_channel('pan',trunc(255-pan),trunc(255-pan),0);
dontrefresh:=true;
set_channel('panfine',trunc(frac(255-pan)*255),trunc(frac(255-pan)*255),0);
end else
begin
dontrefresh:=true;
set_channel('pan',trunc(pan),trunc(pan),0);
dontrefresh:=true;
set_channel('panfine',trunc(frac(pan)*255),trunc(frac(pan)*255),0);
end;
if tiltmirror.checked then
begin
dontrefresh:=true;
set_channel('tilt',trunc(255-tilt),trunc(255-tilt),0);
dontrefresh:=true;
set_channel('tiltfine',trunc(frac(255-tilt)*255),trunc(frac(255-tilt)*255),0);
end else
begin
dontrefresh:=true;
set_channel('tilt',trunc(tilt),trunc(tilt),0);
dontrefresh:=true;
set_channel('tiltfine',trunc(frac(tilt)*255),trunc(frac(tilt)*255),0);
end;
end;
procedure DimmerChange();
begin
dontrefresh := true;
set_channel('dimmer', -1, dimmerslider.position, 5);
end;
procedure ColorBoxChange();
var
color : integer;
begin
color := colorbox.itemindex * 4;
dontrefresh := true;
case colordropdown.itemindex of
0: set_channel('color1', -1, color, 0);
1: set_channel('color1', -1, color + 2, 0);
2: set_channel('color1', -1, color + 64, 0);
3: set_channel('color1', -1, color + 66, 0);
4: set_channel('color1', -1, 130 + colorslider.position, 0);
5: set_channel('color1', -1, 253 - colorslider.position, 0);
6: set_channel('color1', -1, 254, 0);
7: set_channel('color1', -1, 255, 0);
end;
end;
procedure GoboChange();
begin
case gobo1box.itemindex of
0..6: set_channel('gobo1', -1, gobo1box.itemindex * 8 + (goboslider.position div 30)*64, 0);
7: set_channel('gobo1', -1, 128 + goboslider.position, 0);
8: set_channel('gobo1', -1, 253 - goboslider.position, 0);
9: set_channel('gobo1', -1, 254, 0);
10: set_channel('gobo1', -1, 255, 0);
end;
end;
procedure GoboRotChange();
begin
case goborotbox.itemindex of
0: set_channel('gobo1rot', -1, Round(131 * goborotslider.position / 100), 0);
1: set_channel('gobo1rot', -1, 132 + Round(59 * goborotslider.position / 100), 0);
2: set_channel('gobo1rot', -1, 253 - Round(61 * goborotslider.position / 100), 0);
3: set_channel('gobo1rot', -1, 254, 0);
4: set_channel('gobo1rot', -1, 255, 0);
end;
end;
procedure PrismChange();
begin
case prismbox.itemindex of
0: set_channel('prisma', -1, 0, 0);
1: set_channel('prisma', -1, 6 + Round(123 * prismslider.position / 100), 0);
2: set_channel('prisma', -1, 130 + Round(61 * prismslider.position / 100), 0);
3: set_channel('prisma', -1, 253 - Round(61 * prismslider.position / 100), 0);
4: set_channel('prisma', -1, 254, 0);
5: set_channel('prisma', -1, 255, 0);
end;
end;
procedure ShutterChange();
begin
case shutterbox.itemindex of
0: set_channel('shutter', -1, 0, 0);
1: set_channel('shutter', -1, 16, 0);
2: set_channel('shutter', -1, 47 - Round(15 * shutterslider.position / 200), 0);
3: set_channel('shutter', -1, 48 + Round(191 * shutterslider.position / 200), 0);
4: set_channel('shutter', -1, 255, 0);
end;
end;
procedure FocusChange();
begin
set_channel('focus', -1, focusslider.position, 0);
end;
procedure SpecialChange();
begin
case specialbox.itemindex of
0: set_channel('special1', -1, 0, 0);
1: set_channel('special1', -1, 16 + specialslider.position, 0);
2: set_channel('special1', -1, 32 + specialslider.position, 0);
3: set_channel('special1', -1, 48 + specialslider.position, 0);
4: set_channel('special1', -1, 64 + specialslider.position, 0);
5: set_channel('special1', -1, 80 + specialslider.position, 0);
6: set_channel('special1', -1, 96, 0);
7: set_channel('special1', -1, 112, 0);
end;
end;
procedure MovementChange();
begin
case movementbox.itemindex of
0: set_channel('special2', -1, 0, 0);
1: set_channel('special2', -1, 1 + movementsizebox.itemindex*8 + movementphasebox.itemindex*2, 0);
2..8: set_channel('special2', -1, (movementbox.itemindex-1)*32 + movementsizebox.itemindex*8 + movementphasebox.itemindex*2, 0);
end;
end;
procedure SpeedChange();
begin
set_channel('speed', -1, speedslider.position, 0);
end;
procedure LaserChange();
begin
case laserbox.itemindex of
0: set_channel('special3', -1, 0, 0);
1: set_channel('special3', -1, 16, 0);
2: set_channel('special3', -1, 32, 0);
3: set_channel('special3', -1, 48 + Round(79 * laserslider.position / 100), 0);
4: set_channel('special3', -1, 128 + Round(111 * laserslider.position / 100), 0);
5: set_channel('special3', -1, 255, 0);
end;
end;
end.