unit uTestSpecAna;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, _GClass, AbLED, uRiff, uRiffIF  ;

type
  TfrmTestSpecAna = class(TForm)
    btnFileInUse: TButton;
    ledFileInUse: TAbLED;
    edFileName: TEdit;
    btnFileExist: TButton;
    ledFileExists: TAbLED;
    moSML: TMemo;
    btnSetSML: TButton;
    ledSetSML: TAbLED;
    procedure btnFileInUseClick(Sender: TObject);
    procedure btnFileExistClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnSetSMLClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmTestSpecAna: TfrmTestSpecAna;

implementation

{$R *.dfm}

uses uSpectrumAnalyzer;



procedure TfrmTestSpecAna.btnFileExistClick(Sender: TObject);
begin
  if FileExists(edFileName.Text) then
  begin
    ledFileExists.LED.ColorOn := cllime;
    ledFileExists.Caption := 'Yes - File Exists';
  end
  else
  begin
    ledFileExists.LED.ColorOn := clRed;
    ledFileExists.Caption := 'No - File does not exist';
  end;
  ledFileExists.checked := true;
end;

procedure TfrmTestSpecAna.btnFileInUseClick(Sender: TObject);
var
  res: boolean;
begin
  If (frmSpecAna.FileInUse(edFileName.Text)) then
  begin
    ledFileInUse.LED.ColorOn := clRed;
    ledFileInUse.Caption := 'Yes - In use';
  end

  else
  begin
    ledFileInUse.LED.ColorOn := cllime;
    ledFileInUse.Caption := 'No Ready to use';
  end;

  ledFileInUse.checked := true;
end;

procedure TfrmTestSpecAna.btnSetSMLClick(Sender: TObject);
var
  ansiSML: AnsiString;
  res: boolean;
begin

  frmSpecAna.WAVFileNameAtEOFrame := edFileName.Text;
  ansiSML := moSML.Text;
  res := frmSpecAna.setSML(ansiSML);
  ledSetSML.checked := res;
end;

procedure TfrmTestSpecAna.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//if True then

end;

procedure TfrmTestSpecAna.FormCreate(Sender: TObject);
begin
  ledFileInUse.checked := false;
  ledFileExists.checked := false;
end;

end.
