//
// Generated by Brutal.OpenAl.Generate; do not edit by hand.
#nullable enable
using static Brutal.OpenAlApi.Al.Constants;
namespace Brutal.OpenAlApi
{
///
/// The typed parameter surface of an AL_EFFECT_COMPRESSOR effect (see ); requires ALC_EXT_EFX.
///
public unsafe readonly partial struct CompressorEffect
{
///
/// The underlying effect handle.
///
public readonly AlEffect Effect;
///
/// Wraps an effect handle without validating its type; prefer the checked conversion.
///
public CompressorEffect(AlEffect effect) => Effect = effect;
///
/// The wrapper converts freely to its underlying handle.
///
public static implicit operator AlEffect(CompressorEffect effect) => effect.Effect;
///
/// Converts a raw handle to the typed wrapper, checking .
///
///
/// The effect's type is not .
public static explicit operator CompressorEffect(AlEffect effect) =>
effect.Type == AlEffectType.Compressor
? new CompressorEffect(effect)
: throw new InvalidCastException($"Effect {effect.Name} has type {effect.Type}, not Compressor.");
///
/// Deletes the underlying effect ().
///
public void Delete() => Effect.Delete();
///
/// Gets/sets AL_COMPRESSOR_ONOFF.
///
///
///
/// range 0 to 1; default 1.
///
///
public bool Enabled
{
get => Al.GetEffecti(Effect.Name, AL_COMPRESSOR_ONOFF) != AL_FALSE;
set => Al.PInvoke.Effecti(Effect.Name, AL_COMPRESSOR_ONOFF, value ? AL_TRUE : AL_FALSE);
}
}
}