ScummVM API documentation
SoundSource.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_SOUNDSOURCE_H
29 #define HPL_SOUNDSOURCE_H
30 
31 #include "common/list.h"
32 #include "hpl1/engine/scene/Entity2D.h"
33 #include "hpl1/engine/system/SystemTypes.h"
34 
35 class TiXmlElement;
36 
37 namespace hpl {
38 
39 class cSound;
40 class iSoundChannel;
41 
42 class cSoundSource : public iEntity2D {
43 public:
44  cSoundSource(const tString &asName, const tString &asSoundName, cSound *apSound, bool abVolatile);
45  ~cSoundSource();
46 
47  tString GetEntityType() { return "SoundSource"; }
48 
49  void UpdateLogic(float afTimeStep);
50 
51  bool LoadData(TiXmlElement *apRootElem);
52 
53  bool IsDead();
54 
55  void SetInterval(int alX) { mlInterval = alX; }
56  void SetLoop(bool abX) { mbLoop = abX; }
57  void SetRelative(bool abX) { mbRelative = abX; }
58  void SetMaxDist(float afX) { mfMaxDist = afX; }
59  void SetMinDist(float afX) { mfMinDist = afX; }
60  void SetRandom(int alX) { mlRandom = alX; }
61  void SetVolume(float afX) { mfVolume = afX; }
62 
63  iSoundChannel *GetSoundChannel() { return mpSoundChannel; }
64 
65  const cRect2f &GetBoundingBox();
66  bool UpdateBoundingBox();
67 
68  void Stop();
69 
70 private:
71  cSound *mpSound;
72  bool mbVolatile;
73 
74  int mlInterval;
75  bool mbLoop;
76  bool mbRelative;
77  float mfMaxDist;
78  float mfMinDist;
79  int mlRandom;
80  tString msSoundName;
81  float mfVolume;
82  int mlCounter;
83 
84  bool mbPlaying;
85 
86  iSoundChannel *mpSoundChannel;
87 
88  void Play();
89 };
90 
93 
94 } // namespace hpl
95 
96 #endif // HPL_SOUNDSOURCE_H
Definition: AI.h:36
Definition: str.h:59
Definition: Sound.h:40
Definition: SoundSource.h:42
Definition: SoundChannel.h:46
Definition: Entity2D.h:39
Definition: tinyxml.h:864
Definition: list_intern.h:51