Emergency 20 Dokumentation  4.2.0
PlayAudioAction.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 
18 
19 //[-------------------------------------------------------]
20 //[ Namespace ]
21 //[-------------------------------------------------------]
22 namespace em5
23 {
24 
25 
26  //[-------------------------------------------------------]
27  //[ Classes ]
28  //[-------------------------------------------------------]
34  {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Public definitions ]
39  //[-------------------------------------------------------]
40  public:
42 
43 
44  //[-------------------------------------------------------]
45  //[ Public methods ]
46  //[-------------------------------------------------------]
47  public:
53 
58  virtual ~PlayAudioAction();
59 
67  void init(const std::string& audioSource,
68  qsf::Entity* entity = nullptr,
69  bool spatial = false,
70  bool loopAudio = false,
71  bool waitForFinish = false,
72  const boost::optional<qsf::Time> maxPlayTime = boost::optional<qsf::Time>(),
73  bool startAudioNowInInit = false);
74 
75 
76  //[-------------------------------------------------------]
77  //[ Public virtual qsf::Actions methods ]
78  //[-------------------------------------------------------]
79  public:
80  virtual void serialize(qsf::BinarySerializer& serializer) override;
81 
82 
83  //[-------------------------------------------------------]
84  //[ Protected virtual qsf::Action methods ]
85  //[-------------------------------------------------------]
86  protected:
87  virtual bool onStartup() override;
88  virtual qsf::action::Result updateAction(const qsf::Clock& clock) override;
89 
90 
91  //[-------------------------------------------------------]
92  //[ Private data ]
93  //[-------------------------------------------------------]
94  private:
95  AudioProxy mAudioProxy;
96  bool mWaitForFinish;
97  boost::optional<qsf::Time> mMaxPlayTime;
98  bool mInitSucceeded;
99 
100 
101  //[-------------------------------------------------------]
102  //[ CAMP reflection system ]
103  //[-------------------------------------------------------]
104  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
105 
106 
107  };
108 
109 
110 //[-------------------------------------------------------]
111 //[ Namespace ]
112 //[-------------------------------------------------------]
113 } // em5
114 
115 
116 //[-------------------------------------------------------]
117 //[ CAMP reflection system ]
118 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Entity class.
Definition: Entity.h:46
EMERGENCY 5 play audio action.
Definition: PlayAudioAction.h:33
Clock class.
Definition: Clock.h:33
#define EM5_API_EXPORT
Definition: Export.h:28
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
Extended audio proxy for easier multiplay usage.
Definition: AudioProxy.h:47
static const qsf::NamedIdentifier ACTION_ID
"em5::PlayAudioAction" unique action identifier
Definition: PlayAudioAction.h:41
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Abstract action base class.
Definition: Action.h:59
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
Binary serializer class.
Definition: BinarySerializer.h:35
Result
Definition: ActionResult.h:20