public override int GetHashCode() { return(NativeReference.GetHashCode()); }
protected bool Equals(LibVLC other) { return(NativeReference.Equals(other.NativeReference)); }
/// <summary> /// Retrieve the data pointer of this container without read/write access checks. /// </summary> /// <typeparam name="T">The type of the reference in the container.</typeparam> /// <param name="reference">The reference container.</param> /// <returns>The data pointer.</returns> public static unsafe void *GetUnsafePtrWithoutChecks <T>(NativeReference <T> reference) where T : unmanaged { return(reference.m_Data); }
protected bool Equals(Instance other) { return(NativeReference.Equals(other.NativeReference)); }
/// <summary> /// Job setup when directly converting data from another job /// </summary> /// <param name="position">position of the center of the local space transform position</param> /// <param name="forward">forward direction of the local space transform</param> /// <param name="worldSpacePosition">world space position to convert</param> public LocalSpaceConversion3D(float3 position, Quaternion forward, NativeReference <float3> worldSpacePosition) : this(position, forward) { SplinePosition = worldSpacePosition; }
private LocalSpaceConversion3D(float3 position, Quaternion forward) { TransformPosition = position; TransformRotation = forward; SplinePosition = default; }
public static JobHandle GetComponentASync <T>(this SystemBase system, JobHandle dependency, Allocator allocator, Entity e, out NativeReference <T> singleton) where T : unmanaged, IComponentData { singleton = new NativeReference <T>(allocator); return(new GetSingletonJob <T> { Entity = e, GetComponent = system.GetComponentDataFromEntity <T>(true), Singleton = singleton, }.Schedule(dependency)); }
public static JobHandle GetSingletonASync <T>(this SystemBase system, JobHandle dependency, Allocator allocator, out NativeReference <T> singleton) where T : unmanaged, IComponentData { return(GetComponentASync <T>(system, dependency, allocator, system.GetSingletonEntity <T>(), out singleton)); }
protected override void OnCreate() { //Initialize containers first m_mixNodePortFreelist = new NativeList <int>(Allocator.Persistent); m_mixNodePortCount = new NativeReference <int>(Allocator.Persistent); m_ildNodePortCount = new NativeReference <int>(Allocator.Persistent); m_packedFrameCounterBufferId = new NativeReference <long>(Allocator.Persistent); m_audioFrame = new NativeReference <int>(Allocator.Persistent); m_lastReadBufferId = new NativeReference <int>(Allocator.Persistent); m_buffersInFlight = new List <ManagedIldBuffer>(); worldBlackboardEntity.AddComponentDataIfMissing(new AudioSettings { audioFramesPerUpdate = 3, audioSubframesPerFrame = 1, logWarningIfBuffersAreStarved = false }); //Create graph and driver var format = ChannelEnumConverter.GetSoundFormatFromSpeakerMode(UnityEngine.AudioSettings.speakerMode); var channels = ChannelEnumConverter.GetChannelCountFromSoundFormat(format); UnityEngine.AudioSettings.GetDSPBufferSize(out m_samplesPerSubframe, out _); m_sampleRate = UnityEngine.AudioSettings.outputSampleRate; m_graph = DSPGraph.Create(format, channels, m_samplesPerSubframe, m_sampleRate); m_driver = new LatiosDSPGraphDriver { Graph = m_graph }; m_outputHandle = m_driver.AttachToDefaultOutput(); var commandBlock = m_graph.CreateCommandBlock(); m_mixNode = commandBlock.CreateDSPNode <MixStereoPortsNode.Parameters, MixStereoPortsNode.SampleProviders, MixStereoPortsNode>(); commandBlock.AddOutletPort(m_mixNode, 2); m_mixToOutputConnection = commandBlock.Connect(m_mixNode, 0, m_graph.RootDSP, 0); m_ildNode = commandBlock.CreateDSPNode <ReadIldBuffersNode.Parameters, ReadIldBuffersNode.SampleProviders, ReadIldBuffersNode>(); unsafe { commandBlock.UpdateAudioKernel <SetReadIldBuffersNodePackedFrameBufferId, ReadIldBuffersNode.Parameters, ReadIldBuffersNode.SampleProviders, ReadIldBuffersNode>( new SetReadIldBuffersNodePackedFrameBufferId { ptr = (long *)m_packedFrameCounterBufferId.GetUnsafePtr() }, m_ildNode); } commandBlock.Complete(); //Create queries m_aliveListenersQuery = Fluent.WithAll <AudioListener>(true).Build(); m_deadListenersQuery = Fluent.Without <AudioListener>().WithAll <ListenerGraphState>().Build(); m_oneshotsToDestroyWhenFinishedQuery = Fluent.WithAll <AudioSourceOneShot>().WithAll <AudioSourceDestroyOneShotWhenFinished>(true).Build(); m_oneshotsQuery = Fluent.WithAll <AudioSourceOneShot>().Build(); m_loopedQuery = Fluent.WithAll <AudioSourceLooped>().Build(); //Force initialization of Burst commandBlock = m_graph.CreateCommandBlock(); var dummyNode = commandBlock.CreateDSPNode <MixPortsToStereoNode.Parameters, MixPortsToStereoNode.SampleProviders, MixPortsToStereoNode>(); StateVariableFilterNode.Create(commandBlock, StateVariableFilterNode.FilterType.Bandpass, 0f, 0f, 0f, 1); commandBlock.UpdateAudioKernel <MixPortsToStereoNodeUpdate, MixPortsToStereoNode.Parameters, MixPortsToStereoNode.SampleProviders, MixPortsToStereoNode>( new MixPortsToStereoNodeUpdate { leftChannelCount = 0 }, dummyNode); commandBlock.UpdateAudioKernel <ReadIldBuffersNodeUpdate, ReadIldBuffersNode.Parameters, ReadIldBuffersNode.SampleProviders, ReadIldBuffersNode>(new ReadIldBuffersNodeUpdate { ildBuffer = new IldBuffer(), }, m_ildNode); commandBlock.Cancel(); }
/// <summary> /// Create an InstantiateCommandBuffer which can be used to instantiate entities and play them back later. /// </summary> /// <param name="allocator">The type of allocator to use for allocating the buffer</param> public InstantiateCommandBuffer(Allocator allocator) { m_entityOperationCommandBuffer = new EntityOperationCommandBuffer(allocator); m_playedBack = new NativeReference <bool>(allocator); }
public unsafe static JobHandle ScheduleSetCapacity <T>(ref NativeList <T> list, NativeReference <int> capacity, JobHandle dependency, Allocator allocator) where T : struct { if (!list.IsCreated) { list = new NativeList <T>(0, allocator); } var jobData = new ConstructListJob <T> { List = list.GetUnsafeList(), size = capacity }; return(jobData.Schedule(dependency)); }