Class SoundEmitter

Hierarchy

  • EventEmitter
    • SoundEmitter

Constructors

Properties

_steps: Timeout[]
destroyed: boolean = false

If .destroy() has been called on the sound emitter.

global: boolean = false

Whether or not to play the sound globally

loop: boolean = false

Whether or not to loop the sound

name: string
netId: number
pitch: number = 1

Pitch of the sound emitted

playing: boolean = false
position: Vector3 = ...
range: number = 30

Range of the sound emitted

sound: number

Item id of the sound to use

startTime: Date

Used for attempting to sync the audio between clients

volume: number = 1

Volume of the sound emitted

captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

soundEmitterId: number = 0

Methods

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Remove the sound emitter from Game.world,
    clear all event listeners,
    and tell clients to delete the sound emitter.

    Returns Promise<never>

  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Returns (string | symbol)[]

  • Returns number

  • Parameters

    • type: string | symbol

    Returns number

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Parameters

    • event: string | symbol

    Returns Function[]

  • Parameters

    • Optional event: string | symbol

    Returns SoundEmitter

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns SoundEmitter

  • Identical to setInterval, but will be cleared after the sound emitter is destroyed. Use this if you want to attach loops to sound emitters, but don't want to worry about clearing them after they're destroyed.

    Parameters

    • callback: (() => void)

      The callback function.

        • (): void
        • Returns void

    • delay: number

      The delay in milliseconds.

    Returns Timeout

  • Set the looping of the sound emitter.

    Parameters

    • loop: boolean

    Returns Promise<boolean>

  • Parameters

    • n: number

    Returns SoundEmitter

  • Set the pitch of the sound emitter.

    Parameters

    • pitch: number

    Returns Promise<boolean>

  • Set the range of the sound emitter.

    Parameters

    • range: number

    Returns Promise<boolean>

  • Set the sound to emit.

    Parameters

    • sound: number

    Returns Promise<boolean>

  • Set the volume of the sound emitter.

    Parameters

    • volume: number

    Returns Promise<boolean>

  • Deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>