mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 12:38:24 +01:00
72 lines
2.4 KiB
C#
72 lines
2.4 KiB
C#
namespace Brutal.OpenAlApi;
|
|
|
|
public static unsafe partial class Al
|
|
{
|
|
// The EAX reverb pan vectors are the only fv-shaped EFX parameters, so the fv entry points
|
|
// surface as float3 helpers (no filter has an fv key).
|
|
|
|
internal static float3 GetEffectfv3(uint name, int param)
|
|
{
|
|
var v = stackalloc float[3];
|
|
PInvoke.GetEffectfv(name, param, v);
|
|
return new float3(v[0], v[1], v[2]);
|
|
}
|
|
|
|
internal static void SetEffectfv3(uint name, int param, float3 value)
|
|
{
|
|
var v = stackalloc float[3] { value.X, value.Y, value.Z };
|
|
PInvoke.Effectfv(name, param, v);
|
|
}
|
|
|
|
// Two-element vector forms for the extension pair parameters. The core fv/iv entry points fill
|
|
// caller memory; float2/int2 are sequential two-field structs, so their address is the buffer.
|
|
internal static float2 GetSourcefv2(uint name, int param)
|
|
{
|
|
var value = default(float2);
|
|
PInvoke.GetSourcefv(name, param, (float*)&value);
|
|
return value;
|
|
}
|
|
|
|
internal static void SetSourcefv2(uint name, int param, float2 value) =>
|
|
PInvoke.Sourcefv(name, param, (float*)&value);
|
|
|
|
internal static int2 GetBufferiv2(uint name, int param)
|
|
{
|
|
var value = default(int2);
|
|
PInvoke.GetBufferiv(name, param, (int*)&value);
|
|
return value;
|
|
}
|
|
|
|
internal static void SetBufferiv2(uint name, int param, int2 value) => PInvoke.Bufferiv(name, param, (int*)&value);
|
|
|
|
// Extension double/int64 scalar and pair getters (AL_SOFT_source_latency / ALC_SOFT_device_clock
|
|
// source halves), over the fnptr-dispatched raw layer.
|
|
internal static double GetSourcedSOFT(uint name, int param)
|
|
{
|
|
var value = 0.0;
|
|
PInvoke.GetSourcedSOFT(name, param, &value);
|
|
return value;
|
|
}
|
|
|
|
internal static long GetSourcei64SOFT(uint name, int param)
|
|
{
|
|
var value = 0L;
|
|
PInvoke.GetSourcei64SOFT(name, param, &value);
|
|
return value;
|
|
}
|
|
|
|
// Tuples, not double2/long2: the two slots hold different quantities.
|
|
internal static (double A, double B) GetSourcedv2SOFT(uint name, int param)
|
|
{
|
|
var pair = stackalloc double[2];
|
|
PInvoke.GetSourcedvSOFT(name, param, pair);
|
|
return (pair[0], pair[1]);
|
|
}
|
|
|
|
internal static (long A, long B) GetSourcei64v2SOFT(uint name, int param)
|
|
{
|
|
var pair = stackalloc long[2];
|
|
PInvoke.GetSourcei64vSOFT(name, param, pair);
|
|
return (pair[0], pair[1]);
|
|
}
|
|
}
|