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

55 lines
1.9 KiB
C#

// <auto-generated/>
// Generated by Brutal.OpenAl.Generate; do not edit by hand.
#nullable enable
namespace Brutal.OpenAlApi
{
/// <summary>
/// An OpenAL source (an <c>ALuint</c> object name).
/// </summary>
/// <remarks>
/// <para>
/// Created by <see cref="Al.GenSources"/> and released by <see cref="Delete"/> (or <see cref="Al.DeleteSources"/> in bulk). This is a plain name, not a resource handle: copies refer to the same source; 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 AlSource : 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 AlSource(uint name) => Name = name;
/// <summary>
/// The null source (name <c>0</c>). OpenAL never assigns it to a real source.
/// </summary>
public static AlSource Null
{
get => default;
}
/// <summary>
/// Returns <see langword="true"/> if this is the null source.
/// </summary>
public bool IsNull() => Name == 0;
/// <summary>
/// Deletes the source (<c>alDeleteSources</c>).
/// </summary>
public void Delete()
{
var name = Name;
Al.PInvoke.DeleteSources(1, &name);
}
/// <summary>
/// Returns <see langword="true"/> if the name is a live source (<c>alIsSource</c>).
/// </summary>
public bool IsValid() => Al.PInvoke.IsSource(Name);
}
}