#
Class: Sound#
HierarchyHandle<sound>
↳ Sound
#
Constructors#
constructornew Sound(fileName: string, looping: boolean, is3D: boolean, stopWhenOutOfRange: boolean, fadeInRate: number, fadeOutRate: number, eaxSetting: string): Sound
Creates a sound handle.
note
You can only play the same sound handle once.
note
You can only play the same sound filepath four times.
note
You can only play 16 sounds in general.
note
Sounds of the same filepath (on different sound handles) must have a delay
of at least 0.1 seconds inbetween them to be played.
You can overcome this by starting one earlier and then using SetSoundPosition
.
#
Parameters:Name | Type | Description |
---|---|---|
fileName | string | The path to the file. |
looping | boolean | Looping sounds will restart once the sound duration has finished. |
is3D | boolean | 3D Sounds can be played on particular areas of the map. They are at their loudest when the camera is close to the sound's coordinates. |
stopWhenOutOfRange | boolean | |
fadeInRate | number | How quickly the sound fades in. The higher the number, the faster the sound fades in. Maximum number is 127. |
fadeOutRate | number | How quickly the sound fades out. The higher the number, the faster the sound fades out. Maximum number is 127. |
eaxSetting | string | EAX is an acronym for environmental audio extensions. In the sound editor, this corresponds to the "Effect" setting. |
Returns: Sound
Defined in: handles/sound.ts:5
#
Properties#
handle• Readonly
handle: sound
Defined in: handles/handle.ts:6
#
Accessors#
dialogueSpeakerNameKeydialogueSpeakerNameKey(): string
Returns: string
Defined in: handles/sound.ts:30
dialogueSpeakerNameKey(speakerName: string): void
#
Parameters:Name | Type |
---|---|
speakerName | string |
Returns: void
Defined in: handles/sound.ts:34
#
dialogueTextKeydialogueTextKey(): string
Returns: string
Defined in: handles/sound.ts:38
dialogueTextKey(dialogueText: string): void
#
Parameters:Name | Type |
---|---|
dialogueText | string |
Returns: void
Defined in: handles/sound.ts:42
#
durationduration(): number
Returns: number
Defined in: handles/sound.ts:46
duration(duration: number): void
#
Parameters:Name | Type |
---|---|
duration | number |
Returns: void
Defined in: handles/sound.ts:50
#
idid(): number
Get the unique ID of the handle. The ID is recycled once you destroy the object.
Returns: number
The unique ID of a handle object.
Defined in: handles/handle.ts:18
#
loadingloading(): boolean
Returns: boolean
Defined in: handles/sound.ts:54
#
playingplaying(): boolean
Returns: boolean
Defined in: handles/sound.ts:58
#
Methods#
killWhenDonekillWhenDone(): void
Returns: void
Defined in: handles/sound.ts:62
#
registerStackedregisterStacked(byPosition: boolean, rectWidth: number, rectHeight: number): void
#
Parameters:Name | Type |
---|---|
byPosition | boolean |
rectWidth | number |
rectHeight | number |
Returns: void
Defined in: handles/sound.ts:66
#
setChannelsetChannel(channel: number): void
#
Parameters:Name | Type |
---|---|
channel | number |
Returns: void
Defined in: handles/sound.ts:70
#
setConeAnglessetConeAngles(inside: number, outside: number, outsideVolume: number): void
note
This call is only valid if the sound was created with 3d enabled
#
Parameters:Name | Type |
---|---|
inside | number |
outside | number |
outsideVolume | number |
Returns: void
Defined in: handles/sound.ts:77
#
setConeOrientationsetConeOrientation(x: number, y: number, z: number): void
note
This call is only valid if the sound was created with 3d enabled
#
Parameters:Name | Type |
---|---|
x | number |
y | number |
z | number |
Returns: void
Defined in: handles/sound.ts:84
#
setDistanceCutoffsetDistanceCutoff(cutoff: number): void
#
Parameters:Name | Type |
---|---|
cutoff | number |
Returns: void
Defined in: handles/sound.ts:88
#
setDistancessetDistances(minDist: number, maxDist: number): void
note
This call is only valid if the sound was created with 3d enabled
#
Parameters:Name | Type |
---|---|
minDist | number |
maxDist | number |
Returns: void
Defined in: handles/sound.ts:95
#
setFacialAnimationFilepathsetFacialAnimationFilepath(animationSetFilepath: string): void
#
Parameters:Name | Type |
---|---|
animationSetFilepath | string |
Returns: void
Defined in: handles/sound.ts:99
#
setFacialAnimationGroupLabelsetFacialAnimationGroupLabel(groupLabel: string): void
#
Parameters:Name | Type |
---|---|
groupLabel | string |
Returns: void
Defined in: handles/sound.ts:103
#
setFacialAnimationLabelsetFacialAnimationLabel(animationLabel: string): void
#
Parameters:Name | Type |
---|---|
animationLabel | string |
Returns: void
Defined in: handles/sound.ts:107
#
setParamsFromLabelsetParamsFromLabel(soundLabel: string): void
pplies default settings to the sound.
#
Parameters:Name | Type | Description |
---|---|---|
soundLabel | string | The label out of one of the SLK-files, whose settings should be used, e.g. values like volume, pitch, pitch variance, priority, channel, min distance, max distance, distance cutoff or eax. |
Returns: void
Defined in: handles/sound.ts:115
#
setPitchsetPitch(pitch: number): void
Tones the pitch of the sound, default value is 1. Increasing it you get the chipmunk version and the sound becomes shorter, when decremented the sound becomes low-pitched and longer.
bug
This native has very weird behaviour.
See this for an explenation
and this for a non-bugged implementation.
#
Parameters:Name | Type |
---|---|
pitch | number |
Returns: void
Defined in: handles/sound.ts:127
#
setPlayPositionsetPlayPosition(millisecs: number): void
Must be called immediately after starting the sound
#
Parameters:Name | Type | Description |
---|---|---|
millisecs | number |
Returns: void
Defined in: handles/sound.ts:135
#
setPositionsetPosition(x: number, y: number, z: number): void
note
This call is only valid if the sound was created with 3d enabled
#
Parameters:Name | Type |
---|---|
x | number |
y | number |
z | number |
Returns: void
Defined in: handles/sound.ts:142
#
setVelocitysetVelocity(x: number, y: number, z: number): void
note
This call is only valid if the sound was created with 3d enabled
#
Parameters:Name | Type |
---|---|
x | number |
y | number |
z | number |
Returns: void
Defined in: handles/sound.ts:149
#
setVolumesetVolume(volume: number): void
Sets the sounds volume
#
Parameters:Name | Type | Description |
---|---|---|
volume | number | Volume, between 0 and 127 |
Returns: void
Defined in: handles/sound.ts:157
#
startstart(): void
Starts the sound.
note
You can only play the same sound handle once.
note
You can only play 16 sounds in general.
note
Sounds of the same filepath (on different sound handles) must have a delay of at least 0.1 seconds inbetween them to be played.
You can overcome this by starting one earlier and then using setPosition
.
Returns: void
Defined in: handles/sound.ts:168
#
stopstop(killWhenDone: boolean, fadeOut: boolean): void
Stops the sound.
#
Parameters:Name | Type | Description |
---|---|---|
killWhenDone | boolean | The sound gets destroyed if true. |
fadeOut | boolean | Turns down the volume with fadeOutRate as stated in constructor. |
Returns: void
Defined in: handles/sound.ts:177
#
unregisterStackedunregisterStacked(byPosition: boolean, rectWidth: number, rectHeight: number): void
#
Parameters:Name | Type |
---|---|
byPosition | boolean |
rectWidth | number |
rectHeight | number |
Returns: void
Defined in: handles/sound.ts:181
#
fromHandlestatic fromHandle(handle: sound): Sound
#
Parameters:Name | Type |
---|---|
handle | sound |
Returns: Sound
Defined in: handles/sound.ts:185
#
getFileDurationstatic getFileDuration(fileName: string): number
#
Parameters:Name | Type |
---|---|
fileName | string |
Returns: number
Defined in: handles/sound.ts:189