VR-Engage  2.2
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
18namespace makVrv
19{
20//! \brief Forward declaration of the display element class
21class DtDe;
22} // namespace makVrv
23
24namespace makAudio
25{
26//! \brief Forward declaration of the sound class
27class DtSound;
28} // namespace makAudio
29
30namespace makVre
31{
32//! \brief Forward declaration of the soundscape class
33class DtSoundscape;
34} // namespace makVre
35
37{
38//! \ingroup RoleConfigParams
39//! \defgroup HumanAudioUpdaterRoleParams Human Audio Updater Role Parameters
40//! \roleInherits{PlayerComponentRoleParams}
41//! Configuration Options for humanAudioUpdater role.
42//! @{
43
44//! \vreRoleParam{soundConfig,table,{},humanAudioUpdater,Configuration table containing audio settings for parachute and weapon sounds.}
45constexpr const char* soundConfig = "soundConfig";
46
47//! \vreRoleParam{soundscape,string,"",humanAudioUpdater,Name of the soundscape configuration file for ambient audio.}
48constexpr const char* soundscape = "soundscape";
49
50//! \vreRoleParam{soundscapeVolume,double,0.7,humanAudioUpdater,Volume level for the ambient soundscape audio.}
51constexpr const char* soundscapeVolume = "soundscapeVolume";
52
53//! @}
54} // namespace HumanAudioUpdaterConfig
55
56//! \brief Type identifier constant for DtHumanAudioUpdater components
57//!
58//! This constant defines the string identifier used to identify DtHumanAudioUpdater
59//! component types within the VR-Engage framework. It is used for component
60//! registration, type checking, and serialization operations.
61constexpr const char* DtHumanAudioUpdaterType = "DtHumanAudioUpdater";
62
63//! \brief Component for managing human-specific audio effects
64//!
65//! DtHumanAudioUpdater handles the audio effects related to the human entity,
66//! such as parachute sounds, weapon reload sounds, and environment soundscapes.
67//! It controls the timing and volume of audio cues based on player state and actions.
69{
70public:
71 //! \brief Default constructor
73
74 //! \brief Virtual destructor
75 virtual ~DtHumanAudioUpdater() override;
76
77 //! \brief Initializes the audio updater
78 //! \param player Pointer to the player station
79 //! \param config Configuration settings for initialization
80 //! \return True if initialization was successful, false otherwise
82
83 //! \brief Updates audio effects for the current frame
84 //! \param dt Delta time since the last frame in seconds
85 virtual void tick(double dt) override;
86
87 //! \brief Cleans up resources when the component is being shut down
88 virtual void shutdown() override;
89
90 //! \brief Returns the component type identifier
91 //! \return String identifier for this component type
92 //!
93 //! Returns the type identifier string for this component, which is used
94 //! by the VR-Engage framework for component identification and management.
95 //! The returned value matches DtHumanAudioUpdaterType.
96 virtual const char* type() const override;
97
98 //! \brief Handles changes in the weapon reload timer
99 //! \param reloadTimer Current value of the reload timer in seconds
100 //!
101 //! Called when the weapon reload timer changes, to update reload sound effects
102 virtual void onReloadTimerChanged(float reloadTimer);
103
104protected:
105 //! \brief Sound played during parachute freefall
106 makAudio::DtSound* myParachuteFreefallSound;
107
108 //! \brief Sound played when parachute opens
109 makAudio::DtSound* myParachuteOpenSound;
110
111 //! \brief Sound played when inside an open parachute
112 makAudio::DtSound* myParachuteInteriorSound;
113
114 //! \brief Sound played during weapon reload
115 makAudio::DtSound* myReloadSound;
116
117 //! \brief Normal speed for freefall sound playback
119
120 //! \brief Normal volume for freefall sound
122
123 //! \brief Current environmental soundscape
125
126 //! \brief Volume of the current soundscape
128
129 //! \brief Cached posture of the human entity
130 //!
131 //! Stored here so the open parachute sound can be triggered
132 //! at the right time.
134};
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 during weapon reload.
Definition humanAudioUpdater.h:115
makAudio::DtSound * myParachuteInteriorSound
Sound played when inside an open parachute.
Definition humanAudioUpdater.h:112
virtual void onReloadTimerChanged(float reloadTimer)
Handles changes in the weapon reload timer.
double myFreefallNormalVolume
Normal volume for freefall sound.
Definition humanAudioUpdater.h:121
makVre::DtSoundscape * mySoundscape
Current environmental soundscape.
Definition humanAudioUpdater.h:124
DtHumanAudioUpdater()
Default constructor.
makAudio::DtSound * myParachuteOpenSound
Sound played when parachute opens.
Definition humanAudioUpdater.h:109
makVre::HumanPosture myCachedPosture
Cached posture of the human entity.
Definition humanAudioUpdater.h:133
virtual void tick(double dt) override
Updates audio effects for the current frame.
double mySoundscapeVolume
Volume of the current soundscape.
Definition humanAudioUpdater.h:127
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:118
makAudio::DtSound * myParachuteFreefallSound
Sound played during parachute freefall.
Definition humanAudioUpdater.h:106
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:78
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:48
constexpr const char * soundscapeVolume
Definition humanAudioUpdater.h:51
constexpr const char * soundConfig
Definition humanAudioUpdater.h:45
constexpr const char * DtHumanAudioUpdaterType
Type identifier constant for DtHumanAudioUpdater components.
Definition humanAudioUpdater.h:61
Defines export macros for the Human Frontend library.
#define HUMAN_DLL
Definition export.h:19
Definition humanAudioUpdater.h:37
Component configuration and usage details.
Definition audioUpdater.h:21
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
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.