TMH 60
Eurolite
Klaus
Eurolite TMH 60
unit NewDeviceUnit;
interface
procedure InitDevice(Device: String);
procedure FormShow;
procedure FormRefresh(channel:Integer);
procedure FormClose;
procedure PositionXYChange(Top, Left: Integer);
procedure SPECIAL1change;
procedure MOVESchange;
procedure GOBO1change;
procedure GOBO1ROTchange;
procedure GOBO2change;
procedure FOCUSchange;
procedure PRISMAchange;
procedure SHUTTERchange;
procedure DIMMERchange;
procedure FILEchange;
procedure PANFINEchange;
procedure TILTFINEchange;
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
SPECIAL1slider2.position:=get_channel('SPECIAL1');
end;
3:
begin
MOVESslider3.position:=get_channel('MOVES');
end;
4:
begin
value:=get_channel('gobo1');
case value of
end;
end;
5:
begin
GOBO1ROTslider5.position:=get_channel('GOBO1ROT');
end;
6:
begin
value:=get_channel('gobo2');
case value of
end;
end;
7:
begin
FOCUSslider7.position:=get_channel('FOCUS');
end;
8:
begin
PRISMAslider8.position:=get_channel('PRISMA');
end;
9:
begin
SHUTTERslider9.position:=get_channel('SHUTTER');
end;
10:
begin
DIMMERslider10.position:=get_channel('DIMMER');
end;
11:
begin
FILEslider11.position:=get_channel('FILE');
end;
12:
begin
PANFINEslider12.position:=get_channel('PANFINE');
end;
13:
begin
TILTFINEslider13.position:=get_channel('TILTFINE');
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 SPECIAL1change;
begin
DontRefresh:=true;
set_channel('SPECIAL1',-1,SPECIAL1slider2.position,0);
end;
procedure MOVESchange;
begin
DontRefresh:=true;
set_channel('MOVES',-1,MOVESslider3.position,0);
end;
procedure GOBO1change;
begin
case gobobox1.itemindex of
end;
end;
procedure GOBO1ROTchange;
begin
DontRefresh:=true;
set_channel('GOBO1ROT',-1,GOBO1ROTslider5.position,0);
end;
procedure GOBO2change;
begin
case gobobox2.itemindex of
end;
end;
procedure FOCUSchange;
begin
DontRefresh:=true;
set_channel('FOCUS',-1,FOCUSslider7.position,0);
end;
procedure PRISMAchange;
begin
DontRefresh:=true;
set_channel('PRISMA',-1,PRISMAslider8.position,0);
end;
procedure SHUTTERchange;
begin
DontRefresh:=true;
set_channel('SHUTTER',-1,SHUTTERslider9.position,0);
end;
procedure DIMMERchange;
begin
DontRefresh:=true;
set_channel('DIMMER',-1,DIMMERslider10.position,0);
end;
procedure FILEchange;
begin
DontRefresh:=true;
set_channel('FILE',-1,FILEslider11.position,0);
end;
procedure PANFINEchange;
begin
DontRefresh:=true;
set_channel('PANFINE',-1,PANFINEslider12.position,0);
end;
procedure TILTFINEchange;
begin
DontRefresh:=true;
set_channel('TILTFINE',-1,TILTFINEslider13.position,0);
end;
end.