Emergency 20 Dokumentation  4.2.0
AudioComponent.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/audio/AudioProxy.h"
14 
17 #include <qsf/job/JobProxy.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
42  {
43 
44 
45  //[-------------------------------------------------------]
46  //[ Public definitions ]
47  //[-------------------------------------------------------]
48  public:
49  static const uint32 COMPONENT_ID;
50 
51  enum AudioSet
52  {
58  AUDIOSET_DEMONSTRATION_MOB_MODERN
59  };
60 
61 
62  //[-------------------------------------------------------]
63  //[ Public methods ]
64  //[-------------------------------------------------------]
65  public:
73  inline explicit AudioComponent(qsf::Prototype* prototype);
74 
79  inline virtual ~AudioComponent();
80 
81  //[-------------------------------------------------------]
82  //[ CAMP getters and setters ]
83  //[-------------------------------------------------------]
84  inline AudioSet getAudioSet() const;
85  inline void setAudioSet(AudioSet audioSet);
86 
87  inline float getRandomWaitIntervalStart() const;
88  inline void setRandomWaitIntervalStart(float randomWaitIntervalStart);
89 
90  inline float getRandomWaitIntervalEnd() const;
91  inline void setRandomWaitIntervalEnd(float randomWaitIntervalEnd);
92 
93  inline float getRandomProbability() const;
94  inline void setRandomProbability(float randomProbability);
95 
96 
97  //[-------------------------------------------------------]
98  //[ Public virtual qsf::Component methods ]
99  //[-------------------------------------------------------]
100  public:
101  virtual void serialize(qsf::BinarySerializer& serializer) override;
102 
103 
104  //[-------------------------------------------------------]
105  //[ Protected virtual qsf::Component methods ]
106  //[-------------------------------------------------------]
107  protected:
108  virtual void onSetActive(bool active) override;
109  virtual bool onStartup() override;
110  virtual void onShutdown() override;
111 
112 
113  //[---------------------------------------------------------------]
114  //[ Protected virtual qsf::MovableObjectRenderingListener methods ]
115  //[---------------------------------------------------------------]
116  protected:
117  virtual Component* getMovableObjectRenderingListenerComponent() override;
118  virtual void registerMovableObjectRenderingListener() override;
119  virtual void unregisterMovableObjectRenderingListener() override;
120 
121 
122  //[-----------------------------------------------------------------------]
123  //[ Protected virtual qsf::JobProxyMovableObjectRenderingListener methods ]
124  //[-----------------------------------------------------------------------]
125  protected:
126  virtual void onUpdateMovableObjectRenderingJob(const qsf::JobArguments& jobArguments) override;
127 
128 
129  //[-------------------------------------------------------]
130  //[ Private methods ]
131  //[-------------------------------------------------------]
132  private:
133  bool checkCountdownAndProbability(const qsf::Time& timePassed);
134 
135 
136  //[-------------------------------------------------------]
137  //[ Private data ]
138  //[-------------------------------------------------------]
139  private:
140  AudioProxy mAudioProxy;
141  qsf::Time mTimeUntilNextPlayback;
142 
143  // Camp export
144  AudioSet mAudioSet;
145  float mRandomWaitIntervalStart;
146  float mRandomWaitIntervalEnd;
147  float mRandomProbability;
148 
149 
150  //[-------------------------------------------------------]
151  //[ CAMP reflection system ]
152  //[-------------------------------------------------------]
153  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
154 
155 
156  };
157 
158 
159 //[-------------------------------------------------------]
160 //[ Namespace ]
161 //[-------------------------------------------------------]
162 } // em5
163 
164 
165 //[-------------------------------------------------------]
166 //[ Implementation ]
167 //[-------------------------------------------------------]
169 
170 
171 //[-------------------------------------------------------]
172 //[ CAMP reflection system ]
173 //[-------------------------------------------------------]
175 QSF_CAMP_TYPE_NONCOPYABLE(em5::AudioComponent::AudioSet)
Definition: ActionPriority.h:13
Abstract component class.
Definition: Component.h:105
Definition: AudioComponent.h:56
Job proxy based OGRE movable object rendering listener.
Definition: JobProxyMovableObjectRenderingListener.h:31
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: AudioComponent.h:54
Job arguments class: holds data to be passed to the called job method by the job manager.
Definition: JobArguments.h:40
void serialize(BinarySerializer &serializer, BitFlagSet< STORAGE, ENUM > &bitFlagSet)
Definition: BitFlagSet.h:359
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
EMERGENCY 5 audio component class.
Definition: AudioComponent.h:41
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Prototype class.
Definition: Prototype.h:100
AudioSet
Definition: AudioComponent.h:51
Definition: AudioComponent.h:55
static const uint32 COMPONENT_ID
"em5::AudioComponent" unique component ID
Definition: AudioComponent.h:49
Binary serializer class.
Definition: BinarySerializer.h:35
Definition: AudioComponent.h:53
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32