TMH5 MH
Eurolite
Christian Nöding
LED-Movinghead mit 9 Kanälen
unit NewDeviceUnit;
interface
procedure InitDevice(Device: String);
procedure FormShow;
procedure FormRefresh(channel:Integer);
procedure FormClose;
procedure PositionXYChange(Top, Left: Integer);
procedure MOVESchange;
procedure EXTRAchange;
procedure SPEEDchange;
procedure GOBO1change;
procedure SPECIAL1change;
procedure special1boxchanged;
implementation
var
DontRefresh:boolean;
procedure InitDevice(Device: String);
begin
end;
procedure FormShow;
begin
end;
procedure FormRefresh(channel:Integer);
var
Value:integer;
r,phi,temp:Double;
begin
if not DontRefresh then
case channel of
0:
begin
if usemhcontrol.checked then
begin
// Moving-Head-Steuerung
temp:=get_channel('tilt')+(get_channel('tiltfine')/256);
case round(temp) of
0..127: r:=((127-temp)/127);
128..255: r:=((temp-128)/127);
end;
phi:=(get_channel('pan')+(get_channel('panfine')/256))/255*6.283185307179586476925286766559; //(X/255)*PI
PositionXY.Left:=round(r*sin(phi)*(Fadenkreuz.Width/2)+(Fadenkreuz.Width/2)-(PositionXY.Width div 2));
PositionXY.Top:=round(r*cos(phi)*(Fadenkreuz.Height/2)+(Fadenkreuz.Height/2)-(PositionXY.Width div 2));
end else
begin
// Scanner-Steuerung
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;
end;
1:
begin
if usemhcontrol.checked then
begin
// Moving-Head-Steuerung
temp:=get_channel('tilt')+(get_channel('tiltfine')/256);
case round(temp) of
0..127: r:=((127-temp)/127);
128..255: r:=((temp-128)/127);
end;
phi:=(get_channel('pan')+(get_channel('panfine')/256))/255*6.283185307179586476925286766559; //(X/255)*PI
PositionXY.Left:=round(r*sin(phi)*(Fadenkreuz.Width/2)+(Fadenkreuz.Width/2)-(PositionXY.Width div 2));
PositionXY.Top:=round(r*cos(phi)*(Fadenkreuz.Height/2)+(Fadenkreuz.Height/2)-(PositionXY.Width div 2));
end else
begin
// Scanner-Steuerung
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;
end;
2:
begin
MOVESslider2.position:=get_channel('MOVES')
end;
3:
begin
EXTRAslider3.position:=get_channel('EXTRA')
end;
4:
begin
SPEEDslider4.position:=get_channel('SPEED')
end;
5:
begin
value:=get_channel('gobo1');
case value of
0..17: gobobox1.itemindex:=0;
18..33: gobobox1.itemindex:=1;
34..50: gobobox1.itemindex:=2;
51..67: gobobox1.itemindex:=3;
68..84: gobobox1.itemindex:=4;
85..101: gobobox1.itemindex:=5;
102..118: gobobox1.itemindex:=6;
119..137: gobobox1.itemindex:=7;
138..155: gobobox1.itemindex:=8;
156..172: gobobox1.itemindex:=9;
173..189: gobobox1.itemindex:=10;
190..206: gobobox1.itemindex:=11;
207..225: gobobox1.itemindex:=12;
226..255: gobobox1.itemindex:=13;
end;
end;
6:
begin
value:=get_channel('SPECIAL1');
case value of
0..10: special1box.itemindex:=0;
11..20: special1box.itemindex:=1;
21..30: special1box.itemindex:=2;
31..200: SPECIAL1slider.position:=value;
251..255: special1box.itemindex:=1;
end;
end;
end;
DontRefresh:=false;
end;
procedure FormClose;
begin
end;
procedure PositionXYChange(Top, Left: Integer);
var
phi,r,x,y:Double;
pan, tilt, panfine, tiltfine:Double;
begin
if usemhcontrol.checked then
begin
// Moving-Head-Steuerung (Polarkoordinaten)
x:=((PositionXY.Left+(PositionXY.Width div 2)-(fadenkreuz.Width/2))/fadenkreuz.Width)*2; //-1..0..1
y:=((PositionXY.Top+(PositionXY.Height div 2)-(fadenkreuz.Width/2))/fadenkreuz.Height)*2; //-1..0..1
r:=sqrt(x*x+y*y);
if (r>0) then
begin
if (y>=0) then
phi:=arccos(x/r)
else
phi:=6.283185307179586476925286766559-arccos(x/r);
end else
phi:=64;
r:=128-((r/2)*255);
phi:=(phi/6.283185307179586476925286766559)*255;
if 64>=phi then
phi:=phi+191
else
phi:=phi-64;
pan:=255-phi;
tilt:=255-r;
end else
begin
// Scannersteuerung (Kartesische Koordinaten)
pan:=((PositionXY.Left+(PositionXY.Width div 2))/fadenkreuz.Width)*255;
tilt:=((PositionXY.Top+(PositionXY.Height div 2))/fadenkreuz.Height)*255;
end;
// 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 MOVESchange;
begin
DontRefresh:=true;
set_channel('MOVES',-1,MOVESslider2.position,0);
end;
procedure EXTRAchange;
begin
DontRefresh:=true;
set_channel('EXTRA',-1,EXTRAslider3.position,0);
end;
procedure SPEEDchange;
begin
DontRefresh:=true;
set_channel('SPEED',-1,SPEEDslider4.position,0);
end;
procedure GOBO1change;
begin
case gobobox1.itemindex of
0: set_channel('gobo1', -1, 0, 0);
1: set_channel('gobo1', -1, 18, 0);
2: set_channel('gobo1', -1, 34, 0);
3: set_channel('gobo1', -1, 51, 0);
4: set_channel('gobo1', -1, 68, 0);
5: set_channel('gobo1', -1, 85, 0);
6: set_channel('gobo1', -1, 102, 0);
7: set_channel('gobo1', -1, 119, 0);
8: set_channel('gobo1', -1, 138, 0);
9: set_channel('gobo1', -1, 156, 0);
10: set_channel('gobo1', -1, 173, 0);
11: set_channel('gobo1', -1, 190, 0);
12: set_channel('gobo1', -1, 207, 0);
13: set_channel('gobo1', -1, 226, 0);
end;
end;
procedure SPECIAL1change;
begin
DontRefresh:=true;
set_channel('SPECIAL1',-1,SPECIAL1slider.position,0);
end;
procedure special1boxchanged;
begin
DontRefresh:=true;
case special1box.itemindex of
0: set_channel('SPECIAL1',-1,0,0);
1: set_channel('SPECIAL1',-1,15,0);
2: set_channel('SPECIAL1',-1,25,0);
end;
end;
end.