VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
makVrv::DtSharedAudioSettingsManager Class Reference

Rooted singleton that holds value about current state of sound and entity to sound-file mappings. More...

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

Public Member Functions

virtual ~DtSharedAudioSettingsManager ()
 Virtual DTOR.
virtual void slot_backupRestored (const DtSettingsBackup *s)
 Called when a mapping is restored, save out if auto save is true.
Controls for the sound settings.
virtual void setAudioEnabled (bool val)
 Set the master audio enabled state.
virtual bool audioEnabled () const
 Get the master audio enabled state.
virtual void setVolume (double val)
 Set the master audio volume.
virtual double volume () const
 Get the master audio volume.
virtual void setSoundRangeEnabled (bool val)
 Set the master audio range enabled state.
virtual bool soundRangeEnabled () const
 Get the master audio range enabled state.
virtual void setSoundRange (double val)
 Set the master audio range (in meters).
virtual double soundRange () const
 Get the master audio range (in meters).
Controls for the sound mappings.
virtual unsigned int entityMapSize () const
 Get the number of sound mapping records for entity types.
virtual unsigned int weaponFireMapSize () const
 Get the number of sound mapping records for weapon-fire types.
virtual unsigned int detonationMapSize () const
 Get the number of sound mapping records for detonation types.
virtual const
DtEntitySoundMapRecord
entityMapAt (unsigned int index) const
 Get a reference to an entity to sound-file map record.
virtual const
DtEntitySoundMapRecord
weaponFireMapAt (unsigned int index) const
 Get a reference to a weapon-fire to sound-file map record.
virtual const
DtEntitySoundMapRecord
detonationMapAt (unsigned int index) const
 Get a reference to a detonation to sound-file map record.
virtual unsigned int entityMapIndex (const DtEntitySoundMapRecord &record) const
 Get the index of a sound-file map record for an entity.
virtual unsigned int weaponFireMapIndex (const DtFireSoundMapRecord &record) const
 Get the index of a sound-file map record for a weapon-fire.
virtual unsigned int detonationMapIndex (const DtDetonationSoundMapRecord &record) const
 Get the index of a sound-file map record for a detonation.
virtual void entityMapAdd (const DtEntitySoundMapRecord &record, bool reload=true)
 Add a new entity to sound-file map record.
virtual void entityMapRemove (const DtEntitySoundMapRecord &record, bool reload=true)
 Remove an entity to sound-file map record.
virtual void weaponFireMapAdd (const DtFireSoundMapRecord &record, bool reload=false)
 Add a new weapon-fire to sound-file map record.
virtual void weaponFireMapRemove (const DtEntitySoundMapRecord &record, bool reload=false)
 Remove a weapon-fire to sound-file map record.
virtual void detonationMapAdd (const DtDetonationSoundMapRecord &record, bool reload=false)
 Add a new detonation to sound-file map record.
virtual void detonationMapRemove (const DtEntitySoundMapRecord &record, bool reload=false)
 Remove a detonation to sound-file map record.
Deprecated controls for the sound settings.
virtual void setFilename (const std::string &mtlFile)
 Set the sound mapping filename ("*.mtl").
virtual std::string filename () const
 Get the sound mapping filename ("*.mtl").
- Public Member Functions inherited from makVrv::DtBaseSharedSettingsManager< DtAudioSettingsRecord, DtSharedAudioSettings >
 DtBaseSharedSettingsManager (DtDe &de, const std::string &name, const std::string &displayName, const std::string &ext)
 CTOR.
virtual ~DtBaseSharedSettingsManager ()
 Virtual DTOR.
virtual void initializeBackup ()
 Creates a backup of the settings' current state.
virtual void setFromRecord (const DtAudioSettingsRecord &record)
 Set the current settings' state from the given record.
virtual void getRecord (DtAudioSettingsRecord &record) const
 Store the current settings' state in the given record.
- Public Member Functions inherited from makVrv::DtCommonBaseSettingsManager< DtAudioSettingsRecord >
 DtCommonBaseSettingsManager (DtDe &de, const std::string &name, const std::string &displayName, const std::string &ext)
 CTOR The name, displayName, and extension parameters are used for creating the settings object (DtDeSettings) and backup, and for constructing the filename when readin/writing the records to disk.
virtual ~DtCommonBaseSettingsManager ()
 Virtual DTOR.
virtual void autoSaveIfNecessary ()
 Saves the current settings as defaults if autosave is enabled.
virtual void setAutoSave (bool doit)
 Sets whether autosave is enabled for the settings manager.
virtual bool autoSave () const
 Gets whether autosave is enabled for the settings manager.
virtual void setUseDefaultSettingsRecord (bool useit)
 Sets whether setting initialization should check for a default record.
virtual bool useDefaultSettingsRecord () const
 Gets whether setting initialization should check for a default record.
virtual DtDeSettingssettings ()
 Accessor for the manager's DtDeSettings object.
virtual const DtDeSettingssettings () const
 Accessor for the manager's DtDeSettings object (const).
virtual DtSettingsBackupsettingsBackup ()
 Accessor for the manager's settings backup.
virtual const DtSettingsBackupsettingsBackup () const
 Accessor for the manager's settings backup (const).
virtual void loadDefaults ()
 Initializes the settings and creates a backup.
virtual void saveDefaultSettings ()
 Saves the current settings' state as the default (on disk).
virtual void loadDefaultSettings (bool loadOnlyFactorySettings)
 Loads the default settings from disk.
virtual void importSettings (const std::string &filePath)
 Load the settings' state from the given file.
virtual void exportSettings (const std::string &filePath) const
 Save the current settings' state to the given file.
virtual void getSplitRecord (std::vector< DtAudioSettingsRecord > &rec, std::vector< std::string > &fileNames)
 For directory support, split the main record into different sub-records and give them each a file name.
virtual void addRecords (DtAudioSettingsRecord &rec, DtAudioSettingsRecord &combinedRec)
 For directory support, when reading in a directory, add the records from each file to the combined record.
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor.
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor.

Static Public Member Functions

static
DtSharedAudioSettingsManager
instance (DtDe &de)
 Get an instance of the settings manager.

Public Attributes

Audio data change signals.
boost::signal< void(double)> signal_VolumeUpdated
 Signals emitted when the audio data has changed.
boost::signal< void(bool)> signal_AudioEnabledUpdated
boost::signal< void(int)> signal_SoundRangeUpdated
boost::signal< void(bool)> signal_SoundRangeEnabledUpdated

Protected Member Functions

 DtSharedAudioSettingsManager (DtDe &de)
 Protected CTOR ( use instance(..) ).

Friends

template<typename ManagerClass >
ManagerClass & defaultManagerInstanceFunction (DtDe &, bool)
 Befriend the manager instance functions for instance retrieval/creation.
template<typename ManagerClass >
void defaultManagerRegisterInstanceFunction (DtDe &, ManagerClass *)
 Befriend the manager instance functions for instance retrieval/creation.

Additional Inherited Members

- Protected Types inherited from makVrv::DtBaseSharedSettingsManager< DtAudioSettingsRecord, DtSharedAudioSettings >
typedef
DtSharedRecordSettingsBackup
< DtSharedAudioSettings,
DtAudioSettingsRecord
SharedRecordBackupType
- Protected Attributes inherited from makVrv::DtCommonBaseSettingsManager< DtAudioSettingsRecord >
DtSignalConnectionManager myConnections
std::string myName
std::string myExtension
std::string myDisplayName
bool myUseDefaultSettingsRecordFlag
bool myAutoSaveFlag
DtSettingsBackupmySettingsBackup
DtDemyDe

Detailed Description

Rooted singleton that holds value about current state of sound and entity to sound-file mappings.

Constructor & Destructor Documentation

virtual makVrv::DtSharedAudioSettingsManager::~DtSharedAudioSettingsManager ( )
virtual

Virtual DTOR.

makVrv::DtSharedAudioSettingsManager::DtSharedAudioSettingsManager ( DtDe de)
protected

Protected CTOR ( use instance(..) ).

Member Function Documentation

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

Get an instance of the settings manager.

Parameters
[in]deis the display engine root for the singleton.
virtual void makVrv::DtSharedAudioSettingsManager::setAudioEnabled ( bool  val)
virtual

Set the master audio enabled state.

When set, this switch will allow all sounds to be played. When not set, all sounds will be prevented from playing.

Parameters
[in]valis the new enabled state: true for on, false for off.
virtual bool makVrv::DtSharedAudioSettingsManager::audioEnabled ( ) const
virtual

Get the master audio enabled state.

Return values
truefor audio is enabled.
falseotherwise.
See Also
setAudioEnabled()
virtual void makVrv::DtSharedAudioSettingsManager::setVolume ( double  val)
virtual

Set the master audio volume.

This value controls the gain as heard from the listener's position.

Parameters
[in]valis the new volume.
virtual double makVrv::DtSharedAudioSettingsManager::volume ( ) const
virtual

Get the master audio volume.

Returns
The master audio volume.
See Also
setVolume()
virtual void makVrv::DtSharedAudioSettingsManager::setSoundRangeEnabled ( bool  val)
virtual

Set the master audio range enabled state.

When set, this switch will only allows sounds to be played from sources within the sound range to the listener. When not set, all sounds will attempt to be played regardless of distance to the listener.

Parameters
[in]valis the new enabled state: true for on, false for off.
See Also
setSoundRange().
virtual bool makVrv::DtSharedAudioSettingsManager::soundRangeEnabled ( ) const
virtual

Get the master audio range enabled state.

Return values
truefor audio range is enabled.
falseotherwise.
See Also
setSoundRangeEnabled()
virtual void makVrv::DtSharedAudioSettingsManager::setSoundRange ( double  val)
virtual

Set the master audio range (in meters).

This value controls the maximum distance from the listener that sounds will attempt to be played.

Parameters
[in]valis the new maximum range.
See Also
DtAudioSettingsManager::setSoundRangeEnabled.
virtual double makVrv::DtSharedAudioSettingsManager::soundRange ( ) const
virtual

Get the master audio range (in meters).

Returns
The master audio range.
See Also
setSoundRange()
virtual unsigned int makVrv::DtSharedAudioSettingsManager::entityMapSize ( ) const
virtual

Get the number of sound mapping records for entity types.

Returns
The current number of registered mappings.
virtual unsigned int makVrv::DtSharedAudioSettingsManager::weaponFireMapSize ( ) const
virtual

Get the number of sound mapping records for weapon-fire types.

Returns
The current number of registered mappings.
virtual unsigned int makVrv::DtSharedAudioSettingsManager::detonationMapSize ( ) const
virtual

Get the number of sound mapping records for detonation types.

Returns
The current number of registered mappings.
virtual const DtEntitySoundMapRecord& makVrv::DtSharedAudioSettingsManager::entityMapAt ( unsigned int  index) const
virtual

Get a reference to an entity to sound-file map record.

Parameters
[in]indexis the index of the record to locate.
Returns
A reference to a sound-file map record.
Exceptions
std::out_of_rangeon bad index.
virtual const DtEntitySoundMapRecord& makVrv::DtSharedAudioSettingsManager::weaponFireMapAt ( unsigned int  index) const
virtual

Get a reference to a weapon-fire to sound-file map record.

Parameters
[in]indexis the index of the record to locate.
Returns
A reference to a sound-file map record.
Exceptions
std::out_of_rangeon bad index.
virtual const DtEntitySoundMapRecord& makVrv::DtSharedAudioSettingsManager::detonationMapAt ( unsigned int  index) const
virtual

Get a reference to a detonation to sound-file map record.

Parameters
[in]indexis the index of the record to locate.
Returns
A reference to a sound-file map record.
Exceptions
std::out_of_rangeon bad index.
virtual unsigned int makVrv::DtSharedAudioSettingsManager::entityMapIndex ( const DtEntitySoundMapRecord record) const
virtual

Get the index of a sound-file map record for an entity.

Parameters
[in]recordis the record to look for in the map.
Returns
The index to the record or the size of the map if not found.
virtual unsigned int makVrv::DtSharedAudioSettingsManager::weaponFireMapIndex ( const DtFireSoundMapRecord record) const
virtual

Get the index of a sound-file map record for a weapon-fire.

Parameters
[in]recordis the record to look for in the map.
Returns
The index to the record or the size of the map if not found.
virtual unsigned int makVrv::DtSharedAudioSettingsManager::detonationMapIndex ( const DtDetonationSoundMapRecord record) const
virtual

Get the index of a sound-file map record for a detonation.

Parameters
[in]recordis the record to look for in the map.
Returns
The index to the record or the size of the map if not found.
virtual void makVrv::DtSharedAudioSettingsManager::entityMapAdd ( const DtEntitySoundMapRecord record,
bool  reload = true 
)
virtual

Add a new entity to sound-file map record.

Parameters
[in]recordis the new sound-file map record to be added.
[in]reloadis a flag forcing currently playing sounds to be reloaded from the new sound-file.
Note
If a record with the given entity value already exists, the record will be updated with the new information instead of adding a new record.
virtual void makVrv::DtSharedAudioSettingsManager::entityMapRemove ( const DtEntitySoundMapRecord record,
bool  reload = true 
)
virtual

Remove an entity to sound-file map record.

Parameters
[in]recordis the sound-file map record to be remove.
[in]reloadis a flag forcing currently playing sounds to be reloaded from their sound-file.
Note
Removing the record to a currently playing sound without forcing a reload will not stop the sound from continuing.
virtual void makVrv::DtSharedAudioSettingsManager::weaponFireMapAdd ( const DtFireSoundMapRecord record,
bool  reload = false 
)
virtual

Add a new weapon-fire to sound-file map record.

Parameters
[in]recordis the new sound-file map record to be added.
[in]reloadis a flag forcing currently playing sounds to be reloaded from the new sound-file.
Note
If a record with the given entity value already exists, the record will be updated with the new information instead of adding a new record.
virtual void makVrv::DtSharedAudioSettingsManager::weaponFireMapRemove ( const DtEntitySoundMapRecord record,
bool  reload = false 
)
virtual

Remove a weapon-fire to sound-file map record.

Parameters
[in]recordis the sound-file map record to be remove.
[in]reloadis a flag forcing currently playing sounds to be reloaded from their sound-file.
Note
Removing the record to a currently playing sound without forcing a reload will not stop the sound from continuing.
virtual void makVrv::DtSharedAudioSettingsManager::detonationMapAdd ( const DtDetonationSoundMapRecord record,
bool  reload = false 
)
virtual

Add a new detonation to sound-file map record.

Parameters
[in]recordis the new sound-file map record to be added.
[in]reloadis a flag forcing currently playing sounds to be reloaded from the new sound-file.
Note
If a record with the given entity value and detonation result already exists, the record will be updated with the new information instead of adding a new record.
virtual void makVrv::DtSharedAudioSettingsManager::detonationMapRemove ( const DtEntitySoundMapRecord record,
bool  reload = false 
)
virtual

Remove a detonation to sound-file map record.

Parameters
[in]recordis the sound-file map record to be remove.
[in]reloadis a flag forcing currently playing sounds to be reloaded from their sound-file.
Note
Removing the record to a currently playing sound without forcing a reload will not stop the sound from continuing.
virtual void makVrv::DtSharedAudioSettingsManager::setFilename ( const std::string &  mtlFile)
virtual

Set the sound mapping filename ("*.mtl").

Parameters
[in]mtlFileis the filename of an MTL file to load.
Note
MTL files only load while connected to a running simulation.
Deprecated:
This mutator is deprecated.
virtual std::string makVrv::DtSharedAudioSettingsManager::filename ( ) const
virtual

Get the sound mapping filename ("*.mtl").

Deprecated:
This accessor is deprecated.
virtual void makVrv::DtSharedAudioSettingsManager::slot_backupRestored ( const DtSettingsBackup s)
virtual

Called when a mapping is restored, save out if auto save is true.

Friends And Related Function Documentation

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

Befriend the manager instance functions for instance retrieval/creation.

  Manager requirements:
  1) Static instance function
  2) Protected DtSignalConnectionManager named myConnections.
  3) Member functioned called loadDefaults which takes no arguments.
     and loads the default settings of the manager or factory from disk.
  4) define defaultManagerInstanceFunction as friend.
  5) define defaultManagerRegisterInstanceFunction as friend (see below).
  5) Protected Constructor which only takes a DtDe reference.
  @code 

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.
  @code 

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.

  @code 

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

Member Data Documentation

boost::signal<void (double)> makVrv::DtSharedAudioSettingsManager::signal_VolumeUpdated

Signals emitted when the audio data has changed.

boost::signal<void (bool)> makVrv::DtSharedAudioSettingsManager::signal_AudioEnabledUpdated
boost::signal<void (int)> makVrv::DtSharedAudioSettingsManager::signal_SoundRangeUpdated
boost::signal<void (bool)> makVrv::DtSharedAudioSettingsManager::signal_SoundRangeEnabledUpdated

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)