brutal/Brutal.OpenAl/Generated/Al/AlBuffer.ObjectName.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

55 lines
2.1 KiB
C#

// <auto-generated/>
// Generated by Brutal.OpenAl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.OpenAlApi
{
/// <summary>
/// An OpenAL buffer (an <c>ALuint</c> object name).
/// </summary>
/// <remarks>
/// <para>
/// Created by <see cref="Al.GenBuffers"/> and released by <see cref="Delete"/> (or <see cref="Al.DeleteBuffers"/> in bulk). This is a plain name, not a resource handle: copies refer to the same buffer; delete it exactly once. Operating on a null or deleted name sets <see cref="AlError.InvalidName"/> (see <see cref="Al.ThrowIfError"/>). For parameter access keyed by enum, import the opt-in <c>Brutal.OpenAlApi.Params</c> namespace.
/// </para>
/// </remarks>
public unsafe readonly partial struct AlBuffer : INullable
{
/// <summary>
/// The raw OpenAL object name.
/// </summary>
public readonly uint Name;
/// <summary>
/// Wraps an existing object name without validating it.
/// </summary>
/// <param name="name">The raw OpenAL object name.</param>
public AlBuffer(uint name) => Name = name;
/// <summary>
/// The null buffer (name <c>0</c>). OpenAL never assigns it to a real buffer.
/// </summary>
public static AlBuffer Null
{
get => default;
}
/// <summary>
/// Returns <see langword="true"/> if this is the null buffer.
/// </summary>
public bool IsNull() => Name == 0;
/// <summary>
/// Deletes the buffer (<c>alDeleteBuffers</c>). It must not be in use by a source. A successful delete releases any callback handler registered via <see cref="SetCallback"/>.
/// </summary>
public void Delete()
{
var name = Name;
DeleteAndEvictCallbackRoots(&name, 1);
}
/// <summary>
/// Returns <see langword="true"/> if the name is a live buffer (<c>alIsBuffer</c>).
/// </summary>
public bool IsValid() => Al.PInvoke.IsBuffer(Name);
}
}