FSoundOcclusion
- Module
- Audio
- Header
#include "Audio/SoundOcclusion.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | kOpenCutoffHz | Default 20000.0f. |
static constexpr float | kFloorDb | Default -60.0f. |
static constexpr float | kThinWallDb | Default -9.0f. |
static constexpr float | kThinWallCutoffHz | Default 2500.0f. |
static constexpr float | kThickWallDb | Default -18.0f. |
static constexpr float | kThickWallCutoffHz | Default 900.0f. |
static constexpr float | kDefaultSmoothing | Default 5.0f. |
Public functions
| Returns | Name | Description |
|---|---|---|
FSoundOcclusionMaterial | DefaultMaterial | The shipped row for a surface (the engine default, not the live table). |
FSoundOcclusionMaterial | GetMaterial | |
void | SetMaterial | |
void | ResetDefaults | |
float | GetSmoothing | Rate a smoothed voice approaches its target at, per second. |
void | SetSmoothing | |
void | LoadFromConfig | Reads audio.occlusion.<Surface>.db / .cutoff_hz and audio.occlusion.smoothing; a key that is absent keeps the engine default, so a project only writes the rows it changes. |
void | LoadFromGlobalConfig | |
void | SaveToConfig | |
std::string | ConfigKey | |
uint32_t | DefaultLayerMask | Every layer but Player: the ray ends at the listener, who stands inside a character capsule that is a real body. |
void | AddLayer | Folds one layer into a result: dB adds, the cutoff takes the darker. |
void | AddSurface | |
FSoundOcclusionResult | Trace | Every wall between two points, through the physics scene. |
void | Approach | Frame-rate independent approach of a playing voice toward its target. |
float | DbToGain | |
float | GainToDb |
Function details
DefaultMaterial
static FSoundOcclusionMaterial DefaultMaterial(ESurfaceType surface)The shipped row for a surface (the engine default, not the live table).
GetMaterial
static FSoundOcclusionMaterial GetMaterial(ESurfaceType surface)SetMaterial
static void SetMaterial(ESurfaceType surface, const FSoundOcclusionMaterial& material)ResetDefaults
static void ResetDefaults()GetSmoothing
static float GetSmoothing()Rate a smoothed voice approaches its target at, per second.
SetSmoothing
static void SetSmoothing(float ratePerSecond)LoadFromConfig
static void LoadFromConfig(const Config& config)Reads audio.occlusion.<Surface>.db / .cutoff_hz and audio.occlusion.smoothing; a key that is absent keeps the engine default, so a project only writes the rows it changes.
LoadFromGlobalConfig
static void LoadFromGlobalConfig()SaveToConfig
static void SaveToConfig(Config& config)ConfigKey
static std::string ConfigKey(ESurfaceType surface, const char* field)DefaultLayerMask
static uint32_t DefaultLayerMask()Every layer but Player: the ray ends at the listener, who stands inside a character capsule that is a real body. Tracing it made every source in the level read as behind a wall.
AddLayer
static void AddLayer(FSoundOcclusionResult& result, float attenuationDb, float cutoffHz)Folds one layer into a result: dB adds, the cutoff takes the darker.
AddSurface
static void AddSurface(FSoundOcclusionResult& result, ESurfaceType surface)Trace
static FSoundOcclusionResult Trace(const PhysicsWorld& world, const Vec3& from, const Vec3& to, uint32_t layerMask)Every wall between two points, through the physics scene. Hits right at either end are dropped: a ray that starts inside the emitter's own prop or ends inside the listener's body reports them at fraction 0.
Approach
static void Approach(FSoundOcclusionState& state, const FSoundOcclusionResult& target, float ratePerSecond, float deltaTime)Frame-rate independent approach of a playing voice toward its target. The cutoff moves in log space so a sweep from 20 kHz to 900 Hz sounds even, and both snap once close so the filter is not rebuilt forever around its resting point.
DbToGain
static float DbToGain(float db)GainToDb
static float GainToDb(float gain)