fluidvis
Public Member Functions | Static Public Member Functions | List of all members
sx::AudioObject Class Reference

#include <SXCore.h>

Inheritance diagram for sx::AudioObject:
sx::SXResource

Public Member Functions

EX AudioObject (const string &id)
 
EX ~AudioObject ()
 
EX void load ()
 
EX void unload ()
 
EX bool isLoaded () const
 
EX void setAudioBuffer (AudioBuffer &buffer)
 
EX void setPosition (const UniformVector *pos)
 
EX void setReferenceRadius (const UniformFloat *radius)
 
EX void setMaxRadius (const UniformFloat *maxRadius)
 
EX void setDistanceExponent (const UniformFloat *exponent)
 
EX void setVelocity (const UniformVector *vel)
 
EX void setVolume (const UniformFloat *v)
 
EX void setPitch (const UniformFloat *pitch)
 
EX void setLooping (bool looping)
 
EX void start ()
 
EX void start (double time)
 
EX void stop ()
 
EX void pause ()
 
EX bool isPlaying ()
 
EX double getLength () const
 
EX double getPlaybackPosition () const
 
EX void lock (double time)
 
EX void unlock ()
 
EX void update ()
 
- Public Member Functions inherited from sx::SXResource
virtual EX ~SXResource ()
 
EX const string & getID () const
 

Static Public Member Functions

static EX void initAudio ()
 
static EX void closeAudio ()
 
static EX bool isInitialized ()
 

Additional Inherited Members

- Protected Attributes inherited from sx::SXResource
string id
 

Detailed Description

Class used to playback the content of an AudioBuffer. Several parameters like position, speed, volume, pitch, or how the pitch changes depending on the distance to the listener can be specified. Additionally this class is responsible for initializing the layer communicating with the sound device.

Constructor & Destructor Documentation

EX sx::AudioObject::AudioObject ( const string &  id)

constructor

EX sx::AudioObject::~AudioObject ( )

deconstructor

Member Function Documentation

static EX void sx::AudioObject::closeAudio ( )
static

Closes the sounddevice, if it was initialized by initAudio.

EX double sx::AudioObject::getLength ( ) const

returns the length of the audio content in seconds

EX double sx::AudioObject::getPlaybackPosition ( ) const

Returns the point of time in seconds, at which the sound content is played.

static EX void sx::AudioObject::initAudio ( )
static

Initializes the sound device communicating with AudioBuffer, AudioObject and AudioListener. A call of initAudio is not necessary, as AudioBuffer, AudioObject and AudioListener call initAudio if necessary. Method closeAudio will be called automatically when the application terminates.

static EX bool sx::AudioObject::isInitialized ( )
static

Returns true iff the sound device communicating with AudioBuffer, AudioObject and AudioListener is initialized.

EX bool sx::AudioObject::isLoaded ( ) const
virtual

returns true iff this is loaded

Implements sx::SXResource.

EX bool sx::AudioObject::isPlaying ( )

Returns true iff this is currently playing the content of this.

EX void sx::AudioObject::load ( )
virtual

loads the resources needed to playback the AudioBuffer specified with setAudioBuffer

Implements sx::SXResource.

EX void sx::AudioObject::lock ( double  time)

Locks methods start, stop and pause for the next time seconds: For the next time seconds the invocation of start, stop and pause won't have any effect.

EX void sx::AudioObject::pause ( )

Pauses playback. The next invocation of play() will start at the point of time of the audio content, at which pause was called. If lock(time) was called after t seconds, and t <= time holds, pause has no effect.

EX void sx::AudioObject::setAudioBuffer ( AudioBuffer buffer)

setter

EX void sx::AudioObject::setDistanceExponent ( const UniformFloat exponent)

setter

EX void sx::AudioObject::setLooping ( bool  looping)

setter

EX void sx::AudioObject::setMaxRadius ( const UniformFloat maxRadius)

setter

EX void sx::AudioObject::setPitch ( const UniformFloat pitch)

setter

EX void sx::AudioObject::setPosition ( const UniformVector pos)

setter

EX void sx::AudioObject::setReferenceRadius ( const UniformFloat radius)

setter

EX void sx::AudioObject::setVelocity ( const UniformVector vel)

setter

EX void sx::AudioObject::setVolume ( const UniformFloat v)

setter

EX void sx::AudioObject::start ( )

If this is not paused, the method start playback at second 0. If lock(time) was called after t seconds, and t <= time holds, start has no effect.

EX void sx::AudioObject::start ( double  time)

Starts playback at second time. If lock(time) was called after t seconds, and t <= time holds, start has no effect.

EX void sx::AudioObject::stop ( )

Stops playback. The next invocation of play() will start at second 0. If lock(time) was called after t seconds, and t <= time holds, stop has no effect.

EX void sx::AudioObject::unload ( )

unloads the resources of this

EX void sx::AudioObject::unlock ( )

Unlocks methods start stop and pause: The next invocation of start, stop and pause is not influenced by the last invocation of lock, such that those operations have an effect on playback again.

EX void sx::AudioObject::update ( )

Updates this copying the content from position, velocity, referenceRadius, maxRadius, distanceExponent, volume and pitch. In between two update calls, the change of those parameters won't influence the sound! Hence update must be called periodically!


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