Skip to content

fix(audio-openal): advance Attack/Sound/Decay portions on sample completion#134

Merged
fbraz3 merged 2 commits into
mainfrom
fix/aircraft-voice-lines
May 10, 2026
Merged

fix(audio-openal): advance Attack/Sound/Decay portions on sample completion#134
fbraz3 merged 2 commits into
mainfrom
fix/aircraft-voice-lines

Conversation

@fbraz3

@fbraz3 fbraz3 commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #129 — Aircraft (and all unit) voice lines were silent on Linux/macOS. Only the radio static (Attack portion) played; the actual voice (Sound portion) was never started.

Root Cause

The OpenAL backend's processPlayingList() polled sourceIsStopped() and simply discarded the PlayingAudio when a sample finished. The Miles Sound System used EOS (End-of-Sample) callbacks automatically for this; the OpenAL port lacked an equivalent trigger.

Without calling notifyOfAudioCompletion() when a sample ends, the multi-portion playback state machine (PP_Attack → PP_Sound → PP_Decay) never advanced:

  1. Attack portion (gradio1*.wav — radio static) plays
  2. Source stops → processPlayingList() releases the PlayingAudio object
  3. notifyOfAudioCompletion() never called → Sound portion (actual voice) never starts

Fix

In processPlayingList(), call notifyOfAudioCompletion() before releasing a stopped sample. If it successfully starts the next portion, the AL source transitions back to playing and the object remains in the list. Only release when the source is still stopped after the call (full cycle complete, or failed to load next file).

Applied to both m_playingSounds (2D) and m_playing3DSounds (3D positional) loops. The call is skipped when m_requestStop is set (user explicitly stopped the event).

Additional Fixes

  • Multichannel positional audio fallback (playSample3D): Stereo voice assets now fall back to 2D direct playback instead of being silently dropped or crashing.
  • OpenALAudioCache: Removed the hard crash on multichannel positional audio so the fallback path in playSample3D can handle it.

Testing

Manually verified on macOS (Apple Silicon, MoltenVK + DXVK path): selected multiple aircraft units (Comanche, King Raptor, Aurora Bomber, MiG) — radio static followed by voice lines now plays correctly for all factions.

fbraz3 added 2 commits May 10, 2026 15:19
…letion

The OpenAL backend polled sourceIsStopped() in processPlayingList() but
discarded PlayingAudio without calling notifyOfAudioCompletion(). Miles
Sound System used EOS callbacks for this, so the port lacked the
equivalent polling-based trigger.

Result: the Attack portion (radio static, gradio1*.wav) played once,
then the PlayingAudio was released before the Sound (voice) or Decay
portions could start. All aircraft and unit voice lines were silent on
Linux/macOS.

Fix: call notifyOfAudioCompletion() before releasing a stopped sample.
If it starts the next portion the AL source transitions back to playing
and the object remains in the list; only release when the source is
still stopped after the call (cycle complete or failed to load).

Apply the same fix to both m_playingSounds (2D) and m_playing3DSounds
(3D positional) loops. Skip the call when m_requestStop is set (user
explicitly stopped the event).

Also add a multichannel positional-audio fallback in playSample3D() and
OpenALAudioCache so that stereo voice assets fall back to 2D playback
instead of being dropped or crashing.

Fixes #129
@fbraz3 fbraz3 merged commit b71f493 into main May 10, 2026
12 checks passed
@fbraz3 fbraz3 deleted the fix/aircraft-voice-lines branch May 10, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Linux/macOS][Audio] Aircraft selection voice lines are not playing (static only)

1 participant