{Эту прогу я составил за один день. Ещё толком не испытана (составлял и
проверял на NT4. Так что, если будут глюки и баги, пишите на liceist200@mail.ru
постараюсь исправить. Вообще неплохая прога. Воспроизводит по порядку все
WAV, AVI, MIDI файлы из заданного каталога.
                                            Автор: W!W!W!}

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, FileCtrl, lmdcctrl, lmdctrl, lmdeditb, lmdeditc,
  lmdbredt, MPlayer, Gauges, Buttons;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    btnPause: TSpeedButton;
    btnPlay: TSpeedButton;
    btnStop: TSpeedButton;
    FileListBox1: TFileListBox;
    btnBack: TSpeedButton;
    btnNext: TSpeedButton;
    MediaPlayer1: TMediaPlayer;
    FilterComboBox1: TFilterComboBox;
    LMDBrowseEdit1: TLMDBrowseEdit;
    Gauge1: TGauge;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure btnPlayClick(Sender: TObject);
    procedure FileListBox1Change(Sender: TObject);
    procedure btnPauseClick(Sender: TObject);
    procedure btnStopClick(Sender: TObject);
    procedure btnNextClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure btnBackClick(Sender: TObject);
    procedure LMDBrowseEdit1AfterExit(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}


procedure TForm1.FormCreate(Sender: TObject);
begin
if filelistbox1.FileName <> '' then
begin
  btnPlay.Enabled := true;
  btnBack.Enabled := true;
  btnNext.Enabled := true;
end;
end;

procedure TForm1.btnPlayClick(Sender: TObject);
begin
with mediaplayer1 do
begin
  if filelistbox1.filename <> '' then
  filename := filelistbox1.FileName;
if mediaplayer1.Mode <> mpPaused then begin
  open;
  play;
  end
else pause;
  btnPause.Enabled := true;
  btnStop.Enabled := true;
  btnPlay.Enabled := false;
end;
end;


procedure TForm1.FileListBox1Change(Sender: TObject);
begin
 with mediaplayer1 do
    if filelistbox1.FileName <> '' then
    begin
    fileName := filelistbox1.FileName ;
    open;
    play;
    btnPause.Enabled := true;
    btnStop.Enabled := true;
    btnPlay.Enabled := false;
    end;
end;

procedure TForm1.btnPauseClick(Sender: TObject);
begin
case mediaplayer1.Mode of
  mpPaused: btnPlay.Enabled := true;
  mpPlaying:
  begin
  btnPause.Enabled := false;
  btnPlay.Enabled := true;
  end;
end;
mediaplayer1.Pause;

end;

procedure TForm1.btnStopClick(Sender: TObject);
begin
gauge1.Progress := 0;
with mediaplayer1 do
if filename <> '' then
begin
stop;
//close;
end;
btnPlay.Enabled := true;
btnStop.Enabled := false;
btnPause.Enabled := false;
end;

procedure TForm1.btnNextClick(Sender: TObject);
begin
with filelistbox1 do
filelistbox1.ItemIndex := itemindex+1;
btnPlay.OnClick(sender);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
with mediaplayer1 do
if mode = mpPlaying then
  gauge1.Progress := round(100*position/length);
if gauge1.Progress = 100 then
  btnNext.OnClick(sender);
end;



procedure TForm1.btnBackClick(Sender: TObject);
begin
 with filelistbox1 do
filelistbox1.ItemIndex := itemindex-1;
btnPlay.OnClick(sender);

end;



procedure TForm1.LMDBrowseEdit1AfterExit(Sender: TObject);
begin
  if LMDBrowseEdit1.Text <> '' then
  filelistbox1.Directory := LMDBrowseEdit1.Text;

end;

end.
