![]() |
VR-Forces Developer's Guide
|
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.
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 | 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 void | setAttachedEntityEngineRunning (bool running) |
| virtual bool | attachedEntityEngineRunning () |
| 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 |
| bool | myAttachedEntityEngineRunning |
|
strong |
| makVrv::DtSoundModel::DtSoundModel | ( | DtDe & | de, |
| DtUniqueID | id | ||
| ) |
CTOR.
|
delete |
Default Constructor not implemented – default constructor not allowed.
|
delete |
Copy Constructor not implemented – Copy not allowed.
|
virtual |
DTOR.
|
delete |
Assignment Operator not implemented – Copy not allowed.
|
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 |
Creates the actual makAudio::Sound with the given parameters.
| filename | The source path of the sound file. |
| decibels | The default decibel of the sound, 80 by default. |
| is3d | Whether the sound is 3d, 3d sound need update the position, velocity, etc. |
| isLooping | whether play the sound in loop. |
| priority | Default is SECONDARY_FX(1). |
|
virtual |
Plays the sound. This function does nothing if setIsInteractionSound(true). makAudio::DtSound::play.
|
virtual |
Pauses the sound. This function does nothing if setIsInteractionSound(true). makAudio::DtSound::pause.
|
virtual |
Stops the sound. This function does nothing if setIsInteractionSound(true). makAudio::DtSound::stop.
|
virtual |
Sets whether use the relative position, non-3d sound will set this to true. This function does nothing if setIsInteractionSound(true). makAudio::DtSound::setRelativePosition.
|
virtual |
Sets the position of the sound in local coordinates, only applicable to 3d sounds. makAudio::DtSound::setPosition.
|
virtual |
Sets the velocity of the sound in local coordinates, only applicable to 3d sounds. This function does nothing if setIsInteractionSound(true). makAudio::DtSound::setVelocity.
|
virtual |
Sets the decibel of the sound.
|
virtual |
gets the decibel of the sound.
|
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 |
Gets the gain (or volume) of the sound.
|
virtual |
gets the max falloff distance.
|
virtual |
Sets if the sound is 3d sound.
|
virtual |
Should we play the sound. It will get called before it actually play.
|
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 |
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 |
Sets whether the engine of the entity that the sound is attached to is running. It will only play the sounds if the engine is running.
|
virtual |
Sets whether the engine of the entity that the sound is attached to is running. It will only play the sounds if the engine is running.
|
virtual |
Returns pointer to the underlying makAudio::DtSound object.
|
virtual |
Returns const pointer to the underlying makAudio::DtSound object.
|
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.
|
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |