// The opt-in keyed parameter layer: the escape hatch for code that has "which parameter" as a // runtime value (automation curves, inspectors, snapshot/restore). Importing Brutal.OpenAlApi.Params // adds the keyed Set/Get overloads as extension members on the handle types, with overload // resolution enforcing the right value shape per key enum. Setting a get-only key is a native // error. // // SourceParams/BufferParams/ListenerParams are generated; DeviceParams stays manual - an ALC // string-query one-off with no key-enum table to derive from. namespace Brutal.OpenAlApi.Params; /// /// Keyed ALC string and integer query access (alcGetString/alcGetIntegerv) as /// extension members on the raw device handles, for extension parameters not named by /// / (for example, /// ALC_HRTF_SPECIFIER_SOFT or ALC_CONNECTED, cast into the enums). Typical code /// uses the named properties on / and the /// enumeration statics instead. /// public static class DeviceParams { extension(AlcDevice device) { /// /// Gets a device-scoped ALC string (alcGetString) as a zero-copy UTF-8 view of /// library-owned memory. The view is valid only until the next ALC string query (an /// openal-soft lifetime guarantee) - copy the bytes out to keep them, or use /// Encoding.UTF8.GetString to materialize a managed string. An empty span is either a /// genuinely empty value or OpenAL's NULL absence sentinel. /// public ReadOnlySpan GetString(AlcGetString param) => Alc.GetStringUtf8(device, param); /// Gets a single device-scoped ALC integer (alcGetIntegerv). public int Get(AlcInteger param) => Alc.GetInteger(device, param); } extension(AlcCaptureDevice capture) { /// /// Gets a capture-device-scoped ALC string (alcGetString) as a zero-copy UTF-8 /// view of library-owned memory, with the same validity rules as the /// overload. /// public ReadOnlySpan GetString(AlcGetString param) => Alc.GetStringUtf8(capture, param); /// Gets a single capture-device-scoped ALC integer (alcGetIntegerv). public int Get(AlcInteger param) => Alc.GetInteger(capture, param); } }