// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
namespace UnityEngine.XR.MagicLeap
{
using System;
using System.Runtime.InteropServices;
using UnityEngine.XR.MagicLeap.Native;
///
/// Manages Audio.
///
public sealed partial class MLAudioOutput
{
///
/// Structs and functions releated to spatial audio.
///
public sealed partial class SpatialSound
{
///
/// Properties specifying send levels for a spatial sound.
///
[Serializable]
public sealed class SendLevels
{
///
/// Volume scale (0-1) for all freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float Gain;
///
/// Volume scale (0-1) for low freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float GainLF;
///
/// Volume scale (0-1) for mid freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float GainMF;
///
/// Volume scale (0-1) for high freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float GainHF;
public override string ToString()
{
return $"Gain: {Gain}, GainLF: {GainLF}, GainMF: {GainMF}, GainHF: {GainHF}";
}
}
///
/// Properties specifying the distance response of a spatial sound.
///
[Serializable]
public sealed class DistanceProperties
{
///
/// Distance where sound is at full volume.
///
[SerializeField]
public float MinDistance;
///
/// Distance beyond which sound gets no quieter.
///
[SerializeField]
public float MaxDistance;
///
/// Modification to real-world distance response.
///
[SerializeField]
public float RolloffFactor;
public override string ToString()
{
return $"MinDistance: {MinDistance}, MaxDistance: {MaxDistance}, RolloffFactor: {RolloffFactor}";
}
}
///
/// Properties specifying the directivity of a spatial sound.
///
[Serializable]
public sealed class RadiationProperties
{
///
/// Inner cone angle (0-360); radiation unaffected.
///
[SerializeField]
[Range(0.0f, 360.0f)]
public float InnerAngle;
///
/// Outer cone angle (0-360); directivity at maximum.
///
[SerializeField]
[Range(0.0f, 360.0f)]
public float OuterAngle;
///
/// Volume scale (0-1) beyond outer cone for all freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float OuterGain;
///
/// Volume scale (0-1) beyond outer cone for low freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float OuterGainLF;
///
/// Volume scale (0-1) beyond outer cone for mid freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float OuterGainMF;
///
/// Volume scale (0-1) beyond outer cone for high freqs.
///
[SerializeField]
[Range(0.0f, 1.0f)]
public float OuterGainHF;
public override string ToString()
{
return $"InnerAngle: {InnerAngle}, OuterAngle: {OuterAngle}, OuterGain: {OuterGain}, OuterGainLF: {OuterGainLF}, OuterGainMF: {OuterGainMF}, OuterGainHF: {OuterGainHF}";
}
}
}
}
}