|
VR-Engage
2.2
|
The DtEngineAudioUpdater provides realistic audio simulation for vehicle engines. It dynamically modulates sound pitch and volume based on engine RPM or speed values, applies smoothing to prevent jitter, and positions sounds in 3D space based on the entity's location.
The component supports multiple engine sounds with different characteristics and can tie sound playback to an engine on/off state attribute.
#include <engineAudioUpdater.h>
Classes | |
| struct | EngineSound |
Public Member Functions | |
| DtEngineAudioUpdater () | |
| virtual | ~DtEngineAudioUpdater () 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::string | myEngineOnAttributeName |
| std::vector< EngineSound > | myEngineSounds |
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::DtEngineAudioUpdater::DtEngineAudioUpdater | ( | ) |
Constructor for DtEngineAudioUpdater.
Initializes the component with the name "DtEngineAudioUpdater".
|
overridevirtual |
Virtual destructor for DtEngineAudioUpdater.
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 RPM attribute, maximum RPM value, pitch range, smoothing factor, gain, and decibel level.
| 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 RPM state attributes.
Called each frame to manage audio playback. For each configured sound:
| 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 type identifier for this component.
Implements makVre::DtPlayerComponent.
|
protected |
Name of the state attribute that indicates if the engine is on.
This attribute controls whether engine sounds are played at all. Default is "engine-on" but can be changed via configuration.
|
protected |
Collection of engine sounds managed by this component.