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;
Label1: TLabel;
Label2: TLabel;
TrackBar2: TTrackBar;
Timer1: TTimer;
Button2: TButton;
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TrackBar2Change(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}
Uses BassTypenU;
//<-!!!
Var _noAwnChangePos:boolean;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Timer1.Enabled:=False;
if Assigned(ChannelA)
then
ChannelA.Stop;
if Assigned(Player)
then
begin
Player.delChannel;
Player.Free;
end;
end;
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.SongTimeInfo[SongTimeLength].asMilliSecInteger;
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
_noAwnChangePos:=True;
TrackBar1.Position := ChannelA.SongTimeInfo[SongTimeUp].asMilliSecInteger;
{ 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
if _noAwnChangePos
then
_noAwnChangePos := False
else
ChannelA.MilliSecPosition := 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.SongTimeInfo[SongtimeLength].asMilliSecInteger));
end;
end.
//in der BasschannnelU sollte noch folgendes editiert werden
procedure TScanThread.WriteData;
begin
while (Self=nil)
do terminate;
//<----!!! weil Thread terminate sonst exit
_WaveBufferUpdateEvent(_WaveBufL, _WaveBufR, _Start, _Ende, _Max, _Complete);
end;