unit CDPlayerUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, LMDControl, LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel,
LMDCustomLabel, LMDCustomLabelFill, LMDLabelFill, GIFImage, ExtCtrls,
jpeg, LMDCustomComponent, LMDBaseController, LMDCustomContainer,
LMDCustomImageList, LMDBitmapList, LMDBaseGraphicButton,
LMDCustomMMButton, LMDMMButton, StdCtrls, bnw_bass_cdrip, bnw_cddb,
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
MPlayer, LMDTimer, mmSystem;
type
TCDPlayer =
class(TForm)
Image1: TImage;
Bevel1: TBevel;
Image5: TImage;
Image4: TImage;
LMDLabelFill1: TLMDLabelFill;
Image3: TImage;
Bevel2: TBevel;
Image6: TImage;
Label5: TLabel;
Label2: TLabel;
Bevel3: TBevel;
Button1: TLMDMMButton;
Button2: TLMDMMButton;
Button3: TLMDMMButton;
Button4: TLMDMMButton;
Button5: TLMDMMButton;
Button6: TLMDMMButton;
Button7: TLMDMMButton;
LMDMMButton1: TLMDMMButton;
LMDBitmapList1: TLMDBitmapList;
LMDBitmapList2: TLMDBitmapList;
Image2: TImage;
Label3: TLabel;
ComboBox1: TComboBox;
Label1: TLabel;
Timer1: TTimer;
ListBox1: TListBox;
ListBox3: TListBox;
Button8: TButton;
edt_disclength: TEdit;
edt_generated: TEdit;
Timer2: TTimer;
Button9: TButton;
MediaPlayer1: TMediaPlayer;
Label4: TLabel;
Label6: TLabel;
Label7: TLabel;
Timer3: TLMDHiTimer;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
CheckBox1: TCheckBox;
procedure Label3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure LMDMMButton1Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
CDPlayer: TCDPlayer;
CDAudio : Tbasscdrip;
CDDB : Tcddbinfo;
implementation
uses NavigatorUnit;
{$R *.dfm}
procedure TCDPlayer.Label3Click(Sender: TObject);
begin
Navigator.Show;
CDPlayer.Close;
end;
procedure TCDPlayer.FormCreate(Sender: TObject);
var i : integer;
s :
string;
begin
CDAudio := Tbasscdrip.create(
Handle);
CDDB := Tcddbinfo.create(Self);
for i := 0
to 5
do
begin
s := CDAudio.GetDriveDescription(i);
if s <> '
'
then
combobox1.items.add(s);
end;
combobox1.ItemIndex := 0;
end;
procedure TCDPlayer.Timer1Timer(Sender: TObject);
var i : integer;
begin
if CDDB.GetFoundCount > 0
then
begin
for i := 0
to CDDB.GetFoundCount-1
do
begin
listbox1.Items.Add(CDDB.GetFoundAlbum(i));
end;
end;
timer1.Enabled := false;
if CheckBox1.Checked
then
Timer2.Enabled:=True;
end;
procedure TCDPlayer.ListBox1Click(Sender: TObject);
var i : integer;
begin
for i := 0
to listbox1.Items.Count-1
do
begin
CDDB.ReadAlbumInfos(i);
end;
end;
procedure TCDPlayer.Button8Click(Sender: TObject);
var Album : TCDDBAlbum;
i,j : integer;
begin
for i := 0
to listbox1.Items.Count-1
do
begin
if listbox1.Selected[i]
then
begin
Album := CDDB.GetAlbumInfos;
Label4.Caption:=Album.Album;
Label7.Caption:=Album.Genre;
edt_generated.Text := Album.Generated;
edt_disclength.Text:= Album.DiscLength;
Label6.Caption:=Album.Year;
for j := 0
to length(Album.Artist)-1
do
listbox3.Items.Add(Album.Artist[j]+'
- '+Album.Title[j]);
break;
Listbox3.Focused;
end;
end;
end;
procedure TCDPlayer.LMDMMButton1Click(Sender: TObject);
begin
Listbox3.Clear;
Listbox1.Clear;
Label4.Caption:='
';
Label6.Caption:='
';
Label7.Caption:='
';
Label10.Visible:=False;
Label11.Visible:=False;
Label12.Visible:=False;
Label13.Visible:=False;
Label14.Visible:=False;
Label8.Visible:=False;
Label9.Visible:=False;
Listbox3.Visible:=False;
end;
procedure TCDPlayer.Button4Click(Sender: TObject);
begin
Label1.Caption:=FormatDateTime('
dddd' + '
dd', Now);
CDDB.LookUpAlbum('
http://freedb.freedb.de',CDAudio.GetDiscCDDBID(combobox1.itemindex),
'
nix@freenet.de','
test','
1');
timer1.enabled := true;
Button4.Font.Color:=clLime;
MediaPlayer1.Play;
Timer3.Enabled:=True;
end;
procedure TCDPlayer.Timer2Timer(Sender: TObject);
begin
Listbox1.SetFocus;
Listbox1.Selected[0]:=True;
Listbox1Click(
nil);
Timer2.Enabled:=False;
Button8Click(
nil);
Listbox3.SetFocus;
Listbox3.Selected[0]:=True;
end;
procedure TCDPlayer.Button3Click(Sender: TObject);
begin
MediaPlayer1.Stop;
Button3.Font.Color:=clRed;
Button4.Font.Color:=clWhite;
Timer3.Enabled:=False;
end;
procedure TCDPlayer.Button7Click(Sender: TObject);
begin
MediaPlayer1.Next;
end;
procedure TCDPlayer.Button1Click(Sender: TObject);
begin
MediaPlayer1.Previous;
end;
procedure TCDPlayer.Button5Click(Sender: TObject);
begin
MediaPlayer1.Pause;
end;
procedure TCDPlayer.FormShow(Sender: TObject);
begin
Listbox3.Visible:=True;
Label10.Visible:=True;
Label11.Visible:=True;
Label12.Visible:=True;
Label13.Visible:=True;
Label14.Visible:=True;
Label8.Visible:=True;
Label9.Visible:=True;
end;
procedure TCDPlayer.Timer3Timer(Sender: TObject);
var Trk, Min, Sec: Word;
begin
with MediaPlayer1
do
begin
Trk := MCI_TMSF_TRACK(Position);
Min := MCI_TMSF_MINUTE(Position);
Sec := MCI_TMSF_SECOND(Position);
label8.Caption := '
Track '+Format('
%.2d', [Trk]);
Label9.Caption := Format('
%.2d:%.2d', [Min, Sec]);
end;
end;
end.