fix(audio): keep unavailable world slots quiescent

Construct the retail-sized world voice ledger independently of OpenAL device availability so world reveal suspension is a safe no-op on machines without an audio backend.

Co-authored-by: Erik Nilsson <erikn@users.noreply.github.com>
This commit is contained in:
Erik 2026-07-24 19:49:25 +02:00
parent 3f1548b952
commit a77ba06722
2 changed files with 25 additions and 2 deletions

View file

@ -82,7 +82,7 @@ public sealed unsafe class OpenAlAudioEngine : IAudioEngine, IWorldAudioQuiescen
public bool InUse;
public uint PriorityBase; // raw priority from SoundEntry.Priority
}
private readonly Slot3D[] _pool3D = new Slot3D[PoolSize3D];
private readonly Slot3D[] _pool3D = CreateWorldSlots();
private int _pool3DCursor; // round-robin start
private bool _worldAudioSuspended;
@ -159,7 +159,7 @@ public sealed unsafe class OpenAlAudioEngine : IAudioEngine, IWorldAudioQuiescen
for (int i = 0; i < PoolSize3D; i++)
{
uint src = _resources.Create3DSource();
_pool3D[i] = new Slot3D { SourceId = src, InUse = false };
_pool3D[i].SourceId = src;
}
// UI sources are source-relative (attached to listener) so they
@ -520,4 +520,12 @@ public sealed unsafe class OpenAlAudioEngine : IAudioEngine, IWorldAudioQuiescen
slot.PriorityBase = 0;
slot.InUse = false;
}
private static Slot3D[] CreateWorldSlots()
{
var slots = new Slot3D[PoolSize3D];
for (int i = 0; i < slots.Length; i++)
slots[i] = new Slot3D();
return slots;
}
}