HammeriteAudioSoundEvent
Audio. Inherits RefCounted
One sound, as heard by one listener.
Carries what a reacting agent needs to decide what to do: what it was, how loud it arrived, how far off it sounded - and, most usefully, WHERE IT SEEMED TO COME FROM.
Properties
| Type | Name | Default |
|---|---|---|
StringName | type | &"" |
Vector3 | source_position | Vector3(0, 0, 0) |
Vector3 | apparent_position | Vector3(0, 0, 0) |
float | level_db | 0.0 |
float | attenuation_db | 0.0 |
float | distance | 0.0 |
bool | is_direct | false |
float | cutoff_hz | 20000.0 |
Node | emitter | null |
Property descriptions
type
var type: StringName = &""
The sound's type, as the emitter stamped it.
source_position
var source_position: Vector3 = Vector3(0, 0, 0)
Where the sound really was made.
apparent_position
var apparent_position: Vector3 = Vector3(0, 0, 0)
Where it SEEMED to come from: the last opening the sound came through before reaching the listener, or the true source when nothing stood between them. This is the difference between a guard who investigates the doorway a noise came through and one who walks into the wall you are standing behind. A listener that acts on this is not being generous - it genuinely cannot tell the difference, and neither can a person.
level_db
var level_db: float = 0.0
Level at the listener in dB: the type's source loudness, less what the world took out of it.
attenuation_db
var attenuation_db: float = 0.0
How much the world took out of it - distance, walls, doors, going round corners. A large value on an audible sound means "muffled, far away, and I am not sure where".
distance
var distance: float = 0.0
Length of the path the sound actually travelled, round corners rather than through them.
is_direct
var is_direct: bool = false
True when the listener had a clear run to the source, so apparent_position is the real one.
cutoff_hz
var cutoff_hz: float = 20000.0
How bright it arrived, in Hz: the low-pass cutoff its route left it with. Open air is HammeriteAudioCalculations.OPEN_AIR_CUTOFF_HZ; a shut door two rooms away is a few hundred. A listener that acts on this is telling muffled from near - a voice heard through a wall is not one heard across a hall, however alike their levels.
emitter
var emitter: Node = null
The node that made the sound, when there was one. Null for a one-shot played at a bare position.