Ich kann berichten, es funktioniert. Habe dann noch den Zielwert und das Delay in Variablen verpackt.
var
i, target, delay : integer;
procedure OnEncoderInputToggle(Input: TEncoderInput; NewState: boolean);
begin
target := -12; // set your target duck range here
delay := 100; // set the delay betwee steps here to smoothen the fade
if (Input = eiMic) and (NewState = false) then begin
for i := (target) to 0 do
begin
ExecuteCommand('PLAYER 1-1 VOLUME ' + IntToStr(i));
ExecuteCommand('PLAYER 1-2 VOLUME ' + IntToStr(i));
Sleep(delay);
end;
end
else if (Input = eiMic) and (NewState = true) then begin
for i := 0 downto (target) do
begin
ExecuteCommand('PLAYER 1-1 VOLUME ' + IntToStr(i));
ExecuteCommand('PLAYER 1-2 VOLUME ' + IntToStr(i));
Sleep(delay);
end;
end;
end;