unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, BassPlayerExU, basschannelu, ComCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
OpenDialog1: TOpenDialog;
TrackBar1: TTrackBar;
Timer1: TTimer;
Label1: TLabel;
TrackBar2: TTrackBar;
Label2: TLabel;
Button2: TButton;
procedure FormDestroy(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TrackBar2Change(Sender: TObject);
procedure poschange(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
s,m:integer;
Player: TBassPlayerEx;
ChannelA,ChannelB: Tbasschannel;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Player := TBassPlayerEx.Create(1,self);
ChannelA := Player.addChannel(100);
end;
procedure TForm1.Button1Click(Sender: TObject);
var length,vol:integer;
begin
if OpenDialog1.Execute
then
begin
ChannelA.LoadFromFile(OpenDialog1.Filename);
TrackBar1.Max := ChannelA.Lied.SecLaenge;
ChannelA.Lied.create(OpenDialog1.Filename);
length := ChannelA.Lied.SecLaenge;
s := length
mod 60; m := length
div 60;
vol := ChannelA.Volume;
Label1.Caption := Format('
%.2d:%.2d',[m,s]);
Label2.Caption := inttostr(vol)+'
%';
ChannelA.Play;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var m1,s1:integer;
begin
if ChannelA.isComplete
then
begin
Trackbar1.OnChange :=
Nil;
TrackBar1.Position := ChannelA.SecPosition;
TrackBar1.OnChange := poschange;
m1 := ChannelA.SecPosition
div 60;
s1 := ChannelA.SecPosition
mod 60;
Label1.Caption := Format('
%.2d:%.2d',[m1,s1])+'
/ '+Format('
%.2d:%.2d',[m,s]);
end;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
ChannelA.SecPosition := TrackBar1.Position;
end;
procedure TForm1.poschange(Sender: TObject);
begin
ChannelA.SecPosition := TrackBar1.Position;
end;
procedure TForm1.TrackBar2Change(Sender: TObject);
var vol:integer;
begin
vol := 100 - TrackBar2.Position;
ChannelA.Volume := vol;
Label2.Caption := inttostr(vol)+'
%';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(inttostr(ChannelA.Lied.SecLaenge));
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
ChannelA.Free;
Player.Free;
end;
end.