GAudio.GATDataAllocator.GetFixedDataContainer C# (CSharp) Method

GetFixedDataContainer() public method

Allocates a fixed chunk of memory. Fixed chunks cannot be freed, but may be of any size. For debugging ease, a description is required when requesting a fixed chunk.
public GetFixedDataContainer ( int size, string description ) : GATData
size int
description string
return GATData
        public GATData GetFixedDataContainer( int size, string description )
        {
            if( _unallocatedCursor.MaxSize < size )
            {
                throw new GATException( "Out of fixed memory!" );
            }

            int offset;
            GATFixedData ret;

            offset = _endCursor.MemOffset - size;
            ret = new GATFixedData( this, description );
            ret.AllocateFree( offset, _endCursor.next );
            ret.allocatedSize = size;
            _endCursor.AllocateFree( offset, ret );

            _fixedAllocationsSize += size;
            return ret;
        }

Usage Example

コード例 #1
0
ファイル: GATManager.cs プロジェクト: r618/G-Audio
        /// <summary>
        /// Convenience method to request a chunk of fixed virtual memory from the default
        /// GATDataAllocator instance.
        /// </summary>
        public static GATData GetFixedDataContainer(int length, string description)
        {
#if UNITY_EDITOR
            if (Application.isPlaying == false)
            {
                return(new GATData(new float[length]));
            }
#endif
            return(__allocator.GetFixedDataContainer(length, description));
        }