Assets/Plugins/Unity.DSPGraph/Runtime/DSPCommandBlock.cs
/// <summary>
/// Method to create a new <typeparamref name="DSPNode"/> in the graph
/// </summary>
/// <remarks>
/// A kernel of type <typeparamref name="TAudioKernel"/> is created inside the graph.
/// A handle in the form of <typeparamref name="DSPNode"/> is returned
/// for controlling the kernel.
/// The created kernel will be bursted if its implementation is decorated with BurstCompileAttribute
/// </remarks>
/// <typeparam name="TParameters">Enum defining the parameters of the node</typeparam>
/// <typeparam name="TProviders">Enum defining the sample providers of the node</typeparam>
/// <typeparam name="TAudioKernel">IAudioKernel which is the DSP kernel of the node</typeparam>
/// <returns>A DSPNode handle </returns>
Method to create a new  in the graph
Method to create a new in the graph
public DSPNode CreateDSPNode<TParameters, TProviders, TAudioKernel>()
            where TParameters  : unmanaged, Enum
            where TProviders   : unmanaged, Enum
            where TAudioKernel : struct, IAudioKernel<TParameters, TProviders>
        {
            AudioKernelExtensions.GetReflectionData<TAudioKernel, TParameters, TProviders>(out void* jobReflectionData, out AudioKernelExtensions.ParameterDescriptionData parameterDescriptionData, out AudioKernelExtensions.SampleProviderDescriptionData sampleProviderDescriptionData);
            var kernel = new TAudioKernel();
            var node = new DSPNode
            {
                Graph = m_Graph.Handle,
                Handle = m_Graph.AllocateHandle(),
            };
            QueueCommand(new CreateDSPNodeCommand
            {
                m_Type = DSPCommandType.CreateDSPNode,
                m_Graph = m_Graph,
                m_Handle = m_Handle,
                m_JobReflectionData = jobReflectionData,
                m_ParameterDescriptionData = parameterDescriptionData,
                m_SampleProviderDescriptionData = sampleProviderDescriptionData,
                m_JobStructMemory = Utility.CopyToPersistentAllocation(ref kernel),
                m_KernelAlignment = UnsafeUtility.AlignOf<TAudioKernel>(),
                m_KernelSize = UnsafeUtility.SizeOf<TAudioKernel>(),
                m_NodeHandle = node.Handle,
            });
            return node;
        }
public DSPNode CreateDSPNode < TParameters , TProviders , TAudioKernel > ( ) where TParameters : unmanaged , Enum where TProviders : unmanaged , Enum where TAudioKernel : struct , IAudioKernel < TParameters , TProviders > { AudioKernelExtensions . GetReflectionData < TAudioKernel , TParameters , TProviders > ( out void * jobReflectionData , out AudioKernelExtensions . ParameterDescriptionData parameterDescriptionData , out AudioKernelExtensions . SampleProviderDescriptionData sampleProviderDescriptionData ) ; var kernel = new TAudioKernel ( ) ; var node = new DSPNode { Graph = m_Graph . Handle , Handle = m_Graph . AllocateHandle ( ) , } ; QueueCommand ( new CreateDSPNodeCommand { m_Type = DSPCommandType . CreateDSPNode , m_Graph = m_Graph , m_Handle = m_Handle , m_JobReflectionData = jobReflectionData , m_ParameterDescriptionData = parameterDescriptionData , m_SampleProviderDescriptionData = sampleProviderDescriptionData , m_JobStructMemory = Utility . CopyToPersistentAllocation ( ref kernel ) , m_KernelAlignment = UnsafeUtility . AlignOf < TAudioKernel > ( ) , m_KernelSize = UnsafeUtility . SizeOf < TAudioKernel > ( ) , m_NodeHandle = node . Handle , } ) ; return node ; }
Method to create a new  in the graph
Method to create a new in the graph
A DSPNode handle
A DSPNode handle
remarks
A kernel of type  is created inside the graph.
A handle in the form of  is returned
for controlling the kernel.
The created kernel will be bursted if its implementation is decorated with BurstCompileAttribute
A kernel of type is created inside the graph . A handle in the form of is returned for controlling the kernel . The created kernel will be bursted if its implementation is decorated with BurstCompileAttribute
typeparam
Enum defining the parameters of the node
Enum defining the parameters of the node
typeparam
Enum defining the sample providers of the node
Enum defining the sample providers of the node
typeparam
IAudioKernel which is the DSP kernel of the node
IAudioKernel which is the DSP kernel of the node