Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::SoundManager Class Reference

The SoundManager class manages the OpenAL device, context and listener position. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/orxonox/sound/SoundManager.h>

Inheritance diagram for orxonox::SoundManager:
orxonox::Singleton< SoundManager > orxonox::Configurable orxonox::UpdateListener orxonox::Listable orxonox::Listable orxonox::Identifiable orxonox::Identifiable

Public Member Functions

 SoundManager ()
 
 ~SoundManager ()
 
std::string getDeviceName (unsigned int index) const
 
bool getMute (SoundType::Value type)
 
float getRealVolume (SoundType::Value type)
 
std::shared_ptr< SoundBuffergetSoundBuffer (const std::string &filename)
 
ALuint getSoundSource (BaseSound *object)
 
float getVolume (SoundType::Value type)
 
void pauseAmbientSound (AmbientSound *ambient)
 
virtual void postUpdate (const Clock &time) override
 Gets called by Core after the framework was ticked (but before graphics are drawn). More...
 
virtual void preUpdate (const Clock &time) override
 Gets called by Core before the framework is ticked. More...
 
void registerAmbientSound (AmbientSound *newAmbient)
 
void releaseSoundBuffer (const std::shared_ptr< SoundBuffer > &buffer, bool bPoolBuffer)
 
void releaseSoundSource (ALuint source)
 
void setConfigValues ()
 
void setListenerOrientation (const Quaternion &orientation)
 
void setListenerPosition (const Vector3 &position)
 
void setVolume (float vol, SoundType::Value type)
 
void toggleMute (SoundType::Value type)
 
void unregisterAmbientSound (AmbientSound *oldAmbient)
 
- Public Member Functions inherited from orxonox::Configurable
 Configurable ()
 
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls. More...
 
- Public Member Functions inherited from orxonox::Listable
 Listable ()
 Constructor: Allocates space in the element list. More...
 
 Listable (Context *context)
 Constructor: Allocates space in the element list and assigns the context. More...
 
virtual ~Listable ()
 Destructor: Removes the object from the object-lists. More...
 
ContextgetContext () const
 
void setContext (Context *context)
 Changes the context. More...
 
void unregisterObject ()
 Removes this object from the object-lists. More...
 
- Public Member Functions inherited from orxonox::Identifiable
 Identifiable ()
 Constructor: Sets the default values. More...
 
virtual ~Identifiable ()
 
ORX_FORCEINLINE voidgetDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy. More...
 
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template. More...
 
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template. More...
 
IdentifiergetIdentifier () const
 Returns the Identifier of the object. More...
 
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isA (const Identifiable *object)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type. More...
 
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type. More...
 
bool isChildOf (const Identifiable *object)
 Returns true if the object's class is a child of the given type. More...
 
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectChildOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
bool isDirectParentOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
bool isExactlyA (const Identifiable *object)
 Returns true if the object's class is exactly of the given type. More...
 
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
bool isParentOf (const Identifiable *object)
 Returns true if the object's class is a parent of the given type. More...
 
- Public Member Functions inherited from orxonox::UpdateListener
 UpdateListener ()
 

Static Public Member Functions

static bool exists ()
 
static std::string getALErrorString (ALenum error)
 
static SoundManagergetInstance ()
 
- Static Public Member Functions inherited from orxonox::Singleton< SoundManager >
static bool exists ()
 Tells whether the singleton has been created. More...
 
static SoundManagergetInstance ()
 Returns a reference to the singleton instance. More...
 

Private Types

typedef std::list< std::pair< AmbientSound *, bool > > AmbientList
 
typedef std::list< std::shared_ptr< SoundBuffer > > EffectsPoolList
 
typedef std::map< std::string, std::shared_ptr< SoundBuffer > > SoundBufferMap
 

Private Member Functions

void checkAmbientVolumeValidity ()
 
void checkEffectsVolumeValidity ()
 
void checkFadeStepValidity ()
 
void checkSoundVolumeValidity ()
 
void checkVolumeValidity (SoundType::Value type)
 
unsigned int createSoundSources (unsigned int n)
 
void fadeIn (AmbientSound *sound)
 
void fadeOut (AmbientSound *sound)
 
void processCrossFading (float dt)
 
void updateVolume (SoundType::Value type)
 

Private Attributes

AmbientList ambientSounds_
 
std::vector< ALuintavailableSoundSources_
 
bool bDestructorCalled_
 Becomes true if the destructor is called - used to prevent ambient sounds from registering after the lists were cleared. More...
 
ALCcontextcontext_
 
float crossFadeStep_
 Absolute change per second (0.1 means 10% of the nominal volume) for cross fading. More...
 
ALCdevicedevice_
 
std::vector< std::string > deviceNames_
 
EffectsPoolList effectsPool_
 
unsigned int effectsPoolSize_
 
std::list< StrongPtr< AmbientSound > > fadeInList_
 
std::list< StrongPtr< AmbientSound > > fadeOutList_
 
unsigned int maxSources_
 
unsigned int minSources_
 
float mute_ [3]
 
SoundBufferMap soundBuffers_
 
std::vector< std::pair< ALuint, BaseSound * > > usedSoundSources_
 
float volume_ [3]
 

Static Private Attributes

static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024
 
static SoundManagersingletonPtr_s
 

Friends

class Singleton< SoundManager >
 

Additional Inherited Members

- Protected Member Functions inherited from orxonox::Singleton< SoundManager >
 Singleton ()
 Constructor sets the singleton instance pointer. More...
 
virtual ~Singleton ()
 Destructor resets the singleton instance pointer. More...
 

Detailed Description

The SoundManager class manages the OpenAL device, context and listener position.

Member Typedef Documentation

typedef std::list<std::pair<AmbientSound*, bool> > orxonox::SoundManager::AmbientList
private
typedef std::list<std::shared_ptr<SoundBuffer> > orxonox::SoundManager::EffectsPoolList
private
typedef std::map<std::string, std::shared_ptr<SoundBuffer> > orxonox::SoundManager::SoundBufferMap
private

Constructor & Destructor Documentation

orxonox::SoundManager::SoundManager ( )
orxonox::SoundManager::~SoundManager ( )

Member Function Documentation

void orxonox::SoundManager::checkAmbientVolumeValidity ( )
inlineprivate
void orxonox::SoundManager::checkEffectsVolumeValidity ( )
inlineprivate
void orxonox::SoundManager::checkFadeStepValidity ( )
private
void orxonox::SoundManager::checkSoundVolumeValidity ( )
inlineprivate
void orxonox::SoundManager::checkVolumeValidity ( SoundType::Value  type)
private
unsigned int orxonox::SoundManager::createSoundSources ( unsigned int  n)
private
static bool orxonox::SoundManager::exists ( )
inlinestatic
void orxonox::SoundManager::fadeIn ( AmbientSound sound)
private
void orxonox::SoundManager::fadeOut ( AmbientSound sound)
private
std::string orxonox::SoundManager::getALErrorString ( ALenum  error)
static
std::string orxonox::SoundManager::getDeviceName ( unsigned int  index) const
inline
static SoundManager& orxonox::SoundManager::getInstance ( void  )
inlinestatic
bool orxonox::SoundManager::getMute ( SoundType::Value  type)
float orxonox::SoundManager::getRealVolume ( SoundType::Value  type)
std::shared_ptr< SoundBuffer > orxonox::SoundManager::getSoundBuffer ( const std::string &  filename)
ALuint orxonox::SoundManager::getSoundSource ( BaseSound object)
float orxonox::SoundManager::getVolume ( SoundType::Value  type)
void orxonox::SoundManager::pauseAmbientSound ( AmbientSound ambient)
virtual void orxonox::SoundManager::postUpdate ( const Clock time)
inlineoverridevirtual

Gets called by Core after the framework was ticked (but before graphics are drawn).

Implements orxonox::UpdateListener.

void orxonox::SoundManager::preUpdate ( const Clock time)
overridevirtual

Gets called by Core before the framework is ticked.

Implements orxonox::UpdateListener.

void orxonox::SoundManager::processCrossFading ( float  dt)
private
void orxonox::SoundManager::registerAmbientSound ( AmbientSound newAmbient)
void orxonox::SoundManager::releaseSoundBuffer ( const std::shared_ptr< SoundBuffer > &  buffer,
bool  bPoolBuffer 
)
void orxonox::SoundManager::releaseSoundSource ( ALuint  source)
void orxonox::SoundManager::setConfigValues ( void  )
void orxonox::SoundManager::setListenerOrientation ( const Quaternion &  orientation)
void orxonox::SoundManager::setListenerPosition ( const Vector3 &  position)
void orxonox::SoundManager::setVolume ( float  vol,
SoundType::Value  type 
)
void orxonox::SoundManager::toggleMute ( SoundType::Value  type)
void orxonox::SoundManager::unregisterAmbientSound ( AmbientSound oldAmbient)
void orxonox::SoundManager::updateVolume ( SoundType::Value  type)
private

Friends And Related Function Documentation

friend class Singleton< SoundManager >
friend

Member Data Documentation

AmbientList orxonox::SoundManager::ambientSounds_
private
std::vector<ALuint> orxonox::SoundManager::availableSoundSources_
private
bool orxonox::SoundManager::bDestructorCalled_
private

Becomes true if the destructor is called - used to prevent ambient sounds from registering after the lists were cleared.

ALCcontext* orxonox::SoundManager::context_
private
float orxonox::SoundManager::crossFadeStep_
private

Absolute change per second (0.1 means 10% of the nominal volume) for cross fading.

ALCdevice* orxonox::SoundManager::device_
private
std::vector<std::string> orxonox::SoundManager::deviceNames_
private
EffectsPoolList orxonox::SoundManager::effectsPool_
private
unsigned int orxonox::SoundManager::effectsPoolSize_
private
std::list<StrongPtr<AmbientSound> > orxonox::SoundManager::fadeInList_
private
std::list<StrongPtr<AmbientSound> > orxonox::SoundManager::fadeOutList_
private
const unsigned int orxonox::SoundManager::maxEffectsPoolSize_s = 40 * 1024 * 1024
staticprivate
unsigned int orxonox::SoundManager::maxSources_
private
unsigned int orxonox::SoundManager::minSources_
private
float orxonox::SoundManager::mute_[3]
private
SoundManager* orxonox::SoundManager::singletonPtr_s
staticprivate
SoundBufferMap orxonox::SoundManager::soundBuffers_
private
std::vector<std::pair<ALuint, BaseSound*> > orxonox::SoundManager::usedSoundSources_
private
float orxonox::SoundManager::volume_[3]
private

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