コード例 #1
0
        public void FreeNative(EntityManager man, Entity e, ref AudioNativeClip audioNativeClip)
        {
            if (!man.HasComponent <AudioClipUsage>(e))
            {
                return;
            }
            AudioClipUsage audioClipUsage = man.GetComponentData <AudioClipUsage>(e);
            bool           clipIsPlaying  = audioClipUsage.playingRefCount > 0;

            if (clipIsPlaying)
            {
                AudioNativeCalls.SoundSourcePropertyMutexLock();
                AudioNativeCalls.SoundSourceSampleMutexLock();
            }

            AudioNativeCalls.FreeAudio(audioNativeClip.clipID);
            DynamicBuffer <AudioClipCompressed> audioClipCompressed = man.GetBuffer <AudioClipCompressed>(e);

            audioClipCompressed.ResizeUninitialized(0);

            if (clipIsPlaying)
            {
                AudioNativeCalls.SoundSourcePropertyMutexUnlock();
                AudioNativeCalls.SoundSourceSampleMutexUnlock();
            }
        }