Emergency 20 Dokumentation  4.2.0
AudioHelper.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
15 #include <qsf/time/Time.h>
16 
17 #include <boost/noncopyable.hpp>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Forward declarations ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25  class AudioProxy;
26 }
27 namespace qsf
28 {
29  class Entity;
30 }
31 
32 
33 //[-------------------------------------------------------]
34 //[ Namespace ]
35 //[-------------------------------------------------------]
36 namespace em5
37 {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Classes ]
42  //[-------------------------------------------------------]
47  class EM5_API_EXPORT AudioHelper : public boost::noncopyable
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public static methods ]
53  //[-------------------------------------------------------]
54  public:
55  static void playSound(const std::string& sfxFilename, AudioProxy& audioProxy);
56  static void playSound(const std::string& sfxFilename, AudioProxy& audioProxy, qsf::Entity& entity);
57  static void playDelayedSound(const std::string& sfxFilename, AudioProxy& audioProxy, qsf::Entity& entity, const qsf::Time& delay);
58  static void playLoopSound(const std::string& sfxFilename, AudioProxy& audioProxy, qsf::Entity& entity);
59 
60  static std::string getGenderedCivilSound(const qsf::Entity& entity, const std::string& audioName);
61 
62  // Siren
63  static void setSirenFirefighter(AudioProxy& audioProxy, qsf::Entity& entity);
64  static void setSirenFirefighterFLB(AudioProxy& audioProxy, qsf::Entity& entity);
65  static void setSirenPolice(AudioProxy& audioProxy, qsf::Entity& entity);
66  static void setSirenRescue(AudioProxy& audioProxy, qsf::Entity& entity);
67  static void setSirenTech(AudioProxy& audioProxy, qsf::Entity& entity);
68  static void setSirenHistoric(AudioProxy& audioProxy, qsf::Entity& entity);
69 
70  // Vehicle sounds
71  static void playOpenNormalDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
72  static void playCloseNormalDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
73  static void playOpenTrunkDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
74  static void playCloseTrunkDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
75  static void playOpenSlidingDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
76  static void playCloseSlidingDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
77  static void playRWRollUpDoorSound(AudioProxy& audioProxy, qsf::Entity& entity);
78  static void playExtinguishFireWithTLFSound(AudioProxy& audioProxy, qsf::Entity& entity);
79  static void playRotorAcceleratingSound(AudioProxy& audioProxy, qsf::Entity& entity);
80  static void playRotorNormalSound(AudioProxy& audioProxy, qsf::Entity& entity);
81  static void playRotorDecceleratingSound(AudioProxy& audioProxy, qsf::Entity& entity);
82  static void playTowCraneMove(AudioProxy& audioProxy, qsf::Entity& entity);
83  static void playTowCraneRope(AudioProxy& audioProxy, qsf::Entity& entity);
84  static void playTowCraneClonk(AudioProxy& audioProxy, qsf::Entity& entity);
85  static void playCraneExtendLegs(AudioProxy& audioProxy, qsf::Entity& entity);
86  static void playCraneHideLegs(AudioProxy& audioProxy, qsf::Entity& entity);
87  static void playCraneCockpitUp(AudioProxy& audioProxy, qsf::Entity& entity);
88  static void playCraneCockpitDown(AudioProxy& audioProxy, qsf::Entity& entity);
89  static void playCraneMove(AudioProxy& audioProxy, qsf::Entity& entity);
90  static void playCraneHook(AudioProxy& audioProxy, qsf::Entity& entity);
91  static void playCraneDeployObject(AudioProxy& audioProxy, qsf::Entity& entity);
92  static void playHelicopterRopeInstall(AudioProxy& audioProxy, qsf::Entity& entity);
93  static void playHelicopterRopeMove(AudioProxy& audioProxy, qsf::Entity& entity);
94  static void playHelicopterRopeAttach(AudioProxy& audioProxy, qsf::Entity& entity);
95  static void playHelicopterSearchLightOn(AudioProxy& audioProxy, qsf::Entity& entity);
96  static void playSEKDroneStart(AudioProxy& audioProxy, qsf::Entity& entity);
97  static void playSEKDroneMove(AudioProxy& audioProxy, qsf::Entity& entity);
98  static void playSEKDroneClick(AudioProxy& audioProxy, qsf::Entity& entity);
99  static void playFWDroneMove(AudioProxy& audioProxy, qsf::Entity& entity);
100  static void playSEKRoboterRamp(AudioProxy& audioProxy, qsf::Entity& entity);
101  static void playSEKRoboterDefuseBombe(AudioProxy& audioProxy, qsf::Entity& entity);
102  static void playDecontaminatePerson(AudioProxy& audioProxy, qsf::Entity& entity);
103  static void playDLKLadderMove(AudioProxy& audioProxy, qsf::Entity& entity);
104  static void playDLKLadderKlonk(AudioProxy& audioProxy, qsf::Entity& entity);
105  static void playDLKExtinguish(AudioProxy& audioProxy, qsf::Entity& entity);
106  static void playFLBExtinguish(AudioProxy& audioProxy, qsf::Entity& entity);
107  static void playBoatUnloadIntoWater(AudioProxy& audioProxy, qsf::Entity& entity);
108  static void playBoatLoadFromWater(AudioProxy& audioProxy, qsf::Entity& entity);
109  static void playBoatDropOnTransporter(AudioProxy& audioProxy, qsf::Entity& entity);
110  static void playCommandoCarRadarSound(AudioProxy& audioProxy, qsf::Entity& entity);
111  static void playCommandoCarUseFirePlane(AudioProxy& audioProxy);
112  static void playFirePlaneMovingSound(AudioProxy& audioProxy, qsf::Entity& entity);
113  static void playFirePlaneEffectStart(AudioProxy& audioProxy, qsf::Entity& entity);
114  static void playFirePlaneEffectImpact(AudioProxy& audioProxy, qsf::Entity& entity);
115 
116  // Personnel sounds
117  static void playDoctorOpenCase(AudioProxy& audioProxy, qsf::Entity& entity);
118  static void playDoctorCloseCase(AudioProxy& audioProxy, qsf::Entity& entity);
119  static void playDoctorDefibrilator(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
120  static void playDoctorEkgDiagnose(AudioProxy& audioProxy, qsf::Entity& entity);
121  static void playDoctorEkgDeath(AudioProxy& audioProxy, qsf::Entity& entity);
122  static void playDoctorVentilation(AudioProxy& audioProxy, qsf::Entity& entity);
123  static void playMedicStretcherMove(AudioProxy& audioProxy, qsf::Entity& entity);
124  static void playMedicStretcherFold(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
125  static void playRescueDogWhistle(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
126  static void playRescueDogPant(AudioProxy& audioProxy, qsf::Entity& entity);
127  static void playRescueDogBark(AudioProxy& audioProxy, qsf::Entity& entity);
128  static void playEngineer(AudioProxy& audioProxy, qsf::Entity& entity);
129  static void playEngineerReparingBuildingSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
130  static void playPolicePepperSpray(AudioProxy& audioProxy, qsf::Entity& entity);
131  static void playPoliceHandcuffs(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
132  static void playPoliceMegaphone(AudioProxy& audioProxy, qsf::Entity& entity);
133  static void playSEKRoping(AudioProxy& audioProxy, qsf::Entity& entity);
134  static void playSEKPistoleShot(AudioProxy& audioProxy, qsf::Entity& entity);
135  static void playSEKRifleShot(AudioProxy& audioProxy, qsf::Entity& entity);
136  static void playSEKFlashGrenade(AudioProxy& audioProxy, qsf::Entity& entity);
137  static void playFirefighterExtinguisherStartSound(AudioProxy& audioProxy, qsf::Entity& entity);
138  static void playFirefighterExtinguisherExtinguishSound(AudioProxy& audioProxy, qsf::Entity& entity);
139  static void playFirefighterHoseConnectSound(AudioProxy& audioProxy, qsf::Entity& entity);
140  static void playFirefighterHoseExtinguishSound(AudioProxy& audioProxy, qsf::Entity& entity);
141  static void playFirefighterSawStart(AudioProxy& audioProxy, qsf::Entity& entity);
142  static void playFirefighterSawRunning(AudioProxy& audioProxy, qsf::Entity& entity);
143  static void playFirefighterScissorsCompressorDrop(AudioProxy& audioProxy, qsf::Entity& entity);
144  static void playFirefighterScissorsCompressorRunning(AudioProxy& audioProxy, qsf::Entity& entity);
145  static void playFirefighterScissorsSound(AudioProxy& audioProxy, qsf::Entity& entity);
146  static void playFirefighterAxe(AudioProxy& audioProxy, qsf::Entity& entity);
147  static void playFirefighterHistoricExtinguisherStart(AudioProxy& audioProxy, qsf::Entity& entity);
148  static void playFirefighterHistoricExtinguisherRunning(AudioProxy& audioProxy, qsf::Entity& entity);
149  static void playFirefighterHistoricSawStart(AudioProxy& audioProxy, qsf::Entity& entity);
150  static void playFirefighterHistoricSawRunning(AudioProxy& audioProxy, qsf::Entity& entity);
151  static void playDiverDive(AudioProxy& audioProxy, qsf::Entity& entity);
152  static void playDiverEmerge(AudioProxy& audioProxy, qsf::Entity& entity);
153  static void playHistoricDoctorSendHome(AudioProxy& audioProxy, qsf::Entity& entity);
154  static void playHistoricDoctorCleanHome(AudioProxy& audioProxy, qsf::Entity& entity);
155  static void playHistoricDoctorCleanHome2(AudioProxy& audioProxy, qsf::Entity& entity);
156 
157  // Civil vehicles
158  static void playCivilPkwHorn(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
159  static void playCivilBusHorn(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
160  static void playCivilLkwHorn(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
161  static void playCivilHonkingFest(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
162 
163  static void playTramStart(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
164  static void playTramRunning(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
165  static void playTramStop(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
166 
167  static void playICEStart(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
168  static void playICERunning(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
169  static void playICEStop(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
170 
171  static void playTrainStart(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
172  static void playTrainRunning(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
173  static void playTrainStop(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
174 
175  static void playCivilFreighter(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
176  static void playCivilCutter(AudioProxy& audioProxy, qsf::Entity& entity); // TODO(tl): Not implemented yet
177 
178  // Gangster
179  static void playGangsterFistVersion1(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
180  static void playGangsterFistVersion2(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
181 
182  static void playGangsterKickVersion1(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
183  static void playGangsterKickVersion2(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
184 
185  static void playGangsterPistoleShot(AudioProxy& audioProxy, qsf::Entity& entity);
186 
187  // Building
188  static void playBuildingBreakdownSmallSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
189  static void playBuildingBreakdownMediumSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
190  static void playBuildingBreakdownBigSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
191  static void playBuildingWindowDestroyedSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
192  static void playBuildingAttackingSound1(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
193  static void playBuildingAttackingSound2(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
194  static void playBuildingEvacuateSound(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
195  static void playBuildingEvacuateSound2(AudioProxy& audioProxy, qsf::Entity& entity, qsf::Time delay = qsf::Time::ZERO);
196 
197  // Destruction
198  static void playExplosionSmallSound(AudioProxy& audioProxy, qsf::Entity& entity);
199  static void playExplosionVehicleSound(AudioProxy& audioProxy, qsf::Entity& entity);
200  static void playExplosionBigSound(AudioProxy& audioProxy, qsf::Entity& entity);
201  static void playExplosionVeryBigSound(AudioProxy& audioProxy, qsf::Entity& entity);
202  static void playTreeDownSound(AudioProxy& audioProxy, qsf::Entity& entity);
203 
204  // Events
205  static void playBombTicking(AudioProxy& audioProxy, qsf::Entity& entity);
206  static void playBombExplosion(AudioProxy& audioProxy, qsf::Entity& entity);
207  static void playDiveSpot(AudioProxy& audioProxy, qsf::Entity& entity);
208 
209  static void playControlBoxSparks(AudioProxy& audioProxy, qsf::Entity& entity);
210  static void playControlBoxFlash(AudioProxy& audioProxy, qsf::Entity& entity);
211  static void playControlBoxStartBurning(AudioProxy& audioProxy, qsf::Entity& entity);
212 
213  // ME01
214  static void playME01SparksShowerSound(AudioProxy& audioProxy, qsf::Entity& entity);
215  static void playME01KerosineIgnitionSound(AudioProxy& audioProxy, qsf::Entity& entity);
216 
217  // GUI
218  static void playLeftMouseClickSound(AudioProxy& audioProxy);
219  static void playRightMouseClickSound(AudioProxy& audioProxy);
220 
221 
222  //[-------------------------------------------------------]
223  //[ Private static methods ]
224  //[-------------------------------------------------------]
225  private:
226  static const std::string& getPersonType(const qsf::Entity& entity);
227 
228 
229  //[-------------------------------------------------------]
230  //[ Private methods ]
231  //[-------------------------------------------------------]
232  private:
237  inline AudioHelper();
238 
243  inline ~AudioHelper();
244 
245 
246  //[-------------------------------------------------------]
247  //[ Private static data ]
248  //[-------------------------------------------------------]
249  private:
250  static const float mDoorSoundsMaximumDistance;
251  static const float mDoorSoundsReferenceDistance;
252 
253 
254  };
255 
256 
257 //[-------------------------------------------------------]
258 //[ Namespace ]
259 //[-------------------------------------------------------]
260 } // em5
261 
262 
263 //[-------------------------------------------------------]
264 //[ Implementation ]
265 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
#define EM5_API_EXPORT
Definition: Export.h:28
static const Time ZERO
A zero value for time.
Definition: Time.h:40
Definition: PickupPersonByParamedicAction.h:21
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
Static EMERGENCY 5 audio helper class.
Definition: AudioHelper.h:47
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32