This commit is contained in:
Rian Drake 2026-10-15 14:09:11 +13:00
commit b578433e37

View file

@ -0,0 +1,14 @@
namespace Brutal.OpenAlApi;
public readonly unsafe partial struct AlBuffer
{
public void SetData(AlFormat format, ReadOnlySpan<byte> data, int sampleRate)
{
// A successful upload clears any callback; evict its root only once the cookie is gone.
var previous = PeekCookie(Name);
fixed (byte* p = data)
Al.PInvoke.BufferData(Name, (int)format, p, data.Length, sampleRate);
if (previous != 0 && BoundCookie(Name) == 0)
BufferCallbacks.TryRemove(previous, out _);
}
}