CopyFrom() public method

Copies data from a float[] to a GATData instance.
public CopyFrom ( float sourceArray, int destinationIndex, int sourceIndex, int length ) : void
sourceArray float
destinationIndex int
sourceIndex int
length int
return void
コード例 #1
0
        public int GetData(GATData target, int targetLength, int offsetInTarget, bool reverse = false)
        {
            int nextIndex = ( int )_nextIndex;
            int sign      = reverse ? -1 : 1;
            int lastIndex = nextIndex + targetLength * sign;

            if (lastIndex >= _data.Count)
            {
                targetLength = _data.Count - nextIndex;
            }
            else if (lastIndex < 0)
            {
                targetLength = nextIndex + 1;
                lastIndex    = 0;
            }

            if (reverse == false)
            {
                target.CopyFrom(_data.ParentArray, offsetInTarget, nextIndex + _data.MemOffset, targetLength);
            }
            else
            {
                target.CopyFrom(_data.ParentArray, offsetInTarget, lastIndex + _data.MemOffset, targetLength);
                target.Reverse(offsetInTarget, targetLength);
            }

            _nextIndex = ( int )lastIndex;

            return(targetLength);
        }
コード例 #2
0
        bool IGATTrackContributor.MixToTrack(GATData trackMonoBuffer, int trackNb)
        {
            if (_streamBuffer == null || _streamDataEmpty)
            {
                return(false);
            }

            if (_exclusive)
            {
                trackMonoBuffer.CopyFrom(_streamBuffer, 0, _streamOffset, GATInfo.AudioBufferSizePerChannel);
            }
            else
            {
                trackMonoBuffer.MixFrom(_streamBuffer, 0, _streamOffset, GATInfo.AudioBufferSizePerChannel);
            }

            return(true);
        }
コード例 #3
0
        bool IGATTrackContributor.MixToTrack( GATData trackMonoBuffer, int trackNb )
        {
            if( _streamBuffer == null || _streamDataEmpty )
                return false;

            if( _exclusive )
            {
                trackMonoBuffer.CopyFrom( _streamBuffer, 0, _streamOffset, GATInfo.AudioBufferSizePerChannel );
            }
            else
            {
                trackMonoBuffer.MixFrom( _streamBuffer, 0, _streamOffset, GATInfo.AudioBufferSizePerChannel );
            }

            return true;
        }