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
Audio::SimpleSource Class Reference

#include <SimpleSource.h>

Inheritance diagram for Audio::SimpleSource:
Audio::Source

Public Member Functions

virtual ~SimpleSource ()
 
 SimpleSource (SharedPtr< Sound > sound, bool looping=false) throw ()
 
void notifySceneAttached (SimpleScene *scene) throw ()
 
SimpleScenegetScene () const throw ()
 
- Public Member Functions inherited from Audio::Source
virtual ~Source ()
 
LVector3 getPosition () const throw ()
 
void setPosition (LVector3 x) throw ()
 
Vector3 getDirection () const throw ()
 
void setDirection (Vector3 x) throw ()
 
Vector3 getVelocity () const throw ()
 
void setVelocity (Vector3 x) throw ()
 
Range< ScalargetAngleRange () const throw ()
 
void setAngleRange (Range< Scalar > r) throw ()
 
Range< ScalargetCosAngleRange () const throw ()
 
void setCosAngleRange (Range< Scalar > r) throw ()
 
Scalar getRadius () const throw ()
 
void setRadius (Scalar r) throw ()
 
PerFrequency< ScalargetPerFrequencyRadiusRatios () const throw ()
 
void setPerFrequencyRadiusRatios (PerFrequency< Scalar > val) throw ()
 
PerFrequency< ScalargetReferenceFreqs () const throw ()
 
void setReferenceFreqs (PerFrequency< Scalar > val) throw ()
 
Scalar getGain () const throw ()
 
void setGain (Scalar g) throw ()
 
bool isLooping () const throw ()
 
void setLooping (bool loop) throw ()
 
bool isAttenuated () const throw ()
 
void setAttenuated (bool attenuated) throw ()
 
bool isRelative () const throw ()
 
void setRelative (bool relative) throw ()
 
void startPlaying (Timestamp start=0) throw (Exception)
 
void stopPlaying () throw ()
 
void pausePlaying () throw ()
 
void continuePlaying () throw (Exception)
 
bool isPlaying () const throw ()
 
bool isActive () const throw ()
 
Timestamp getPlayingTime () const throw ()
 
Timestamp getWouldbePlayingTime () const throw ()
 
SharedPtr< RenderableSourcegetRenderable () const throw ()
 
void setRenderable (SharedPtr< RenderableSource > ptr) throw ()
 
SharedPtr< UserDatagetUserDataPtr () const throw ()
 
void setUserDataLong (SharedPtr< UserData > ptr) throw ()
 
long getUserDataLong () const throw ()
 
void setUserDataLong (long data) throw ()
 
SharedPtr< SourceListenergetSourceListener () const throw ()
 
void setSourceListener (SharedPtr< SourceListener > ptr) throw ()
 
SharedPtr< SoundgetSound () const throw ()
 
void setSound (SharedPtr< Sound > ptr) throw ()
 
void updateRenderable (int flags, const Listener &sceneListener) throw ()
 
void seek (Timestamp time) throw (Exception)
 
void _notifyPlaying () throw ()
 

Protected Member Functions

virtual void startPlayingImpl (Timestamp start) throw (Exception)
 
virtual void stopPlayingImpl () throw (Exception)
 
virtual bool isPlayingImpl () const throw (Exception)
 
- Protected Member Functions inherited from Audio::Source
 Source (SharedPtr< Sound > sound, bool looping=false) throw ()
 
Timestamp setLastKnownPlayingTime (Timestamp timestamp) throw ()
 

Additional Inherited Members

- Protected Attributes inherited from Audio::Source
LVector3 position
 
Vector3 direction
 
Vector3 velocity
 
Range< ScalarcosAngleRange
 
Scalar radius
 
PerFrequency< ScalarpfRadiusRatios
 
PerFrequency< ScalarreferenceFreqs
 
Scalar gain
 
struct {
   int   looping: 1
 
   int   attenuated: 1
 
   int   relative: 1
 
flags
 
Timestamp lastKnownPlayingTime
 
Timestamp lastKnownPlayingTimeTime
 
struct {
   int   location: 1
 
   int   attributes: 1
 
   int   gain: 1
 
   int   soundPtr: 1
 
   int   soundAttributes: 1
 
dirty
 

Detailed Description

SimpleSource implementation of the Source interface for the basic SceneManager

Remarks
This implementation merely tracks playing state with a boolean, and notifies the attached scene of any changes. It also keeps track of the scene to which it is attached through a raw pointer, to avoid circular references.
The scene attached must be a SimpleScene derivative, since the scene itself is
responsible for detaching itself when destroyed.

Definition at line 26 of file SimpleSource.h.

Constructor & Destructor Documentation

Audio::SimpleSource::~SimpleSource ( )
virtual

Definition at line 10 of file SimpleSource.cpp.

11  {
12  }
Audio::SimpleSource::SimpleSource ( SharedPtr< Sound sound,
bool  looping = false 
)
throw (
)

Construct a simple source

Definition at line 14 of file SimpleSource.cpp.

14  :
15  Source(sound, looping),
16  playing(false),
17  scene(0)
18  {
19  }

Member Function Documentation

SimpleScene * Audio::SimpleSource::getScene ( ) const
throw (
)

Get the scene to which it is attached

Definition at line 26 of file SimpleSource.cpp.

Referenced by stopPlayingImpl().

27  {
28  return scene;
29  }
bool Audio::SimpleSource::isPlayingImpl ( ) const
throw (Exception
)
protectedvirtual

See Also
isPlaying.

Implements Audio::Source.

Definition at line 54 of file SimpleSource.cpp.

55  {
56  return playing;
57  }
void Audio::SimpleSource::notifySceneAttached ( SimpleScene scene)
throw (
)

Notify attachment to a scene

Definition at line 21 of file SimpleSource.cpp.

22  {
23  scene = scn;
24  }
void Audio::SimpleSource::startPlayingImpl ( Timestamp  start)
throw (Exception
)
protectedvirtual

See Also
startPlaying
Parameters
startThe starting position.

Implements Audio::Source.

Definition at line 31 of file SimpleSource.cpp.

References start.

32  {
33  // If it's playing, must stop and restart - cannot simply play again.
34  if (isPlaying())
35  stopPlaying();
36 
38  playing = true;
39 
40  if (getScene())
41  getScene()->notifySourcePlaying(shared_from_this(), true);
42  }
void Audio::SimpleSource::stopPlayingImpl ( )
throw (Exception
)
protectedvirtual

See Also
stopPlaying.

Implements Audio::Source.

Definition at line 44 of file SimpleSource.cpp.

References getScene(), Audio::Source::isPlaying(), and Audio::SimpleScene::notifySourcePlaying().

45  {
46  if (isPlaying()) {
47  playing = false;
48 
49  if (getScene())
50  getScene()->notifySourcePlaying(shared_from_this(), false);
51  }
52  }

The documentation for this class was generated from the following files: