VR-Engage  2.3
Loading...
Searching...
No Matches
humanAudioUpdater.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file humanAudioUpdater.h
7//! \brief Defines DtHumanAudioUpdater for managing audio effects in the human role
8//! \ingroup vreHumanFrontend
9
10#pragma once
11
13
15
17
19
20namespace makVrv
21{
22//! \brief Forward declaration of the display element class
23class DtDe;
24} // namespace makVrv
25
26namespace makAudio
27{
28//! \brief Forward declaration of the sound class
29class DtSound;
30} // namespace makAudio
31
32namespace makVre
33{
34//! \brief Forward declaration of the soundscape class
35class DtSoundscape;
36} // namespace makVre
37
39{
40//! \ingroup RoleConfigParams
41//! \defgroup HumanAudioUpdaterRoleParams Human Audio Updater Role Parameters
42//! \roleInherits{PlayerComponentRoleParams}
43//! Configuration Options for humanAudioUpdater role.
44//! @{
45
46//! \vreRoleParam{soundConfig,table,{},humanAudioUpdater,Configuration table containing audio settings for parachute and weapon sounds.}
47constexpr const char* soundConfig = "soundConfig";
48
49//! \vreRoleParam{soundscape,string,"",humanAudioUpdater,Name of the soundscape configuration file for ambient audio.}
50constexpr const char* soundscape = "soundscape";
51
52//! \vreRoleParam{soundscapeVolume,double,0.7,humanAudioUpdater,Volume level for the ambient soundscape audio.}
53constexpr const char* soundscapeVolume = "soundscapeVolume";
54
55//! @}
56} // namespace HumanAudioUpdaterConfig
57
58//! \brief Type identifier constant for DtHumanAudioUpdater components
59//!
60//! This constant defines the string identifier used to identify DtHumanAudioUpdater
61//! component types within the VR-Engage framework. It is used for component
62//! registration, type checking, and serialization operations.
63constexpr const char* DtHumanAudioUpdaterType = "DtHumanAudioUpdater";
64
65//! \brief Component for managing human-specific audio effects
66//!
67//! DtHumanAudioUpdater handles the audio effects related to the human entity,
68//! such as parachute sounds, weapon reload sounds, and environment soundscapes.
69//! It controls the timing and volume of audio cues based on player state and actions.
71{
72public:
73 //! \brief Default constructor
75
76 //! \brief Virtual destructor
77 virtual ~DtHumanAudioUpdater() override;
78
79 //! \brief Initializes the audio updater
80 //! \param player Pointer to the player station
81 //! \param config Configuration settings for initialization
82 //! \return True if initialization was successful, false otherwise
84
85 //! \brief Updates audio effects for the current frame
86 //! \param dt Delta time since the last frame in seconds
87 virtual void tick(double dt) override;
88
89 //! \brief Cleans up resources when the component is being shut down
90 virtual void shutdown() override;
91
92 //! \brief Returns the component type identifier
93 //! \return String identifier for this component type
94 //!
95 //! Returns the type identifier string for this component, which is used
96 //! by the VR-Engage framework for component identification and management.
97 //! The returned value matches DtHumanAudioUpdaterType.
98 virtual const char* type() const override;
99
100 //! \brief Handles changes in the weapon reload timer
101 //! \param reloadTimer Current value of the reload timer in seconds
102 //!
103 //! Schedules the reload sound when a reload starts.
104 virtual void onReloadTimerChanged(double reloadTimer);
105
106protected:
107 //! \brief Sound played during parachute freefall
108 makAudio::DtSound* myParachuteFreefallSound;
109
110 //! \brief Sound played when parachute opens
111 makAudio::DtSound* myParachuteOpenSound;
112
113 //! \brief Sound played when inside an open parachute
114 makAudio::DtSound* myParachuteInteriorSound;
115
116 //! \brief Sound played shortly after a weapon reload starts
117 makAudio::DtSound* myReloadSound;
118
119 //! \brief Whether a weapon reload is currently in progress
121
122 //! \brief Delay before playing the reload sound, in seconds
124
125 //! \brief Remaining delay before the pending reload sound plays, in seconds
127
128 //! \brief Normal speed for freefall sound playback
130
131 //! \brief Normal volume for freefall sound
133
134 //! \brief Current environmental soundscape
136
137 //! \brief Volume of the current soundscape
139
140 //! \brief Cached posture of the human entity
141 //!
142 //! Stored here so the open parachute sound can be triggered
143 //! at the right time.
145
146 //! \brief Handle for current human posture.
147 //! \vreAttrKey{posture}
149
150 //! \brief Handle for ownship velocity.
151 //! \vreAttrKey{ownship.velocity}
153
154 //! \brief Handle indicating whether ownship is embarked on an aircraft.
155 //! \vreAttrKey{ownship.embarked.embarkedOnAircraft}
157
158 //! \brief Handle for ownship position.
159 //! \vreAttrKey{ownship.position}
161};
Provides handle classes for safe access to attributes.
makVre::DtAttributeHandleType< makVre::HumanPosture > myPostureAttr
Handle for current human posture.
Definition humanAudioUpdater.h:148
makVre::DtAttributeHandleType< DtVector32 > myVelocityAttr
Handle for ownship velocity.
Definition humanAudioUpdater.h:152
bool myReloadInProgress
Whether a weapon reload is currently in progress.
Definition humanAudioUpdater.h:120
virtual ~DtHumanAudioUpdater() override
Virtual destructor.
virtual const char * type() const override
Returns the component type identifier.
virtual bool initialize(makVre::DtPlayerStation *player, makVre::DtInitTable &config) override
Initializes the audio updater.
makAudio::DtSound * myReloadSound
Sound played shortly after a weapon reload starts.
Definition humanAudioUpdater.h:117
double myReloadSoundTimer
Remaining delay before the pending reload sound plays, in seconds.
Definition humanAudioUpdater.h:126
double myReloadSoundDelay
Delay before playing the reload sound, in seconds.
Definition humanAudioUpdater.h:123
makAudio::DtSound * myParachuteInteriorSound
Sound played when inside an open parachute.
Definition humanAudioUpdater.h:114
double myFreefallNormalVolume
Normal volume for freefall sound.
Definition humanAudioUpdater.h:132
makVre::DtAttributeHandleType< bool > myEmbarkedOnAircraftAttr
Handle indicating whether ownship is embarked on an aircraft.
Definition humanAudioUpdater.h:156
makVre::DtSoundscape * mySoundscape
Current environmental soundscape.
Definition humanAudioUpdater.h:135
makVre::DtAttributeHandleType< DtVector > myPositionAttr
Handle for ownship position.
Definition humanAudioUpdater.h:160
DtHumanAudioUpdater()
Default constructor.
makAudio::DtSound * myParachuteOpenSound
Sound played when parachute opens.
Definition humanAudioUpdater.h:111
makVre::HumanPosture myCachedPosture
Cached posture of the human entity.
Definition humanAudioUpdater.h:144
virtual void tick(double dt) override
Updates audio effects for the current frame.
double mySoundscapeVolume
Volume of the current soundscape.
Definition humanAudioUpdater.h:138
virtual void shutdown() override
Cleans up resources when the component is being shut down.
double myFreefallNormalSpeed
Normal speed for freefall sound playback.
Definition humanAudioUpdater.h:129
virtual void onReloadTimerChanged(double reloadTimer)
Handles changes in the weapon reload timer.
makAudio::DtSound * myParachuteFreefallSound
Sound played during parachute freefall.
Definition humanAudioUpdater.h:108
Type-specific handle class for attributes.
Definition attributeHandle.h:229
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Base class for all role components in VR-Engage.
Definition playerComponent.h:102
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
A class for managing ambient and periodic sound effects.
Definition soundscape.h:43
constexpr const char * soundscape
Definition humanAudioUpdater.h:50
constexpr const char * soundscapeVolume
Definition humanAudioUpdater.h:53
constexpr const char * soundConfig
Definition humanAudioUpdater.h:47
constexpr const char * DtHumanAudioUpdaterType
Type identifier constant for DtHumanAudioUpdater components.
Definition humanAudioUpdater.h:63
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanAudioUpdater.h:39
Component configuration and usage details.
Definition audioUpdater.h:21
!
Definition glsVreMessageUtil.h:50
HumanPosture
Enumeration of human posture states.
Definition stateDefines.h:30
Definition appLauncherComponent.h:28
Defines the DtPlayerComponent base class for VR-Engage role components.
Common enumeration definitions used throughout the VREngage system.