-
Notifications
You must be signed in to change notification settings - Fork 1
/
TFlatSoundUnit.pas
68 lines (55 loc) · 1.78 KB
/
TFlatSoundUnit.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unit TFlatSoundUnit;
{***************************************************************}
{ TFlatSound }
{ Copyright ©1999 Lloyd Kinsella. }
{ }
{ FlatStyle is Copyright ©1998-99 Maik Porkert. }
{***************************************************************}
interface
{$I DFS.inc}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
MMSystem;
type
TSoundEvent = (seBtnClick, seMenu, seMenuClick, seMoveIntoBtn, sePanelExpand);
type
TFlatSound = class(TComponent)
private
FEvent: TSoundEvent;
public
procedure Play;
procedure PlayThis(ThisEvent: TSoundEvent);
constructor Create(AOwner: TComponent); override;
published
property Event: TSoundEvent read FEvent write FEvent;
end;
const
Flags = SND_RESOURCE or SND_SYNC;
implementation
{$R FLATSOUND.RES}
constructor TFlatSound.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Event := seBtnClick;
end;
procedure TFlatSound.Play;
begin
case FEvent of
seBtnClick: PlaySound('ENC_001',0,Flags);
seMenu: PlaySound('ENC_002',0,Flags);
seMenuClick: PlaySound('ENC_003',0,Flags);
seMoveIntoBtn: PlaySound('ENC_004',0,Flags);
sePanelExpand: PlaySound('ENC_005',0,Flags);
end;
end;
procedure TFlatSound.PlayThis(ThisEvent: TSoundEvent);
begin
case ThisEvent of
seBtnClick: PlaySound('ENC_001',0,Flags);
seMenu: PlaySound('ENC_002',0,Flags);
seMenuClick: PlaySound('ENC_003',0,Flags);
seMoveIntoBtn: PlaySound('ENC_004',0,Flags);
sePanelExpand: PlaySound('ENC_005',0,Flags);
end;
end;
end.