Exemple #1
0
        public void Destroy()
        {
#if !UNITY_ANDROID
            PhononCore.iplDestroyConvolutionEffect(ref propagationAmbisonicsEffect);
            propagationAmbisonicsEffect = IntPtr.Zero;

            PhononCore.iplDestroyAmbisonicsBinauralEffect(ref propagationBinauralEffect);
            propagationBinauralEffect = IntPtr.Zero;

            PhononCore.iplDestroyAmbisonicsPanningEffect(ref propagationPanningEffect);
            propagationPanningEffect = IntPtr.Zero;

            wetData = null;

            if (wetDataMarshal != null)
            {
                for (int i = 0; i < outputFormat.numSpeakers; ++i)
                {
                    Marshal.FreeCoTaskMem(wetDataMarshal[i]);
                }
            }
            wetDataMarshal = null;

            if (wetAmbisonicsDataMarshal != null)
            {
                for (int i = 0; i < ambisonicsFormat.numSpeakers; ++i)
                {
                    Marshal.FreeCoTaskMem(wetAmbisonicsDataMarshal[i]);
                }
            }
            wetAmbisonicsDataMarshal = null;
#endif
        }
Exemple #2
0
        //
        // Destroys the effect.
        //
        void OnDestroy()
        {
            mutex.WaitOne();
            destroying  = true;
            errorLogged = false;

            if (audioEngine == AudioEngine.Unity)
            {
                directAttnInterlop.Reset();

#if !UNITY_ANDROID
                PhononCore.iplDestroyConvolutionEffect(ref propagationAmbisonicsEffect);
                propagationAmbisonicsEffect = IntPtr.Zero;

                PhononCore.iplDestroyAmbisonicsBinauralEffect(ref propagationBinauralEffect);
                propagationBinauralEffect = IntPtr.Zero;

                PhononCore.iplDestroyAmbisonicsPanningEffect(ref propagationPanningEffect);
                propagationPanningEffect = IntPtr.Zero;
#endif

                PhononCore.iplDestroyBinauralEffect(ref directBinauralEffect);
                directBinauralEffect = IntPtr.Zero;

                PhononCore.iplDestroyPanningEffect(ref directCustomPanningEffect);
                directCustomPanningEffect = IntPtr.Zero;

                wetData = null;

                if (wetDataMarshal != null)
                {
                    for (int i = 0; i < outputFormat.numSpeakers; ++i)
                    {
                        Marshal.FreeCoTaskMem(wetDataMarshal[i]);
                    }
                }
                wetDataMarshal = null;

                if (wetAmbisonicsDataMarshal != null)
                {
                    for (int i = 0; i < ambisonicsFormat.numSpeakers; ++i)
                    {
                        Marshal.FreeCoTaskMem(wetAmbisonicsDataMarshal[i]);
                    }
                }
                wetAmbisonicsDataMarshal = null;
            }

            mutex.ReleaseMutex();
        }
Exemple #3
0
        //
        // Destroys the listener
        //
        void OnDestroy()
        {
            mutex.WaitOne();
            destroying = true;

            if (audioEngine == AudioEngine.Unity)
            {
                if (environmentRenderer != IntPtr.Zero)
                {
                    PhononCore.iplDestroyEnvironmentalRenderer(ref environmentRenderer);
                }

#if !UNITY_ANDROID
                PhononCore.iplDestroyAmbisonicsBinauralEffect(ref propagationBinauralEffect);
                PhononCore.iplDestroyAmbisonicsPanningEffect(ref propagationPanningEffect);
#endif

                PhononCore.iplDestroyBinauralEffect(ref binauralRenderer);

                environmentRenderer = IntPtr.Zero;

                propagationBinauralEffect = IntPtr.Zero;
                binauralRenderer          = IntPtr.Zero;

                wetData = null;

                for (int i = 0; i < outputFormat.numSpeakers; ++i)
                {
                    Marshal.FreeCoTaskMem(wetDataMarshal[i]);
                }
                wetDataMarshal = null;

                for (int i = 0; i < ambisonicsFormat.numSpeakers; ++i)
                {
                    Marshal.FreeCoTaskMem(wetAmbisonicsDataMarshal[i]);
                }
                wetAmbisonicsDataMarshal = null;
            }

            mutex.ReleaseMutex();
        }