상속: GATChannelGain
예제 #1
0
        /// <summary>
        /// Sets gain for specified channel.
        /// If the gain delta is too large,
        /// gain will be smoothed over the
        /// length of the audio buffer to
        /// prevent crackling.
        /// Does nothing if the specified channel does not exist.
        /// </summary>
        public void SetGainForChannel(float gain, int channel)
        {
            if (channel >= _indexedChannelGains.Length)
            {
                return;
            }
            GATDynamicChannelGain channelGain = _indexedChannelGains[channel];

            if (channelGain == null)
            {
                _indexedChannelGains[channel] = new GATDynamicChannelGain(channel, gain);
                channelGains.Add(_indexedChannelGains[channel]);
            }
            else
            {
                channelGain.NextGain = gain;
            }

            _needsUpdate = true;
        }
예제 #2
0
        /// <summary>
        /// Copy and interpolated gain to an interleaved float[]
        /// </summary>
        public void SmoothedGainCopyToInterlaced(float[] destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain)
        {
            float gain;
            float interpolationDelta;

            gain = channelGain.PrevGain;
            interpolationDelta = channelGain.InterpolationDelta;

            sourceIndex        = sourceIndex + _offset;
            length             = sourceIndex + length;
            destinationOffset += channelGain.ChannelNumber;

            while (sourceIndex < length)
            {
                destinationArray[destinationOffset] = _parentArray[sourceIndex] * gain;
                destinationOffset += GATInfo.NbOfChannels;
                gain += interpolationDelta;
                sourceIndex++;
            }
        }
예제 #3
0
파일: GATData.cs 프로젝트: gregzo/G-Audio
        /// <summary>
        /// Additive copy and interpolated gain to an interleaved float[] with extra gain parameter
        /// </summary>
        public void SmoothedGainMixToInterlaced( float[] destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain, float igain )
        {
            float gain;
            float interpolationDelta;

            gain = channelGain.PrevGain;
            interpolationDelta = channelGain.InterpolationDelta;

            sourceIndex = sourceIndex + _offset;
            length 		= sourceIndex + length;
            destinationOffset += channelGain.ChannelNumber;

            while( sourceIndex < length )
            {
                destinationArray[ destinationOffset ] += _parentArray[sourceIndex] * gain * igain;
                destinationOffset += GATInfo.NbOfChannels;
                gain += interpolationDelta;
                sourceIndex++;
            }
        }