Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents an audio clip optimized for streaming playback.

Hierarchy

  • Sound

Index

Constructors

constructor

  • new Sound(fileName: string): Sound
  • Construct a Sound that can be used to play back the given audio file. The sound can be used immediately, but playback may be silent until enough audio data has been buffered.

    Parameters

    • fileName: string

      SphereFS path of an audio file.

    Returns Sound

Properties

fileName

fileName: string

length

length: number

Duration of this sound, in seconds.

pan

pan: number

playing

playing: boolean

true if the sound is currently playing; false otherwise.

position

position: number

repeat

repeat: boolean

speed

speed: number

volume

volume: number

Methods

pause

  • pause(): void
  • Pause playback of this sound. It can be resumed later by calling play() without a mixer.

    Returns void

play

  • play(mixer?: Mixer): void
  • Play the sound on a given mixer. If the sound is paused and a mixer is not specified, resume playback from the paused position.

    Parameters

    • Optional mixer: Mixer

      The mixer used to play back the sound.

    Returns void

stop

  • stop(): void

Static fromFile

  • fromFile(fileName: string): Promise<Sound>
  • Open an audio file in the background and construct a Sound that can be used to play it.

    async

    Parameters

    • fileName: string

      SphereFS path of an audio file.

    Returns Promise<Sound>

    A promise for the newly constructed Sound.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc