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
RenderableSource.cpp
Go to the documentation of this file.
1 //
2 // C++ Implementation: Audio::RenderableSource
3 //
4 
5 #include "RenderableSource.h"
6 #include "config.h"
7 #include <stdio.h>
8 
9 namespace Audio {
10 
12  source(_source)
13  {
14  }
15 
17  {
18  // Just in case.
19  source = 0;
20  }
21 
23  throw(Exception)
24  {
25  try {
26  startPlayingImpl(start);
27  } catch(EndOfStreamException) {
28  // Silently discard EOS, results in the more transparent
29  // behavior of simply notifying listeners of source
30  // termination ASAP, which is also accurate.
31  };
32  }
33 
35  throw()
36  {
37  // Cannot be playing if an exception rises,
38  // as that implies a problem with the underlying API
39  try {
40  if (isPlaying())
42  } catch(Exception e) {}
43  }
44 
46  throw()
47  {
48  try {
49  return isPlayingImpl();
50  } catch(Exception e) {
51  // Cannot be playing if an exception rises,
52  // as that implies a problem with the underlying API
53  return false;
54  }
55  }
56 
58  throw(Exception)
59  {
60  return getPlayingTimeImpl();
61  }
62 
63  void RenderableSource::update(int flags, const Listener& sceneListener)
64  throw()
65  {
66  try {
67  updateImpl(flags, sceneListener);
68  } catch(Exception e) {
69  fprintf(stderr, "Ignoring exception in renderable update: %s", e.what());
70  }
71  }
72 
74  throw(Exception)
75  {
76  seekImpl(time);
77  }
78 
79 };