FEchoTail
FEchoTail — the echo a space gives back, built from where the scanner's rays actually landed instead of a reverb preset per room. Every shot contributes its hit distances to a decaying histogram (0.5 m bins out to 64 m) and its misses to an "open air" weight. From that:
- Module
- Audio
- Header
#include "Audio/EchoTail.h"- Namespace
Mowo
- pre-delay = 2 * nearest well-populated distance / c; - decay (RT60) = the mean-free-path law with a fixed wall absorption, RT60 = 0.113 * meanDistance, shortened as more rays escape; - density = returned rays / all rays.
The estimate is published as the EchoDecay / EchoPreDelay / EchoDensity parameters, and BuildImpulseResponse synthesises a stereo IR from the same histogram — one early reflection per populated bin at its round-trip time, then a decorrelated noise tail decaying at the RT60. With a target submix set (SetTargetSubmix, or the audio.EchoTailSubmix cvar) a convolution reverb on that submix is rebuilt from the IR whenever the estimate moves enough, at most once a second. Main thread only; ticked by AudioEngine::UpdateVoices.
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | kSpeedOfSound | Default 343.0f. |
static constexpr float | kBinMeters | Default 0.5f. |
static constexpr uint32_t | kBinCount | Default 128. |
static constexpr const char* | kDecayParameter | Default "EchoDecay". |
static constexpr const char* | kPreDelayParameter | Default "EchoPreDelay". |
static constexpr const char* | kDensityParameter | Default "EchoDensity". |
Public functions
| Returns | Name | Description |
|---|---|---|
FEchoTail& | Get | |
void | SubmitShot | One shot's hit distances (from its origin), out of rayCount rays; the rays that found nothing count as open air. |
void | SetMemorySeconds | Seconds for old evidence to fall to half its weight. |
void | SetWallAbsorption | What the walls absorb, energy-weighted. |
float | GetWallAbsorption | |
void | SetEarlyReflections | Exact early reflections from the geometry. |
const std::vector<FEchoTap>& | GetEarlyReflections | |
void | Tick | |
void | Reset | |
FEchoTailEstimate | GetEstimate | |
void | BuildImpulseResponse | |
void | SetTargetSubmix | Empty clears the target and removes the reverb it placed. |
const std::string& | GetTargetSubmix | |
uint32_t | GetRebuildCount | |
bool | HasReverb | |
void | ReleaseReverb | Takes the reverb out of its submix and drops it; the target stays, so it is rebuilt on the next tick of a running engine. |
Function details
Get
static FEchoTail& Get()SubmitShot
void SubmitShot(const float* hitDistances, uint32_t hitCount, uint32_t rayCount, float weight = 1.0f)One shot's hit distances (from its origin), out of rayCount rays; the rays that found nothing count as open air.
SetMemorySeconds
void SetMemorySeconds(float seconds)Seconds for old evidence to fall to half its weight.
SetWallAbsorption
void SetWallAbsorption(float absorption)What the walls absorb, energy-weighted. The scanner alone cannot know the materials and assumes painted concrete (0.3); geometric acoustics traces them and hands the real figure in.
GetWallAbsorption
float GetWallAbsorption() constSetEarlyReflections
void SetEarlyReflections(const std::vector<FEchoTap>& taps)Exact early reflections from the geometry. While any are set they replace the histogram's one-tap-per-bin guess in the impulse response; an empty list goes back to the guess.
GetEarlyReflections
const std::vector<FEchoTap>& GetEarlyReflections() constTick
void Tick(float deltaTime)Reset
void Reset()GetEstimate
FEchoTailEstimate GetEstimate() constBuildImpulseResponse
void BuildImpulseResponse(uint32_t sampleRate, float maxSeconds, uint32_t seed, std::vector<float>& outInterleavedStereo, uint32_t& outFrames) constSetTargetSubmix
void SetTargetSubmix(const std::string& submix, float wet = 0.35f, float dry = 1.0f)Empty clears the target and removes the reverb it placed.
GetTargetSubmix
const std::string& GetTargetSubmix() constGetRebuildCount
uint32_t GetRebuildCount() constHasReverb
bool HasReverb() constReleaseReverb
void ReleaseReverb()Takes the reverb out of its submix and drops it; the target stays, so it is rebuilt on the next tick of a running engine. AudioEngine::Shutdown calls it while the graph still exists.