Exemplo n.º 1
0
        /// <summary>
        /// Attach an output job to Unity's default audio output
        /// </summary>
        /// <param name="outputJob">An output job</param>
        /// <typeparam name="T">A type implementing <typeparamref name="IAudioOutput"/></typeparam>
        /// <returns>An <typeparamref name="AudioOutputHandle"/> representing the created audio job</returns>
        public static unsafe AudioOutputHandle AttachToDefaultOutput <T>(this T outputJob) where T : struct, IAudioOutput
        {
            var output            = new AudioOutputHandle();
            var jobReflectionData = (void *)AudioOutputHookStructProduce <T> .Initialize();

            var structMemory = AudioMemoryManager.Internal_AllocateAudioMemory(UnsafeUtility.SizeOf <T>(), UnsafeUtility.AlignOf <T>());

            UnsafeUtility.CopyStructureToPtr(ref outputJob, structMemory);

            AudioOutputHookManager.Internal_CreateAudioOutputHook(out output.Handle, jobReflectionData, structMemory);

            return(output);
        }
Exemplo n.º 2
0
 public static void DisposeOutputHook(ref AudioOutputHandle handle)
 {
     AudioOutputHookManager.Internal_DisposeAudioOutputHook(ref handle.Handle);
 }