SmoothedGainMixToInterlaced() public method

Additive copy and interpolated gain to an interleaved float[]
public SmoothedGainMixToInterlaced ( float destinationArray, int destinationOffset, int sourceIndex, int length, GATDynamicChannelGain channelGain ) : void
destinationArray float
destinationOffset int
sourceIndex int
length int
channelGain GATDynamicChannelGain
return void
Esempio n. 1
0
        // Called by GATPlayer.
        // Applies effects, and pan-mixes
        // to the audio buffer.
        public bool FXAndMixTo(float[] audioBuffer)
        {
            if (!_active)
            {
                return(false);
            }

            int  i;
            bool isEmptyData = false;

            if (_hasData == false)              //no sample overwrote the buffer, let's clear it
            {
                if (_bufferIsDirty)
                {
                    _trackBuffer.Clear();
                    _bufferIsDirty = false;
                }

                isEmptyData = true;
            }

            if (_contributor != null)
            {
                isEmptyData = !(_contributor.MixToTrack(_trackBuffer, _trackNb));
            }

            if (_filtersHandler.HasFilters)
            {
                if (_filtersHandler.ApplyFilters(_trackBuffer.ParentArray, _trackBuffer.MemOffset, GATInfo.AudioBufferSizePerChannel, isEmptyData))
                {
                    isEmptyData = false;
                }
            }

            if (isEmptyData)
            {
                _audioThreadStreamProxy.BroadcastStream(_trackBuffer.ParentArray, _trackBuffer.MemOffset, isEmptyData);
                return(false);
            }

            if (_shouldToggleMute)
            {
                if (_nextMute)
                {
                    _trackBuffer.FadeOut(GATInfo.AudioBufferSizePerChannel);
                }
                else
                {
                    _trackBuffer.FadeIn(GATInfo.AudioBufferSizePerChannel);
                    _mute = false;
                }

                _shouldToggleMute = false;
            }

            _bufferIsDirty = true;

            _audioThreadStreamProxy.BroadcastStream(_trackBuffer.ParentArray, _trackBuffer.MemOffset, false);

            if (_mute)
            {
                return(false);
            }

            GATDynamicChannelGain channelGain;

            for (i = 0; i < _panInfo.channelGains.Count; i++)
            {
                channelGain = _panInfo.channelGains[i];
                if (channelGain.ShouldInterpolate)
                {
                    _trackBuffer.SmoothedGainMixToInterlaced(audioBuffer, 0, 0, GATInfo.AudioBufferSizePerChannel, channelGain);
                    continue;
                }

                if (channelGain.Gain != 0f)
                {
                    _trackBuffer.GainMixToInterlaced(audioBuffer, 0, 0, GATInfo.AudioBufferSizePerChannel, channelGain);
                }
            }

            if (_nextMute)              //only set mute here to allow for mixing of faded data : elegant stop
            {
                _mute = true;
            }

            return(!isEmptyData);
        }