mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 14:08:25 +01:00
first
This commit is contained in:
parent
bd62d51ec9
commit
b578433e37
1 changed files with 784842 additions and 0 deletions
14
Brutal.OpenAl/Manual/AlBuffer.cs
Normal file
14
Brutal.OpenAl/Manual/AlBuffer.cs
Normal 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 _);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue