unit Unit1;
....
type
TA_B1 =
record
A1:Integer;
B1:Integer;
ZeitA:
string;
ZeitB:
string;
end;
var
A_B1: TA_B1;
Zeit:
string;
implementation
{$R *.dfm}
//------------------ Open and Wiedergabe ---------------------//
procedure TForm1.OpenButtonClick(Sender: TObject);
begin
if opendialog1.Execute
then
Mediaplayer1.FileName := opendialog1.FileName;
Mediaplayer1.open;
PlayButtonClick(Form1);
form1.LoopAB.checked := false;
end;
procedure TForm1.PlayButtonClick(Sender: TObject);
begin
mediaplayer1.Play;
timer1.ENABLED:=true;
end;
procedure TForm1.StopButtonClick(Sender: TObject);
begin
mediaplayer1.Stop;
mediaplayer1.Rewind;
end;
//------------------ Loop A B ---------------------//
procedure TForm1.PosAButtonClick(Sender: TObject);
begin
begin
if form1.LoopAB.checked = false
then
begin
mediaplayer1.StartPos :=mediaplayer1.Position;
A_B1.A1:=mediaplayer1.Position;
A_B1.ZeitA:=Zeit+'
- '+zeit+'
00:00';
Form1.PosAButton.enabled:=false;
Form1.PosBButton.enabled:=True;
end;
end;
if form1.LoopAB.checked = true
then
begin
timer1.ENABLED:=true;
mediaplayer1.StartPos:=mediaplayer1.Position;
form1.LoopAB.checked:=false;
Form1.PosAButton.enabled:=true;
Form1.PosBButton.enabled:=False;
end;
end;
procedure TForm1.PosBButtonClick(Sender: TObject);
begin
mediaplayer1.EndPos := Mediaplayer1.Position;
A_B1.B1:= mediaplayer1.Position;
form1.MediaPlayer1.play;
A_B1.ZeitB:=Zeit+'
- '+Zeit+'
- '+zeit;
Form1.PosBButton.enabled:=False;
Form1.PosAButton.enabled:=true;
form1.LoopAB.checked:=true;
timer1.ENABLED:=true;
end;
procedure TForm1.LoopABClick(Sender: TObject);
Begin
begin
if form1.LoopAB.checked = true
then
begin
Mediaplayer1.StartPos:=A_B1.A1;
Mediaplayer1.EndPos:=A_B1.B1;
Form1.PosAButton.caption:= '
PosX';
end;
end;
if form1.LoopAB.checked = false
then
begin
mediaplayer1.startpos:=mediaplayer1.position;
mediaplayer1.endpos:=mediaplayer1.length;
form1.label1.Caption:='
00:00 - '+Zeit+'
- 00:00:0';
mediaplayer1.Play;
Form1.PosAButton.caption:= '
PosA';
end;
end;
/// Timer muss false haben!
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Zeit := FormatDateTime('
nn:ss', MediaPlayer1.Position / 1000 / 86400);
label1.Caption := FormatDateTime('
nn:ss', A_B1.A1 / 1000 / 86400)+'
- '+
zeit +'
- '+
FormatDateTime('
nn:ss', A_B1.B1 / 1000 / 86400);
begin
if form1.LoopAB.Checked = True
then
begin
Mediaplayer1.StartPos:=A_B1.A1; Mediaplayer1.EndPos:=A_B1.B1;
if (Mediaplayer1.EndPos
div 50) = (Mediaplayer1.StartPos
div 50)
then
Mediaplayer1.play;
if (Mediaplayer1.Position
div 50) = (Mediaplayer1.EndPos
div 50)
then
Mediaplayer1.Play;
end;
end;
end;
end.