Class: MockSoundObject
Mock of the X-Ray engine sound object.
Implements
sound_object
Constructors
Constructor
new MockSoundObject(path: string): MockSoundObject;Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
MockSoundObject
Methods
asObject()
static asObject(sound: sound_object | null | undefined): MockSoundObject;Parameters
| Parameter | Type |
|---|---|
sound | sound_object | null | undefined |
Returns
MockSoundObject
create()
static create(path: string): MockSoundObject;Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
MockSoundObject
mock()
static mock(path: string): sound_object;Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
sound_object
resetRegistry()
static resetRegistry(): void;Returns
void
Properties
attach_tail
attach_tail: Mock<UnknownFunction>;Append a tail sound played after this sound ends.
Remarks
The tail path is passed to the engine sound handle as-is. Use a game sound resource path without extension.
Param
sound_path
Sound resource path without extension.
Implementation of
sound_object.attach_tailfrequency
frequency: number = 1;Playback frequency multiplier.
Implementation of
sound_object.frequencyget_position
get_position: Mock<() => MockVector>;Get the current playback position.
Remarks
Logs an engine script error and returns a zero vector if the sound was not launched.
Returns
Current sound position.
Implementation of
sound_object.get_positionisPlaying
isPlaying: boolean = false;length
length: Mock<() => number>;Get sound length in milliseconds.
Remarks
Reads the engine sound handle. Do not use it as a file-existence check after construction logged a missing file.
Returns
Sound duration.
Implementation of
sound_object.lengthmax_distance
max_distance: number = 1;Maximum audible distance in meters.
Implementation of
sound_object.max_distancemin_distance
min_distance: number = 0;Minimum distance before attenuation starts.
Implementation of
sound_object.min_distancepath
path: string;play
play: Mock<() => void>;Play the sound attached to an object, or globally when object is null.
Throws
If the sound handle was not created.
Param
object
Object used as sound owner.
Implementation of
sound_object.playplay_at_pos
play_at_pos: Mock<() => void>;Play the sound at a fixed world position.
Throws
If the sound handle was not created.
Param
object
Optional object used as sound owner.
Param
position
World position for playback.
Implementation of
sound_object.play_at_posplay_no_feedback
play_no_feedback: Mock<() => void>;Play without tracking feedback.
Remarks
This starts playback without storing feedback on the sound_object, so playing() will not describe this playback instance.
Throws
If the sound handle was not created.
Param
object
Optional object used as sound owner.
Param
flags
Playback flags.
Param
delay
Delay in seconds.
Param
position
Optional playback position.
Param
volume
Optional playback volume.
Implementation of
sound_object.play_no_feedbackplaying
playing: Mock<() => boolean>;Check whether the sound has active playback feedback.
Remarks
Sounds started with play_no_feedback are intentionally not tracked by feedback.
Returns
Whether the sound is currently playing.
Implementation of
sound_object.playingposition
position: MockVector;set_position
set_position: Mock<(position: MockVector) => void>;Move the sound emitter.
Throws
If the sound handle was not created.
Param
position
New world position.
Implementation of
sound_object.set_positionsoundLength
soundLength: number = 30;stop
stop: Mock<() => void>;Stop playback immediately.
Throws
If the sound handle was not created.
Implementation of
sound_object.stopstop_deferred
stop_deferred: Mock<() => void>;Stop playback through the engine deferred-stop path.
Remarks
Preferred spelling. stop_deffered is kept for script compatibility.
Throws
If the sound handle was not created.
Implementation of
sound_object.stop_deferredstop_deffered
stop_deffered: Mock<() => void>;Stop playback through the engine deferred-stop path.
Remarks
Legacy misspelled alias for stop_deferred.
Throws
If the sound handle was not created.
Implementation of
sound_object.stop_defferedvolume
volume: number = 0;Playback volume.
Implementation of
sound_object.volumeSOUND_OBJECT_REGISTRY
readonly static SOUND_OBJECT_REGISTRY: MockSoundObject[] = [];