Skip to content

AudioEvent ​

Struct

Source: AudioTypes.h

Description ​

A fire-and-forget sound event triggered by the game.

Properties ​

NameTypeDescription
presetconst struct InstrumentPreset*Optional preset driving ADSR and LFO parameters. MUST be a pointer to a static, constexpr, or global instance. If nullptr, falls back to legacy default behavior.
sweepEndHzfloatOptional frequency/period sweep (PULSE / TRIANGLE / SINE / SAW / NOISE). Active iff sweepDurationSec > 0 and sweepEndHz > 0. Melodic: starts at frequency, ends at sweepEndHz. NOISE: interpolates LFSR clock Hz (and thus noisePeriodSamples). Curve: Linear (default) or Exponential (geometric in Hz); falls back to Linear if start/end Hz are not both > 0. Duration clamped to note length for one-shots; full sweepDurationSec when loop. API decision: ADR-A1 in docs/architecture/AUDIO_ROADMAP_SHORT_MEDIUM.md §A.7.
loopboolContinuous playback: voice stays enabled until STOP_CHANNEL (or steal). When false, duration <= 0 MUST NOT leave a hanging voice (disabled immediately).
sweepCurveSweepCurveSweep interpolation; additive at end of struct for brace-init safety (0 = Linear).
dutyStepsconst SfxBreakpoint*Optional duty stepped table (PULSE). Active when dutySteps != nullptr and dutyStepCount > 0 (clamped to kMaxSfxDutySteps). Hold between points; ignores InstrumentPreset::dutySweep while active.
pitchEnvelopeconst SfxBreakpoint*Optional multi-breakpoint pitch envelope. Active when count >= 2 (clamped to kMaxSfxPitchPoints); then replaces single-segment sweep.

Released under the MIT License.