Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SourceListener.h
Go to the documentation of this file.
1 //
2 // C++ Interface: Audio::SourceListener
3 //
4 #ifndef __AUDIO_SOURCELISTENER_H__INCLUDED__
5 #define __AUDIO_SOURCELISTENER_H__INCLUDED__
6 
7 #include "Exceptions.h"
8 #include "Types.h"
9 #include "RenderableSource.h"
10 
11 namespace Audio {
12 
13  // Forward declarations
14 
15  class Source;
16 
17 
25  {
26  protected:
27  struct {
28  int attach : 1;
29  int play : 1;
30  int update : 1;
31  } events;
32 
34  {
35  // Want everything
36  events.attach =
37  events.update =
38  events.play = 1;
39  }
40 
41  public:
42 
43  bool wantAttachEvents() const { return events.attach != 0; }
44  bool wantPlayEvents() const { return events.play != 0; }
45  bool wantUpdateEvents() const { return events.update != 0; }
46 
58  virtual void onPreAttach(Source &source, bool detach) = 0;
59 
66  virtual void onPostAttach(Source &source, bool detach) = 0;
67 
68 
76  virtual void onUpdate(Source &source, int updateFlags) = 0;
77 
84  virtual void onPrePlay(Source &source, bool stop) = 0;
85 
92  virtual void onPostPlay(Source &source, bool stop) = 0;
93 
100  virtual void onEndOfStream(Source &source) = 0;
101  };
102 
103 
113  {
114  public:
116  {
117  // Just updates
118  events.attach =
119  events.play = 0;
120  events.update = 1;
121  }
122 
128  virtual void onPreAttach(Source &source, bool detach) {};
129 
135  virtual void onPostAttach(Source &source, bool detach) {};
136 
142  virtual void onPrePlay(Source &source, bool stop) {};
143 
149  virtual void onPostPlay(Source &source, bool stop) {};
150 
156  virtual void onEndOfStream(Source &source) {};
157  };
158 
159 };
160 
161 #endif//__AUDIO_SOURCELISTENER_H__INCLUDED__