Skip to main content
Version: 2.x

Class OdinCustomEffectUnityComponentBase<U>

Custom base component for OdinNative.Wrapper.Media.CustomEffect

This convenient class provides effect template with a passthrough of custom userdata on a callback. The abstract representation of a base custom effect is to simplify implementation of OdinNative.Unity.Audio.IOdinEffect as a Unity component. (see other predefined custom effects)

Declaration
public abstract class OdinCustomEffectUnityComponentBase<U> : MonoBehaviour, IOdinEffect where U : unmanaged

Inheritance: System.Object -> UnityEngine.Object -> UnityEngine.Component -> UnityEngine.Behaviour -> UnityEngine.MonoBehaviour

Derived:
OdinNative.Unity.Audio.OdinColliderFilterComponent, OdinNative.Unity.Audio.OdinECLoopbackComponent, OdinNative.Unity.Audio.OdinMuteAudioComponent, OdinNative.Unity.Audio.OdinRmsComponent, OdinNative.Unity.Audio.OdinTerrainFilterComponent, OdinNative.Unity.Audio.OdinVolumeBoostComponent, OdinNative.Unity.Audio.OdinVolumeComponent

Implements:
OdinNative.Unity.Audio.IOdinEffect

Properties

Media

Get Media

Declaration
public virtual IMedia Media { get; set; }

Effect

Get base effect

Declaration
public PipelineEffect Effect { get; }

IsCreated

Flag if the effect was added to the pipeline

Declaration
public bool IsCreated { get; }

IsEnabled

Flag if the component is active or use isActiveAndEnabled

Declaration
public bool IsEnabled { get; }

Fields

UnityQueue

Declaration
protected readonly ConcurrentQueue<UnityAction> UnityQueue

DestroyOnError

Declaration
[Tooltip("Automatically destroy this component if an error occurred in the registered effect callback.")]
public bool DestroyOnError

_warn

Declaration
protected bool _warn

_corrupt

Declaration
protected bool _corrupt

Methods

OnEnable()

Declaration
protected virtual void OnEnable()

Reset()

Declaration
protected virtual void Reset()

Start()

Declaration
protected virtual void Start()

Update()

Declaration
protected virtual void Update()

OnDisable()

Declaration
protected virtual void OnDisable()

GetEffectUserData()

Get userdata used for the OdinNative.Unity.Audio.OdinCustomEffectUnityComponentBase

Declaration
public virtual U GetEffectUserData()
Returns

<U>: effect userdata

CustomEffectCallback(OdinTArray<float>, ref bool, U)

Callback delegate for the effect

Declaration
public virtual void CustomEffectCallback(NativeBindings.OdinTArray<float> audio, ref bool isSilent, U _)
Parameters
TypeNameDescription
OdinNative.Core.Imports.NativeBindings.OdinTArray<T>audioaudio data wrapper for copy buffer to native
System.BooleanisSilentflag whether the buffer contains silence, can be set to mute the frame
<U>_effect userdata, see OdinNative.Unity.Audio.OdinCustomEffectUnityComponentBase

ResetEffect()

Removes an effect from the pipeline and add a new effect with callbacks

Declaration
public virtual void ResetEffect()

ClearEffect()

Removes the effect from the pipeline it was created on, if that pipeline is still alive

Declaration
protected virtual void ClearEffect()

OnDestroy()

Declaration
protected virtual void OnDestroy()

GetMedia<T>()

Get Media

Declaration
public virtual T GetMedia<T>() where T : IMedia
Returns

<T>: Media

Type Parameters
  • T

GetEffect()

Get custom effect

Declaration
public virtual PipelineEffect GetEffect()
Returns

OdinNative.Wrapper.Media.PipelineEffect: custom effect

Implements