2014-09-12 13:55:50 +00:00
|
|
|
unit umainform;
|
|
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2014-09-14 15:04:10 +00:00
|
|
|
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs,
|
2016-07-20 20:08:46 +00:00
|
|
|
StdCtrls, Buttons, ExtCtrls, uplaysound;
|
2014-09-12 13:55:50 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
|
|
|
|
{ Tmainform }
|
|
|
|
|
|
|
|
Tmainform = class(TForm)
|
|
|
|
BitBtn1: TBitBtn;
|
2016-07-20 20:08:46 +00:00
|
|
|
cmd_StopSound: TButton;
|
2014-09-12 13:55:50 +00:00
|
|
|
cmd_Async: TButton;
|
|
|
|
cmd_Sync: TButton;
|
|
|
|
playsound1: Tplaysound;
|
2014-09-14 15:04:10 +00:00
|
|
|
TIPropertyGrid1: TTIPropertyGrid;
|
2014-09-12 13:55:50 +00:00
|
|
|
procedure cmd_AsyncClick(Sender: TObject);
|
2016-07-20 20:08:46 +00:00
|
|
|
procedure cmd_StopSoundClick(Sender: TObject);
|
2014-09-12 13:55:50 +00:00
|
|
|
procedure cmd_SyncClick(Sender: TObject);
|
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
|
private
|
|
|
|
{ private declarations }
|
|
|
|
public
|
|
|
|
{ public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
mainform: Tmainform;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
{$R *.lfm}
|
|
|
|
|
|
|
|
{ Tmainform }
|
|
|
|
|
|
|
|
procedure Tmainform.cmd_AsyncClick(Sender: TObject);
|
|
|
|
// No gap between sounds. App remains responsive
|
|
|
|
begin
|
2016-07-20 20:08:46 +00:00
|
|
|
{$IFDEF WINDOWS}
|
2014-09-12 13:55:50 +00:00
|
|
|
playsound1.PlayStyle:=psASync;
|
|
|
|
playsound1.SoundFile:='doorbell.wav';
|
|
|
|
playsound1.Execute;
|
|
|
|
playsound1.SoundFile:='telephone.wav';
|
|
|
|
playsound1.Execute;
|
2016-07-20 20:08:46 +00:00
|
|
|
{$ELSE}
|
|
|
|
// Sound file taken from PropertyGrid
|
|
|
|
playsound1.Execute;
|
|
|
|
{$ENDIF}
|
2014-09-12 13:55:50 +00:00
|
|
|
end;
|
|
|
|
|
2016-07-20 20:08:46 +00:00
|
|
|
procedure Tmainform.cmd_StopSoundClick(Sender: TObject);
|
2016-03-12 08:20:23 +00:00
|
|
|
begin
|
|
|
|
playsound1.StopSound;
|
|
|
|
end;
|
|
|
|
|
2014-09-12 13:55:50 +00:00
|
|
|
procedure Tmainform.cmd_SyncClick(Sender: TObject);
|
|
|
|
begin
|
2016-07-20 20:08:46 +00:00
|
|
|
{$IFDEF WINDOWS}
|
2014-09-12 13:55:50 +00:00
|
|
|
playsound1.PlayStyle:=psSync;
|
|
|
|
playsound1.SoundFile:='doorbell.wav';
|
|
|
|
playsound1.Execute;
|
|
|
|
playsound1.SoundFile:='telephone.wav';
|
|
|
|
playsound1.Execute;
|
2016-07-20 20:08:46 +00:00
|
|
|
{$ELSE}
|
|
|
|
// Sound file taken from PropertyGrid
|
|
|
|
playsound1.Execute;
|
|
|
|
{$ENDIF}
|
2014-09-12 13:55:50 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure Tmainform.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
Caption:=Application.Title;
|
|
|
|
Icon:=Application.Icon;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|