VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
makVrv::DtAudioManager Class Reference

DtAudioManager manages the sounds in vantange. It updates the listener's position, etc.

Inheritance diagram for makVrv::DtAudioManager:
Inheritance graph
[legend]

Public Types

enum  ListenerLocationType { ObserverListener, EntityListener, ExplicitListener }
 

Public Member Functions

virtual bool init ()
 
virtual bool playbackDeviceInitialized ()
 
virtual bool captureDeviceInitialized ()
 
virtual bool isEnabled ()
 
virtual void setEnabled (bool enable)
 
virtual double soundVolume ()
 
virtual void setSoundVolume (double volume)
 
virtual void setListenerLocationType (ListenerLocationType listenerType)
 
virtual ListenerLocationType listenerLocationType () const
 
virtual void setEntityListener (DtElementID listenerEntity)
 
virtual DtElementID entityListener () const
 
virtual void setListenerLocation (const DtVector &location)
 
virtual const DtVectorlistenerLocation () const
 
virtual void setListenerVelocity (const DtVector &velocity)
 
virtual const DtVectorlistenerVelocity () const
 
virtual void setListenerFront (const DtVector &frontVec)
 
virtual const DtVectorlistenerFront () const
 
virtual void setListenerUp (const DtVector &upVec)
 
virtual const DtVectorlistenerUp () const
 
virtual int maxVoices ()
 
virtual void setMaxVoices (int numVoices)
 
virtual double speedOfSound ()
 
virtual void setSpeedOfSound (double c)
 
virtual float maximumOutputDecibelCapability ()
 
virtual void setMaximumOutputDecibelCapability (float max)
 
virtual bool environmentalProcessingAvailable ()
 
virtual bool isEnvironmentalProcessingEnabled ()
 
virtual void setEnvironmentalProcessingEnabled (bool enable)
 
virtual void loadDefaults ()
 
virtual bool environmentalProcessingAvailable () const
 
virtual std::vector< std::string > playbackDeviceList () const
 
virtual std::vector< std::string > captureDeviceList () const
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

static DtAudioManagerinstance (DtDe &de)
 

Public Attributes

boost::signalslib::signal< void()> signal_playbackDeviceInitialized
 
boost::signalslib::signal< void()> signal_captureDeviceInitialized
 

Protected Member Functions

 DtAudioManager (DtDe &)
 
virtual ~DtAudioManager ()
 
void connectSignals ()
 
virtual void tick ()
 
virtual void shutdown ()
 
virtual void kinStateFromObserver ()
 
virtual void kinStateFromEntity ()
 
virtual void initializeAudioDevicesIfNeeded ()
 
virtual void slot_AudioEnabledUpdated (bool enabled)
 
virtual void slot_VolumeUpdated (double volume)
 
virtual void slot_playbackDeviceUpdated (const std::string &device)
 
virtual void slot_captureDeviceUpdated (const std::string &device)
 
virtual void slot_showCaptureDeviceSettingsUpdated (bool show)
 
virtual void slot_SpeedOfSoundUpdated (double speed)
 
virtual void slot_MaxVoicesUpdated (double numOfVoices)
 
virtual void slot_maximumOutputDecibelCapabilityUpdated (double decibel)
 
virtual void slot_EnvironmentalProcessingEnabledUpdated (bool enabled)
 

Protected Attributes

DtDemyDe
 
DtSignalConnectionManager myConnections
 
ListenerLocationType myListenerLocationType
 
DtElementID myListenerEntity
 
DtVector myListenerLocation
 
DtVector myListenerFront
 
DtVector myListenerUp
 
DtVector myListenerVelocity
 
bool myPlaybackDeviceInitialized
 
bool myCaptureDeviceInitialized
 

Private Member Functions

 DtAudioManager ()
 
 DtAudioManager (const DtAudioManager &)
 
DtAudioManageroperator= (const DtAudioManager &)
 

Friends

template<typename ManagerClass >
ManagerClass & defaultManagerInstanceFunction (DtDe &, bool)
 
template<typename ManagerClass >
void defaultManagerRegisterInstanceFunction (DtDe &, ManagerClass *)
 

Member Enumeration Documentation

This enumeration is used to determine what type of listener the the audio manager uses.

Enumerator
ObserverListener 
EntityListener 
ExplicitListener 

Constructor & Destructor Documentation

makVrv::DtAudioManager::DtAudioManager ( DtDe )
protected

CTOR.

virtual makVrv::DtAudioManager::~DtAudioManager ( )
protectedvirtual

DTOR.

makVrv::DtAudioManager::DtAudioManager ( )
private

Default Constructor not implemented – default constructor not allowed.

makVrv::DtAudioManager::DtAudioManager ( const DtAudioManager )
private

Copy Constructor not implemented – Copy not allowed.

Member Function Documentation

static DtAudioManager& makVrv::DtAudioManager::instance ( DtDe de)
static

Get an instance of the DtAudioManager.

virtual bool makVrv::DtAudioManager::init ( )
virtual

Inits the sound system and create the audio context.

Returns
return false if it failed to init.
virtual bool makVrv::DtAudioManager::playbackDeviceInitialized ( )
virtual

Return whether the playback device is initialized.

virtual bool makVrv::DtAudioManager::captureDeviceInitialized ( )
virtual

Return whether the capture device is initialized.

virtual bool makVrv::DtAudioManager::isEnabled ( )
virtual

Return whether the audio manager is enabled.

virtual void makVrv::DtAudioManager::setEnabled ( bool  enable)
virtual

Sets whether the audio manager is enabled. If set to false, audio manage will stop playing any sound.

virtual double makVrv::DtAudioManager::soundVolume ( )
virtual

Return the volume of the sound.

virtual void makVrv::DtAudioManager::setSoundVolume ( double  volume)
virtual

Sets the volume of the sound.

virtual void makVrv::DtAudioManager::setListenerLocationType ( ListenerLocationType  listenerType)
virtual

Set the type of listener the audio manager should use. listenerType will be one of ObserverListener, EntityListener, or ExplicitListener. If the listener type is set to ObserverListener, then the audio manager will retrieve and use the current observer's location, orientation, and velocity. If the listener type is set to EntityListener, then the audio manager will look up the entity set with setEntityListener() and take its kinematic input from there. Finally, if the listener type is set to ExplicitListener, then the audio manager will use whatever values are currently in its kinematic member variables, which can be set through the API.

virtual ListenerLocationType makVrv::DtAudioManager::listenerLocationType ( ) const
virtual

Get the current listener type.

virtual void makVrv::DtAudioManager::setEntityListener ( DtElementID  listenerEntity)
virtual

If listener type is set to EntityListener, look up the object specified by the listenerEntity element ID.

virtual DtElementID makVrv::DtAudioManager::entityListener ( ) const
virtual

Get the entity listener's element ID (may be (DtUniqueID) -1)

virtual void makVrv::DtAudioManager::setListenerLocation ( const DtVector location)
virtual

Set a location to use (local coords) when the listener type is set to ExplicitListener.

virtual const DtVector& makVrv::DtAudioManager::listenerLocation ( ) const
virtual

Get the audio manager's current listener location (local coords)

virtual void makVrv::DtAudioManager::setListenerVelocity ( const DtVector velocity)
virtual

Set a velocity to use (local coords) when the listener type is set to ExplicitListener.

virtual const DtVector& makVrv::DtAudioManager::listenerVelocity ( ) const
virtual

Get the audio manager's current listener velocity (local coords)

virtual void makVrv::DtAudioManager::setListenerFront ( const DtVector frontVec)
virtual

Set a front vector (local coords) to use when the listener type is set to ExplicitListener.

virtual const DtVector& makVrv::DtAudioManager::listenerFront ( ) const
virtual

Get the audio manager's current listener front vector (local coords)

virtual void makVrv::DtAudioManager::setListenerUp ( const DtVector upVec)
virtual

Set an up vector (local coords) to use when the listener type is set to ExplicitListener.

virtual const DtVector& makVrv::DtAudioManager::listenerUp ( ) const
virtual

Get the audio manager's current listener up vector (local coords)

virtual int makVrv::DtAudioManager::maxVoices ( )
virtual

Return the maximum number of voice allowed in the scene.

virtual void makVrv::DtAudioManager::setMaxVoices ( int  numVoices)
virtual

Sets the maximum number of voice allowed in the scene. Call this function with caution, it can hurt performance. It must be in the range [0,256].

virtual double makVrv::DtAudioManager::speedOfSound ( )
virtual

Gets the speed of the sound in m/s. the speed of sound. Currently returns the standard speed of sound in dry air at sea level. But one could calculate it and set it below.

virtual void makVrv::DtAudioManager::setSpeedOfSound ( double  c)
virtual

Sets the speed of the sound in m/s. the speed of sound. Currently returns the standard speed of sound in dry air at sea level. But one could calculate it and set it below.

virtual float makVrv::DtAudioManager::maximumOutputDecibelCapability ( )
virtual

Gets the maximum decibel. The maximum decibel output of the sound system that the application is being played on. Used to tune the sound falloff distances to match the loudness of the system so that they sound realistic within the capabilities of the speakers being used. This defaults to 70 decibels, which is about the level a desktop computer will play loud audio at (or headphones). If the audio system is capable of playing louder than 70 dB, then increase this to the expected maximum output of the system.

virtual void makVrv::DtAudioManager::setMaximumOutputDecibelCapability ( float  max)
virtual

Sets the maximum decibel. The maximum decibel output of the sound system that the application is being played on. Used to tune the sound falloff distances to match the loudness of the system so that they sound realistic within the capabilities of the speakers being used. This defaults to 70 decibels, which is about the level a desktop computer will play loud audio at (or headphones). If the audio system is capable of playing louder than 70 dB, then increase this to the expected maximum output of the system.

virtual bool makVrv::DtAudioManager::environmentalProcessingAvailable ( )
virtual

Return whether the environmental processing is available. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.

virtual bool makVrv::DtAudioManager::isEnvironmentalProcessingEnabled ( )
virtual

Return whethe the environmental processing is enabled. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.

virtual void makVrv::DtAudioManager::setEnvironmentalProcessingEnabled ( bool  enable)
virtual

Sets whethe the environmental processing is enabled. Environmental processing enables low pass filtering on sounds so that at a distance only the lower frequencies are heard, since higher frequencies are absorbed by air at a faster rate. Uses a standard day to calculate absorption rate.

virtual void makVrv::DtAudioManager::loadDefaults ( )
virtual

Load the default definitions.

virtual bool makVrv::DtAudioManager::environmentalProcessingAvailable ( ) const
virtual

Get the environmental processing available state.

Return values
truefor processing is available on current hardware.
falseotherwise.
virtual std::vector<std::string> makVrv::DtAudioManager::playbackDeviceList ( ) const
virtual

Get the list of audio playback devices available.

virtual std::vector<std::string> makVrv::DtAudioManager::captureDeviceList ( ) const
virtual

Get the list of audio capture devices available.

void makVrv::DtAudioManager::connectSignals ( )
protected

Connects all the signals. Non virtual, called in CTOR.

virtual void makVrv::DtAudioManager::tick ( )
protectedvirtual

Updates the sound system per tick. Mainly update the listener and sounds.

virtual void makVrv::DtAudioManager::shutdown ( )
protectedvirtual

Shut down the sound system, destory the context and release all the sound resources.

virtual void makVrv::DtAudioManager::kinStateFromObserver ( )
protectedvirtual

If listenerLocationType is ObserverListener, this method is called by tick to set myListenerLocation, myListenerFront, myListenerUp, and myListenerVelocity from the current observer.

virtual void makVrv::DtAudioManager::kinStateFromEntity ( )
protectedvirtual

If listenerLocationType is EntityListener, this method is called by tick to set myListenerLocation, myListenerFront, myListenerUp, and myListenerVelocity from myListenerEntity If the entity is not found, the values are unchanged.

virtual void makVrv::DtAudioManager::initializeAudioDevicesIfNeeded ( )
protectedvirtual

Initialize the playback and/or capture device if either device is not already initialized. This function does nothing if both devices have already been successfully initialized.

virtual void makVrv::DtAudioManager::slot_AudioEnabledUpdated ( bool  enabled)
protectedvirtual

Methods connected to audio signals.

Slot when enables/disables the audio.

virtual void makVrv::DtAudioManager::slot_VolumeUpdated ( double  volume)
protectedvirtual

Slot when the volume of the audio changes.

virtual void makVrv::DtAudioManager::slot_playbackDeviceUpdated ( const std::string &  device)
protectedvirtual

Slot when the playback device changes.

virtual void makVrv::DtAudioManager::slot_captureDeviceUpdated ( const std::string &  device)
protectedvirtual

Slot when the capture device changes.

virtual void makVrv::DtAudioManager::slot_showCaptureDeviceSettingsUpdated ( bool  show)
protectedvirtual

Slot when show/hide the capture device settings.

virtual void makVrv::DtAudioManager::slot_SpeedOfSoundUpdated ( double  speed)
protectedvirtual

Slot when the speed of the sound changes.

virtual void makVrv::DtAudioManager::slot_MaxVoicesUpdated ( double  numOfVoices)
protectedvirtual

Slot when the number of the maximum voice allowed changes.

virtual void makVrv::DtAudioManager::slot_maximumOutputDecibelCapabilityUpdated ( double  decibel)
protectedvirtual

Slot when the maximum output decibel allowed changes.

virtual void makVrv::DtAudioManager::slot_EnvironmentalProcessingEnabledUpdated ( bool  enabled)
protectedvirtual

Slot when enables/disables the environmental processing.

DtAudioManager& makVrv::DtAudioManager::operator= ( const DtAudioManager )
private

Assignment Operator not implemented – Copy not allowed.

Friends And Related Function Documentation

template<typename ManagerClass >
ManagerClass& defaultManagerInstanceFunction ( DtDe de,
bool  allowedInSlave 
)
friend

Befriend the manager instance functions for instance retrieval/creation.

class Manager
{
public:
static Manager& instance(DtDe& de);
void loadDefaults();
protected:
template <typename ManagerClass>
friend ManagerClass& defaultManagerInstanceFunction(DtDe& de, bool);
template <typename ManagerClass>
friend void defaultManagerRegisterInstanceFunction(DtDe& de, ManagerClass* mgr)
Manager(DtDe&);
DtSignalConnectionManager myConnections;
};

Then simply in the implementation of instance call defaultManagerInstanceFunction with the de object and return the return value.

Manager& Manager::instance(DtDe& de)
{
return defaultManagerInstanceFunction<Manager>(de);
}
template<typename ManagerClass >
void defaultManagerRegisterInstanceFunction ( DtDe de,
ManagerClass *  mgr 
)
friend

Befriend the manager instance functions for instance retrieval/creation.

static void Manager::registerInstance(DtDe& de, Manager* mgr)
{
}
...else where call.
// Assuming class NewManager : public Manager
Manager::registerInstance(de,new NewManager(de));

Member Data Documentation

boost::signalslib::signal<void()> makVrv::DtAudioManager::signal_playbackDeviceInitialized
boost::signalslib::signal<void()> makVrv::DtAudioManager::signal_captureDeviceInitialized
DtDe& makVrv::DtAudioManager::myDe
protected
DtSignalConnectionManager makVrv::DtAudioManager::myConnections
protected
ListenerLocationType makVrv::DtAudioManager::myListenerLocationType
protected
DtElementID makVrv::DtAudioManager::myListenerEntity
protected
DtVector makVrv::DtAudioManager::myListenerLocation
protected
DtVector makVrv::DtAudioManager::myListenerFront
protected
DtVector makVrv::DtAudioManager::myListenerUp
protected
DtVector makVrv::DtAudioManager::myListenerVelocity
protected
bool makVrv::DtAudioManager::myPlaybackDeviceInitialized
protected
bool makVrv::DtAudioManager::myCaptureDeviceInitialized
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)