ReleaseCache() public method

Releases the cache objects.
public ReleaseCache ( ) : void
return void
コード例 #1
0
        /// <summary>
        /// Allocates caches retrievable in the Caches property.
        /// </summary>
        public void AllocateCaches(double duration, bool managedData)
        {
            if (!_isInited)
            {
                Start();
            }

            if (_streamToCache != null && Caches != null)
            {
                _streamToCache.ReleaseCache();
            }

            cacheDuration = duration;

            _cacheNumFrames = ( int )(cacheDuration * GATInfo.OutputSampleRate);

            useManagedData = managedData;

            GATData[] caches = new GATData[_stream.NbOfChannels];

            int i;

            for (i = 0; i < caches.Length; i++)
            {
                if (useManagedData)
                {
                    if (_cacheNumFrames > GATManager.DefaultDataAllocator.LargestFreeChunkSize)
                    {
                        int j;
                        for (j = 0; j < i; j++)
                        {
                            caches[i].Release();
                        }
                        throw new GATException("Chunk is too large to be allocated in managed memory, consider using unmanaged setting");
                    }

                    caches[i] = GATManager.GetDataContainer(_cacheNumFrames);
                }
                else
                {
                    caches[i] = new GATData(new float[_cacheNumFrames]);
                }
            }

            _streamToCache.Loop   = _loopedCaching;
            _streamToCache.Caches = caches;
        }