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
SimpleSource.cpp
Go to the documentation of this file.
1 //
2 // C++ Implementation: Audio::SimpleSource
3 //
4 
5 #include "SimpleSource.h"
6 #include "config.h"
7 
8 namespace Audio {
9 
11  {
12  }
13 
14  SimpleSource::SimpleSource(SharedPtr<Sound> sound, bool looping) throw() :
15  Source(sound, looping),
16  playing(false),
17  scene(0)
18  {
19  }
20 
22  {
23  scene = scn;
24  }
25 
27  {
28  return scene;
29  }
30 
32  {
33  // If it's playing, must stop and restart - cannot simply play again.
34  if (isPlaying())
35  stopPlaying();
36 
37  setLastKnownPlayingTime(start);
38  playing = true;
39 
40  if (getScene())
41  getScene()->notifySourcePlaying(shared_from_this(), true);
42  }
43 
45  {
46  if (isPlaying()) {
47  playing = false;
48 
49  if (getScene())
50  getScene()->notifySourcePlaying(shared_from_this(), false);
51  }
52  }
53 
55  {
56  return playing;
57  }
58 
59 };