git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4544 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
gbamber
2016-03-12 08:20:23 +00:00
parent d5fb9128ef
commit 41c844a112
5 changed files with 30 additions and 11 deletions

View File

@ -50,7 +50,6 @@
<Unit0>
<Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="demo"/>
</Unit0>
<Unit1>
<Filename Value="umainform.pas"/>
@ -58,7 +57,6 @@
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="umainform"/>
</Unit1>
</Units>
</ProjectOptions>
@ -78,12 +76,6 @@
</Win32>
</Options>
</Linking>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">

View File

@ -10,7 +10,7 @@ object mainform: Tmainform
DefaultMonitor = dmPrimary
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.2.4.0'
LCLVersion = '1.6.0.1'
object cmd_Async: TButton
Left = 264
Height = 25
@ -44,6 +44,7 @@ object mainform: Tmainform
Height = 238
Top = 8
Width = 252
CheckboxForBoolean = False
DefaultValueFont.Color = clWindowText
Filter = [tkInteger, tkChar, tkEnumeration, tkFloat, tkSet, tkMethod, tkSString, tkLString, tkAString, tkWString, tkVariant, tkArray, tkRecord, tkInterface, tkClass, tkObject, tkWChar, tkBool, tkInt64, tkQWord, tkDynArray, tkInterfaceRaw, tkProcVar, tkUString, tkUChar, tkHelper]
Indent = 16
@ -51,11 +52,20 @@ object mainform: Tmainform
TIObject = playsound1
ValueFont.Color = clMaroon
end
object cmd_StpSound: TButton
Left = 264
Height = 25
Top = 112
Width = 75
Caption = 'Stop Sound'
OnClick = cmd_StpSoundClick
TabOrder = 4
end
object playsound1: Tplaysound
About.Description.Strings = (
'Plays WAVE sounds in Windows or Linux'
)
About.Title = 'About About PlaySound'
About.Title = 'About About About PlaySound'
About.Height = 400
About.Width = 400
About.Font.Color = clNavy

View File

@ -14,11 +14,13 @@ type
Tmainform = class(TForm)
BitBtn1: TBitBtn;
cmd_StpSound: TButton;
cmd_Async: TButton;
cmd_Sync: TButton;
playsound1: Tplaysound;
TIPropertyGrid1: TTIPropertyGrid;
procedure cmd_AsyncClick(Sender: TObject);
procedure cmd_StpSoundClick(Sender: TObject);
procedure cmd_SyncClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
@ -46,6 +48,11 @@ begin
playsound1.Execute;
end;
procedure Tmainform.cmd_StpSoundClick(Sender: TObject);
begin
playsound1.StopSound;
end;
procedure Tmainform.cmd_SyncClick(Sender: TObject);
begin
playsound1.PlayStyle:=psSync;

View File

@ -30,6 +30,7 @@ type
destructor Destroy; reintroduce;
// This is the default method
procedure Execute;
procedure StopSound;
published
{ Published declarations }
// This is normally set at runtime
@ -202,6 +203,15 @@ begin
[fPlayCommand]);
{$ENDIF}
end;
procedure Tplaysound.StopSound;
begin
{$IFDEF WINDOWS}
sndPlaySound(nil, SND_ASYNC or SND_NODEFAULT);
{$ELSE}
if SoundPlayerSyncProcess <> nil then SoundPlayerSyncProcess.Terminate;
if SoundPlayerAsyncProcess <> nil then SoundPlayerAsyncProcess.Terminate;
{$ENDIF}
end;
procedure Register;
begin
@ -209,4 +219,4 @@ begin
{$I playsound_icon.lrs}
end;
end.
end.