Interface SoundEmitterOptions

Used for configuring properties of a SoundEmitter game object

SoundEmitterOptions

interface SoundEmitterOptions {
    fallOffFunction?: ((distance) => number);
    listener: GameObject;
    loop?: boolean;
    maxDistance?: number;
    minDistance?: number;
    playbackRate?: number;
    source: string;
    startPlaying?: boolean;
    volume?: number;
}

Hierarchy (view full)

Properties

fallOffFunction?: ((distance) => number)

A function that takes the distance from the listener and returns the volume of the sound. Default is a linear fall off function

Type declaration

    • (distance): number
    • A function that takes the distance from the listener and returns the volume of the sound. Default is a linear fall off function

      Parameters

      • distance: number

      Returns number

listener: GameObject

The game object that will listen to the sound- eg: the player. Distance from the source is calculated from this object

loop?: boolean

Set to true to loop the sound, default is false

maxDistance?: number

The maximum distance the sound can be heard from (if outside this range, the volume of the sound will be 0)

minDistance?: number

The minimum distance the sound can be heard from (if inside this range, the volume of the sound will be 1)

playbackRate?: number

The playback rate of the sound, default is 1

source: string

The source of the sound (eg: "sound.mp3")

startPlaying?: boolean

Set to false to prevent the sound from playing when the scene starts (default is true)

volume?: number

The volume of the sound, default is 1

Generated using TypeDoc