Talos docs

AudioOptions

Since 0.6Changed in next
Plain text

Signature

export interface AudioOptions {
  loop?: boolean
  bus?: AudioBus
  /** 0..1 */
  volume?: number
  /** Playback rate; 1 is as authored. Omitted takes the asset's `meta.audio.sounds` default. */
  pitch?: number
  /** Spatialise at a point or follow an entity; omitted plays non-spatial. */
  at?: Target
  /**
   * A spatial sound's nominal range, metres, more than 0. Full volume within a tenth of it, silent
   * beyond twice it. Default 12 (silent past 24 m); a siren or a distant drone wants far more.
   */
  range?: number
  /** The curve between: `inverse` (physical), `linear`, or `log` (falls late). Default: the asset's `meta.audio.sounds` curve, else inverse. */
  rolloff?: "inverse" | "linear" | "log"
  /**
   * Distance muffling, Hz: a low-pass open at the source, at this cutoff at `range`, and lower by the
   * same factor for each `range` further. 1000 to 2000 suits most outdoor sounds. Omitted: no filter.
   */
  lowPassAtRange?: number
}

Import: import type { AudioOptions } from "@argus/api"

Members

MemberSignatureDescription
looploop?: boolean
busbus?: AudioBus
volumevolume?: number0..1
pitchpitch?: numberPlayback rate; 1 is as authored. Omitted takes the asset's meta.audio.sounds default.
atat?: TargetSpatialise at a point or follow an entity; omitted plays non-spatial.
rangerange?: numberA spatial sound's nominal range, metres, more than 0. Full volume within a tenth of it, silent beyond twice it. Default 12 (silent past 24 m); a siren or a distant drone wants far more.
rolloffrolloff?: "inverse" | "linear" | "log"The curve between: inverse (physical), linear, or log (falls late). Default: the asset's meta.audio.sounds curve, else inverse.
lowPassAtRangelowPassAtRange?: numberDistance muffling, Hz: a low-pass open at the source, at this cutoff at range, and lower by the same factor for each range further. 1000 to 2000 suits most outdoor sounds. Omitted: no filter.

Example

The tested fixture fixtures/app/agent.ts.

import type { Behavior } from "@argus/api"

// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
  init(ctx) {
    ctx.state.arrived = false
    ctx.nav?.goTo(ctx.props.target as [number, number, number])
  },
  update(ctx) {
    if (ctx.nav?.arrived) ctx.state.arrived = true
  },
} satisfies Behavior