playsoundpackage: More flexible usage of PlayCommand (empty string = builtin command). Improve demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5016 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-20 20:08:46 +00:00
parent 46e048dc53
commit 0299f6dba7
3 changed files with 39 additions and 20 deletions

View File

@ -10,7 +10,7 @@ object mainform: Tmainform
DefaultMonitor = dmPrimary
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.6.0.1'
LCLVersion = '1.7'
object cmd_Async: TButton
Left = 264
Height = 25
@ -52,20 +52,20 @@ object mainform: Tmainform
TIObject = playsound1
ValueFont.Color = clMaroon
end
object cmd_StpSound: TButton
object cmd_StopSound: TButton
Left = 264
Height = 25
Top = 112
Width = 75
Caption = 'Stop Sound'
OnClick = cmd_StpSoundClick
OnClick = cmd_StopSoundClick
TabOrder = 4
end
object playsound1: Tplaysound
About.Description.Strings = (
'Plays WAVE sounds in Windows or Linux'
)
About.Title = 'About About About PlaySound'
About.Title = 'About About About About About About PlaySound'
About.Height = 400
About.Width = 400
About.Font.Color = clNavy
@ -77,9 +77,7 @@ object mainform: Tmainform
About.AuthorEmail = 'minesadorada@charcodelvalle.com'
About.ComponentName = 'PlaySound'
About.LicenseType = abLGPL
SoundFile = '/home/gordon/development/lazarus/'
PlayCommand = 'sndPlaySnd'
left = 4
top = 8
left = 104
top = 40
end
end

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, RTTIGrids, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, uplaysound;
StdCtrls, Buttons, ExtCtrls, uplaysound;
type
@ -14,13 +14,13 @@ type
Tmainform = class(TForm)
BitBtn1: TBitBtn;
cmd_StpSound: TButton;
cmd_StopSound: TButton;
cmd_Async: TButton;
cmd_Sync: TButton;
playsound1: Tplaysound;
TIPropertyGrid1: TTIPropertyGrid;
procedure cmd_AsyncClick(Sender: TObject);
procedure cmd_StpSoundClick(Sender: TObject);
procedure cmd_StopSoundClick(Sender: TObject);
procedure cmd_SyncClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
@ -41,26 +41,35 @@ implementation
procedure Tmainform.cmd_AsyncClick(Sender: TObject);
// No gap between sounds. App remains responsive
begin
{$IFDEF WINDOWS}
playsound1.PlayStyle:=psASync;
playsound1.SoundFile:='doorbell.wav';
playsound1.Execute;
playsound1.SoundFile:='telephone.wav';
playsound1.Execute;
{$ELSE}
// Sound file taken from PropertyGrid
playsound1.Execute;
{$ENDIF}
end;
procedure Tmainform.cmd_StpSoundClick(Sender: TObject);
procedure Tmainform.cmd_StopSoundClick(Sender: TObject);
begin
playsound1.StopSound;
end;
procedure Tmainform.cmd_SyncClick(Sender: TObject);
begin
{$IFDEF WINDOWS}
playsound1.PlayStyle:=psSync;
playsound1.SoundFile:='doorbell.wav';
playsound1.Execute;
playsound1.SoundFile:='telephone.wav';
playsound1.Execute;
{$ELSE}
// Sound file taken from PropertyGrid
playsound1.Execute;
{$ENDIF}
end;
procedure Tmainform.FormCreate(Sender: TObject);