Interface IAudioKernel<TParameters, TProviders>
The interface for creating an audio kernel ("DSP node") for use in the DSPGraph. An audio kernel has access to audio inputs and outputs (DSPCommandBlock for configuration), and can alter the audio stream. The kernel must be a struct whose memory will be persistent and managed by the DSPGraph.
Namespace: Unity.Audio
Syntax
[JobProducerType(typeof(AudioKernelExtensions.AudioKernelJobStructProduce<,, >))]
public interface IAudioKernel<TParameters, TProviders>
where TParameters : struct, Enum where TProviders : struct, Enum
Type Parameters
Name | Description |
---|---|
TParameters | An enum describing the interpolated parameters available for this audio kernel. Use these to create smooth transitions and variations in your DSP code. Each enum value will create a parameter internally, and act as an identifier in other methods. ParameterData<TParameter> |
TProviders | An enum describing the available sample providers for this audio kernel. Use these to provide sample playback in a DSP node. Each enum value will create a sample provider [array] internally, and act as an identifier in other methods. SampleProvider |
Methods
Dispose()
This function is called just before a job is destroyed.
Declaration
void Dispose()
Execute(ref ExecuteContext<TParameters, TProviders>)
This function is called during a mix - BeginMix(Int32, DSPGraph.ExecutionMode), in a potentially multi threaded context. Inside this function you can process the audio inputs given to you, and write to the outputs. ExecuteContext<TParameters, TProviders>
Declaration
void Execute(ref ExecuteContext<TParameters, TProviders> context)
Parameters
Type | Name | Description |
---|---|---|
ExecuteContext<TParameters, TProviders> | context | The context will give access to these buffers, in addition to the sample providers and parameters that have been registered for this audio job. |
Initialize()
This function is called initially before processing is started. It can be used as a constructor.
Declaration
void Initialize()