| 1 |
{ |
| 2 |
Copyright 2007-2021 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Initialize sounds (TCastleSound instances). } |
| 17 |
unit GameSound; |
| 18 |
|
| 19 |
interface |
| 20 |
|
| 21 |
uses Classes, CastleSoundEngine; |
| 22 |
|
| 23 |
type |
| 24 |
TAllSounds = class(TComponent) |
| 25 |
SoundIntroMusic, |
| 26 |
SoundMainMenuMusic, |
| 27 |
SoundMenuClick, |
| 28 |
SoundMenuCurrentItemChanged: TCastleSound; |
| 29 |
constructor Create(AOwner: TComponent); override; |
| 30 |
end; |
| 31 |
|
| 32 |
var |
| 33 |
{ Create in InitializeSound, destroyed in finalization. } |
| 34 |
AllSounds: TAllSounds; |
| 35 |
|
| 36 |
procedure InitializeSound; |
| 37 |
|
| 38 |
implementation |
| 39 |
|
| 40 |
uses SysUtils, |
| 41 |
CastleComponentSerialize; |
| 42 |
|
| 43 |
procedure InitializeSound; |
| 44 |
begin |
| 45 |
AllSounds := TAllSounds.Create(nil); |
| 46 |
end; |
| 47 |
|
| 48 |
constructor TAllSounds.Create(AOwner: TComponent); |
| 49 |
begin |
| 50 |
inherited; |
| 51 |
ComponentLoad('castle-data:/sounds/all_sounds.castle-component', Self); |
| 52 |
SoundIntroMusic := FindRequiredComponent('SoundIntroMusic') as TCastleSound; |
| 53 |
SoundMainMenuMusic := FindRequiredComponent('SoundMainMenuMusic') as TCastleSound; |
| 54 |
SoundMenuClick := FindRequiredComponent('SoundMenuClick') as TCastleSound; |
| 55 |
SoundMenuCurrentItemChanged := FindRequiredComponent('SoundMenuCurrentItemChanged') as TCastleSound; |
| 56 |
end; |
| 57 |
|
| 58 |
initialization |
| 59 |
finalization |
| 60 |
FreeAndNil(AllSounds); |
| 61 |
end. |