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 | Protected Member Functions | Protected Attributes
makVrv::DtSoundModel Class Reference

DtSoundModel can be used to configure, start, and stop a sound. The sound can be marked as an interaction sound and it will only be played once when realize(...) is called. The sound can be associated with an entity by using the DtEntitySoundUpdater which plays the sound from the DtSoundModel based on 1) the position of the listener, i.e. active observer, 2) the position of the sound, i.e. the position of the entity the sound is associated with, and 3) the sound's max fallout distance.

See Also
DtEntitySoundUpdater

Public Types

enum  DtSoundState { DtSoundState::STOPPED, DtSoundState::PAUSED, DtSoundState::PLAYED }
 

Public Member Functions

 DtSoundModel (DtDe &de, DtUniqueID id)
 
 DtSoundModel ()=delete
 
 DtSoundModel (const DtSoundModel &)=delete
 
DtSoundModel & operator= (const DtSoundModel &)=delete
 
virtual ~DtSoundModel ()
 
virtual void setModelDefinition (const std::string &modelDef)
 
virtual void realize (const std::string &filename, float decibels, bool is3d, bool isLooping, makAudio::DtAbstractAudio::Priority priority)
 
virtual void realizeWithAttenuation (const std::string &filename, float decibels, bool is3d, bool isLooping, makAudio::DtAbstractAudio::Priority priority, float minAudibleDistM, float maxAudibleDistM)
 
virtual void play ()
 
virtual void pause ()
 
virtual void stop ()
 
virtual void setRelativePosition (bool relative)
 
virtual void setPosition (const DtVector &pos)
 
virtual void setVelocity (const DtVector &vel)
 
virtual void setDecibel (float decibel)
 
virtual float decibel ()
 
virtual void setGain (float vol)
 
virtual float gain ()
 
virtual float maxFalloffDistance ()
 
virtual void setIs3d (bool is3d)
 
virtual bool shouldPlaySound ()
 
virtual void setIsInteractionSound (bool isInteractionSound)
 
virtual bool isInteractionSound ()
 
virtual makAudio::DtSound * sound ()
 
virtual const makAudio::DtSound * sound () const
 

Protected Member Functions

virtual void createSoundFromDescriptor ()
 
virtual void handleDelayedSoundCreation ()
 

Protected Attributes

DtDe & myDe
 
DtUniqueID myId
 
DtSignalConnectionManager myConnections
 
makAudio::DtSound * mySound
 
makAudio::DtSoundDescriptor mySoundDescriptor
 
DtVector myPosition
 
DtVector myVelocity
 
bool myIsRelativePosition
 
DtSoundState mySoundState
 
float myGain
 
bool myIsInteractionSound
 
float myMinAudibleDistanceM
 
float myMaxAudibleDistanceM
 
makAudio::DtAbstractAudio::Priority myPriority
 

Member Enumeration Documentation

Enumerator
STOPPED 
PAUSED 
PLAYED 

Constructor & Destructor Documentation

makVrv::DtSoundModel::DtSoundModel ( DtDe &  de,
DtUniqueID  id 
)

CTOR.

makVrv::DtSoundModel::DtSoundModel ( )
delete

Default Constructor not implemented – default constructor not allowed.

makVrv::DtSoundModel::DtSoundModel ( const DtSoundModel &  )
delete

Copy Constructor not implemented – Copy not allowed.

virtual makVrv::DtSoundModel::~DtSoundModel ( )
virtual

DTOR.

Member Function Documentation

DtSoundModel& makVrv::DtSoundModel::operator= ( const DtSoundModel &  )
delete

Assignment Operator not implemented – Copy not allowed.

virtual void makVrv::DtSoundModel::setModelDefinition ( const std::string &  modelDef)
virtual

Set the model definition. Immediately calls realize after extracting values from the provided model definition. This function assumes the audio priority is DtAbstractAudio::SECONDARY_FX.

virtual void makVrv::DtSoundModel::realize ( const std::string &  filename,
float  decibels,
bool  is3d,
bool  isLooping,
makAudio::DtAbstractAudio::Priority  priority 
)
virtual

Creates the actual makAudio::Sound with the given parameters.

Convenience overload that forwards to realizeWithAttenuation with DtAudioLevel::kUseDefaultDistance for both min/max audible distances.

Parameters
filenameThe source path of the sound file.
decibelsThe default decibel of the sound, 80 by default.
is3dWhether the sound is 3d, 3d sound need update the position, velocity, etc.
isLoopingwhether play the sound in loop.
priorityDefault is SECONDARY_FX(1).
virtual void makVrv::DtSoundModel::realizeWithAttenuation ( const std::string &  filename,
float  decibels,
bool  is3d,
bool  isLooping,
makAudio::DtAbstractAudio::Priority  priority,
float  minAudibleDistM,
float  maxAudibleDistM 
)
virtual

Creates the actual makAudio::Sound with per-source distance and priority overrides.

Parameters
filenameThe source path of the sound file.
decibelsThe default decibel of the sound.
is3dWhether the sound is 3d.
isLoopingWhether to play the sound in a loop.
priorityVoice-pool preemption priority. Legacy default if unauthored is SECONDARY_FX.
minAudibleDistMInner-radius override in metres. Value DtAudioLevel::kUseDefaultDistance keeps the audio engine's physical-model reference distance in place.
maxAudibleDistMOuter-radius override in metres. Value DtAudioLevel::kUseDefaultDistance keeps the audio engine's physical-model max-falloff distance in place.
virtual void makVrv::DtSoundModel::play ( )
virtual

Plays the sound. This function does nothing if setIsInteractionSound(true).

See Also
makAudio::DtSound::play
virtual void makVrv::DtSoundModel::pause ( )
virtual

Pauses the sound. This function does nothing if setIsInteractionSound(true).

See Also
makAudio::DtSound::pause
virtual void makVrv::DtSoundModel::stop ( )
virtual

Stops the sound. This function does nothing if setIsInteractionSound(true).

See Also
makAudio::DtSound::stop
virtual void makVrv::DtSoundModel::setRelativePosition ( bool  relative)
virtual

Sets whether use the relative position, non-3d sound will set this to true. This function does nothing if setIsInteractionSound(true).

See Also
makAudio::DtSound::setRelativePosition
virtual void makVrv::DtSoundModel::setPosition ( const DtVector &  pos)
virtual

Sets the position of the sound in local coordinates, only applicable to 3d sounds.

See Also
makAudio::DtSound::setPosition
virtual void makVrv::DtSoundModel::setVelocity ( const DtVector &  vel)
virtual

Sets the velocity of the sound in local coordinates, only applicable to 3d sounds. This function does nothing if setIsInteractionSound(true).

See Also
makAudio::DtSound::setVelocity
virtual void makVrv::DtSoundModel::setDecibel ( float  decibel)
virtual

Sets the decibel of the sound.

virtual float makVrv::DtSoundModel::decibel ( )
virtual

gets the decibel of the sound.

virtual void makVrv::DtSoundModel::setGain ( float  vol)
virtual

Sets the gain (or volume) of the sound. A value of 1.0 is normal full volume. A value of 0 is completly silent. Values greater than 1 are acceptable, but are not recommended as they can cause clipping of the audio samples.

virtual float makVrv::DtSoundModel::gain ( )
virtual

Gets the gain (or volume) of the sound.

virtual float makVrv::DtSoundModel::maxFalloffDistance ( )
virtual

gets the max falloff distance.

virtual void makVrv::DtSoundModel::setIs3d ( bool  is3d)
virtual

Sets if the sound is 3d sound.

virtual bool makVrv::DtSoundModel::shouldPlaySound ( )
virtual

Should we play the sound. It will get called before it actually play.

virtual void makVrv::DtSoundModel::setIsInteractionSound ( bool  isInteractionSound)
virtual

Sets whether the sound is an interaction sound. Interaction sound has it's own source position and have a delay to the listener. Interacion sound do not create an instance of makAudio::DtSound, makAudio::DtAudioManager creates it.

virtual bool makVrv::DtSoundModel::isInteractionSound ( )
virtual

Returns whether the sound is an interaction sound. Interaction sound has it's own source position and have a delay to the listener. Interacion sound do not create an instance of makAudio::DtSound, makAudio::DtAudioManager creates it.

virtual makAudio::DtSound* makVrv::DtSoundModel::sound ( )
virtual

Returns pointer to the underlying makAudio::DtSound object.

virtual const makAudio::DtSound* makVrv::DtSoundModel::sound ( ) const
virtual

Returns const pointer to the underlying makAudio::DtSound object.

virtual void makVrv::DtSoundModel::createSoundFromDescriptor ( )
protectedvirtual

Used by realize to initialize the object's internal DtSound object based on the object's internal DtSoundDescriptor. If the object's internal DtSound object cannot be initialized, due to audio not being enabled, then the model listens for when it is enabled and initializes the internal DtSound object then. Only used if not an interaction sound.

virtual void makVrv::DtSoundModel::handleDelayedSoundCreation ( )
protectedvirtual

Handles the delayed creation of the internal DtSound object. Only used if the sound for the model couldn't be created right away, e.g. no sound device was present at the start of the application.

Member Data Documentation

DtDe& makVrv::DtSoundModel::myDe
protected
DtUniqueID makVrv::DtSoundModel::myId
protected
DtSignalConnectionManager makVrv::DtSoundModel::myConnections
protected
makAudio::DtSound* makVrv::DtSoundModel::mySound
protected
makAudio::DtSoundDescriptor makVrv::DtSoundModel::mySoundDescriptor
protected
DtVector makVrv::DtSoundModel::myPosition
protected
DtVector makVrv::DtSoundModel::myVelocity
protected
bool makVrv::DtSoundModel::myIsRelativePosition
protected
DtSoundState makVrv::DtSoundModel::mySoundState
protected
float makVrv::DtSoundModel::myGain
protected
bool makVrv::DtSoundModel::myIsInteractionSound
protected
float makVrv::DtSoundModel::myMinAudibleDistanceM
protected
float makVrv::DtSoundModel::myMaxAudibleDistanceM
protected
makAudio::DtAbstractAudio::Priority makVrv::DtSoundModel::myPriority
protected

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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)