Vixen
02b45cc4
csharp
public sealed class AudioEvent

A sound as a designer describes it, rather than a file as a programmer plays it.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

This is the layer that separates an audio engine from audio middleware. Gameplay says footsteps.Play(feet). Which of the five takes, at what pitch, how loud, on which bus, how far it carries, how many may sound at once and which one gives way when they do — all of that is the event's, and every one of those decisions is a thing a sound designer wants to change and a programmer should not have to.

It plays through the ordinary front door. Every path here ends in AudioEngine.Play with a PlaybackSettings it computed; there is no second play path into the mixer and nothing here the mixer knows about. That is deliberate — an event is an authoring idea, and the mixer stays a thing that renders voices.

Nothing is allocated by a play. The variant list, the weights, the shuffle bag and the instance table are all sized once, at construction; a play is some arithmetic, an index and a call. docs/plan/00 forbids garbage in the frame loop, and a footstep is the frame loop.

Game thread only. An event holds its selection state and its live instances without a lock, and the audio thread never sees one. Two threads playing the same event is a bug in the caller, and the shape of an engine that wants that is one event per thread.

Fields and properties (14)

  • public string Name

    What it is called.

  • public int Bus

    Which bus its plays route into.

  • public VariantSelector Variants

    Which variant plays next, and the state behind that.

  • public int VariantCount

    How many sounds it can choose between.

  • public IReadOnlyList<AudioEventLayer> Layers

    The other events it plays alongside itself.

  • public int MaxInstances

    How many copies may sound at once. Zero is no limit.

  • public EventStealMode Steal

    What gives way when MaxInstances is reached.

  • public bool IsSpatial

    Whether its plays are things in the world.

  • public SpatialSettings Spatial

    How its plays attenuate. The position is the caller's.

  • public AudioParameterSheet? Parameters

    The named values its plays read, or null.

  • public float LastGain

    The gain the last play landed on, before the caller's own trim.

  • public float LastPitch

    The pitch ratio the last play landed on, before the caller's own trim.

  • public int PlayCount

    How many sounds it has started since it was built.

  • public int InstanceCount

    How many of its plays are still sounding.

Methods (9)

Used by (18)

  • AudioEngineVixen.Audio
  • AudioEventAssetTestsVixen.Audio.Tests
  • AudioEventBuilderVixen.Audio
  • AudioEventLayerVixen.Audio
  • AudioEventRefVixen.Audio
  • AudioEventSystemTestsVixen.Audio.Tests
  • AudioEventTestsVixen.Audio.Tests
  • AudioScattererVixen.Audio
  • AudioSystemVixen.Audio
  • DeferredSpawnsVixen.Audio
  • IAudioEventLibraryVixen.Audio
  • LayeredEventTestsVixen.Audio.Tests
  • LibraryVixen.Audio.Tests
  • PendingVixen.Audio
  • ScattererTestsVixen.Audio.Tests
  • TypeRegistrationVixen.Audio
  • Vixen_Audio_Ecs_AudioEventRefSerializerVixen.Audio
  • VoiceParameterTestsVixen.Audio.Tests