|
VR-Engage
2.2
|
The DtAudioUpdater plays audio sounds for the engaged entity based on the value of boolean state attributes. Each configured sound is associated with a state attribute and will play when that attribute is true. Sounds can be configured to loop, play at specific loudness levels, and be positioned in 3D space at the entity's location.
Note that entities that are destroyed will not play sounds, regardless of state attributes.
Example Lua configuration:
#include <audioUpdater.h>
Classes | |
| struct | Sound |
Public Member Functions | |
| DtAudioUpdater () | |
| virtual | ~DtAudioUpdater () override |
| virtual bool | initialize (DtPlayerStation *player, DtInitTable &config) override |
| virtual void | tick (double dt) override |
| virtual void | shutdown () override |
| virtual const char * | type () const override |
Public Member Functions inherited from makVre::DtPlayerComponent | |
| DtPlayerComponent () | |
| virtual | ~DtPlayerComponent () |
| virtual bool | postInitialize () |
| virtual void | setName (const std::string &name) |
| virtual const std::string & | name () |
| virtual DtPlayerStation & | player () |
| virtual DtAttributeHandle & | playerAttributeStore () |
| virtual const DtAttributeHandle & | playerAttributeStore () const |
Protected Attributes | |
| std::vector< Sound > | mySounds |
Protected Attributes inherited from makVre::DtPlayerComponent | |
| std::string | myName |
| DtInitTable | myConfig |
| DtPlayerStation * | myPlayer |
| makVrv::DtDe * | myDe |
| DtEntityResolver * | myResolver |
| DtAttributeCallbackManager | myAttributeCallbacks |
Additional Inherited Members | |
Protected Member Functions inherited from makVre::DtPlayerComponent | |
| virtual void | initializeStateAttributes () |
| makVre::DtAudioUpdater::DtAudioUpdater | ( | ) |
Constructor for DtAudioUpdater.
Initializes the component with the name "DtAudioUpdater".
|
overridevirtual |
Virtual destructor for DtAudioUpdater.
Ensures proper cleanup of audio resources when the component is destroyed.
|
overridevirtual |
Initializes the component with configuration from Lua.
Sets up audio sources based on the provided configuration. Each source is configured with its associated state attribute, looping behavior, gain, decibel level, and 3D positioning.
| player | Pointer to the player station this component belongs to |
| config | Configuration table containing initialization parameters, especially the sources table |
Reimplemented from makVre::DtPlayerComponent.
References makVre::DtPlayerComponent::player().
|
overridevirtual |
Updates the audio playback based on state attributes.
Called each frame to manage audio playback. For each configured sound, checks its associated state attribute and plays/stops the sound accordingly. For 3D sounds, updates their position to match the entity's current location.
For non-looping sounds, the component will automatically set the state attribute to false when the sound finishes playing.
| dt | Delta time in seconds since the last tick |
Implements makVre::DtPlayerComponent.
|
overridevirtual |
Shuts down the component.
Cleans up all audio resources by stopping and deleting sounds.
Reimplemented from makVre::DtPlayerComponent.
|
overridevirtual |
Returns the component type identifier.
Implements makVre::DtPlayerComponent.
|
protected |
Collection of sounds managed by this component.