SetSyncTime.pas 1.87 KB
unit SetSyncTime;

interface

{$DEFINE MULTI_LANGUAGE}

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, slider, StdCtrls {$IFDEF MULTI_LANGUAGE}, gnugettext{$ENDIF};

type
  TSetSyncShiftTimeForm = class(TForm)
    btnCLose: TButton;
    GroupBox1: TGroupBox;
    Label10: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label15: TLabel;
    Label18: TLabel;
    Label4: TLabel;
    lbl_ShiftAll: TLabel;
    Label1: TLabel;
    SliderMIDI_DS: TSlider;
    procedure btnCLoseClick(Sender: TObject);
    procedure SliderMIDI_DSChange(Sender: TObject);
    procedure SliderMIDI_DSStopTracking(Sender: TObject);
    procedure SliderMIDI_DSStartTracking(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SetSyncShiftTimeForm: TSetSyncShiftTimeForm;

implementation

{$R *.dfm}

uses ReadMIDILyrics, ShowMIDILyrics;

var
   NowTracking  : boolean = false;
   NowTracking2 : boolean = false;

procedure TSetSyncShiftTimeForm.btnCLoseClick(Sender: TObject);
begin
  Close;
end;

procedure TSetSyncShiftTimeForm.FormCreate(Sender: TObject);
begin
  {$IFDEF MULTI_LANGUAGE}
  TranslateComponent(self);
  {$ENDIF}
  SetMIDITimeOffset(- SliderMIDI_DS.Value * 50);
end;

procedure TSetSyncShiftTimeForm.SliderMIDI_DSChange(Sender: TObject);
begin
  if not NowTracking2 then
    exit;

  if SliderMIDI_DS.Value >= 0 then
    lbl_ShiftAll.Caption := '+' + FormatFloat('#0.00', SliderMIDI_DS.Value / 20.0)
  else
    lbl_ShiftAll.Caption := FormatFloat('#0.00', SliderMIDI_DS.Value / 20.0);
end;

procedure TSetSyncShiftTimeForm.SliderMIDI_DSStartTracking(Sender: TObject);
begin
  NowTracking2 := true;
end;

procedure TSetSyncShiftTimeForm.SliderMIDI_DSStopTracking(Sender: TObject);
begin
  SetMIDITimeOffset(- SliderMIDI_DS.Value * 50);
  NowTracking2 := false;
end;

end.