unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, ExtCtrls;

type
  TfMain = class(TForm)
    btnPrev: TSpeedButton;
    btnNext: TSpeedButton;
    btnPlay: TSpeedButton;
    btnFirst: TSpeedButton;
    btnLast: TSpeedButton;
    btnStop: TSpeedButton;
    btnPause: TSpeedButton;
    btnClose: TSpeedButton;
    btnFileInfo: TSpeedButton;
    Timer: TTimer;
    procedure btnPrevClick(Sender: TObject);
    procedure btnNextClick(Sender: TObject);
    procedure btnPlayClick(Sender: TObject);
    procedure btnLastClick(Sender: TObject);
    procedure btnFirstClick(Sender: TObject);
    procedure btnStopClick(Sender: TObject);
    procedure btnPauseClick(Sender: TObject);
    procedure btnFileInfoClick(Sender: TObject);
    procedure btnCloseClick(Sender: TObject);
    procedure TimerTimer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var fMain: TfMain;

implementation

uses WinAmp;

{$R *.dfm}

procedure TfMain.btnCloseClick(Sender: TObject);
begin
  WinampCommand(PR_CLOSE);
end;

procedure TfMain.btnFileInfoClick(Sender: TObject);
begin
  WinampCommand(PR_FILEINFO);
end;

procedure TfMain.btnFirstClick(Sender: TObject);
begin
  WinampCommand(PL_FIRST);
end;

procedure TfMain.btnLastClick(Sender: TObject);
begin
  WinampCommand(PL_LAST);
end;

procedure TfMain.btnNextClick(Sender: TObject);
begin
  WinampCommand(PL_NEXT);
end;

procedure TfMain.btnPrevClick(Sender: TObject);
begin
  WinampCommand(PL_PREV);
end;

procedure TfMain.btnStopClick(Sender: TObject);
begin
  WinampCommand(PL_STOP);
end;

procedure TfMain.TimerTimer(Sender: TObject);
var Bitrate, Samplerate : integer;
begin
  Caption := 'Winamp Manager';
  Bitrate := WinampUser(1, 126);
  Samplerate := WinampUser(0, 126);
  if (Bitrate > 0) and (Samplerate > 0) then
    Caption := Caption + ' [' + IntToStr(Samplerate) + 'êÃö :: ' + IntToStr(Bitrate) + 'kbps]';
end;

procedure TfMain.btnPauseClick(Sender: TObject);
begin
  WinampCommand(PL_PAUSE);
end;

procedure TfMain.btnPlayClick(Sender: TObject);
begin
  WinampCommand(PL_PLAY);
end;

end.
