GAudio.GATData.CopyTo C# (CSharp) Method

CopyTo() public method

Copies data from a GATData instance to another.
public CopyTo ( GATData destinationData, int destinationIndex, int sourceIndex, int length ) : void
destinationData GATData
destinationIndex int
sourceIndex int
length int
return void
        public void CopyTo( GATData destinationData, int destinationIndex, int sourceIndex, int length )
        {
            System.Array.Copy( _parentArray, sourceIndex + _offset, destinationData._parentArray, destinationIndex + destinationData._offset, length );
        }

Same methods

GATData::CopyTo ( float destinationArray, int destinationIndex, int sourceIndex, int length ) : void

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Called by GATPlayer.
        /// Needed when overriding default mixing:
        /// If a sample is routed through a track,
        /// it should be mixed to it.
        /// </summary>
        public void MixFrom(GATData data, int index, int offsetInBuffer, int length, float gain = 1f)
        {
            if (!_active)
            {
                return;
            }

            if (_bufferIsDirty)              //Contains old data
            {
                int lastIndex = offsetInBuffer + length;

                if (lastIndex < GATInfo.AudioBufferSizePerChannel || offsetInBuffer > 0)                  //if what we want to add to the buffer doesn't fill it, let's clear it first
                {
                    _trackBuffer.Clear();
                }

                if (gain == 1f)
                {
                    data.CopyTo(_trackBuffer, offsetInBuffer, index, length);                       // no need to mix on dirty or empty data, simply copy
                }
                else
                {
                    data.CopyGainTo(_trackBuffer, index, offsetInBuffer, length, gain);
                }

                _bufferIsDirty = false;
            }
            else
            {
                if (gain == 1f)
                {
                    data.MixTo(_trackBuffer, offsetInBuffer, index, length);
                }
                else
                {
                    data.GainMixTo(_trackBuffer, index, offsetInBuffer, length, gain);
                }
            }

            NbOfMixedSamples++;
            _hasData = true;
        }
All Usage Examples Of GAudio.GATData::CopyTo