HammeriteAudioSoundSpec
Audio. Inherits Resource
What to play and how: the description a sound is created from.
Handed to HammeriteAudioManager.create_positional_sound() or HammeriteAudioManager.create_environmental_sound(), which read it once and keep their own copy of what it said. So one spec can create any number of sounds, and changing it afterwards changes none of them - what a sound is doing now is changed through the manager, by its handle.
var spec := HammeriteAudioSoundSpec.new() spec.sound_file = "doors/creak.ogg" spec.position = door.global_position var handle := manager.create_positional_sound(spec) manager.play_sound(handle) A resource, so a game can author one beside the thing that makes the noise rather than building it in code. Most sounds want an HammeriteAudioEmitter3D or HammeriteAudio.play_one_shot() instead; this is the layer under both.
The recording, by its name in HammeriteAudioRuntime.sounds - doors/creak.ogg under one of its search paths - or by a resource path. A name that resolves to nothing creates no sound.
Properties
| Type | Name | Default |
|---|---|---|
float | attenuation_scale | 1.0 |
Vector3 | direction | Vector3(0, 0, 0) |
bool | free_when_finished | false |
bool | loop | false |
float | max_distance | 0.0 |
Vector3 | position | Vector3(0, 0, 0) |
bool | propagate | true |
String | sound_file | "" |
float | volume_db | 0.0 |
Property descriptions
attenuation_scale
var attenuation_scale: float = 1.0
Undocumented.
direction
var direction: Vector3 = Vector3(0, 0, 0)
Undocumented.
free_when_finished
var free_when_finished: bool = false
Undocumented.
loop
var loop: bool = false
Undocumented.
max_distance
var max_distance: float = 0.0
Undocumented.
position
var position: Vector3 = Vector3(0, 0, 0)
Undocumented.
propagate
var propagate: bool = true
Undocumented.
sound_file
var sound_file: String = ""
Undocumented.
volume_db
var volume_db: float = 0.0
Undocumented.