FadeIn() public method

In place fade-in from offset 0 to fadeLength
public FadeIn ( int fadeLength ) : void
fadeLength int
return void
Beispiel #1
0
        /// <summary>
        /// Immediately applies all
        /// processing properties to
        /// the passed GATData object.
        /// </summary>
        public virtual void ProcessSample(GATData sample)
        {
            if (_normalize)
            {
                sample.Normalize(_normalizeValue);
            }

            if (_reverse)
            {
                sample.Reverse();
            }

            if (_fadeInSamples > 0)
            {
                sample.FadeIn(_fadeInSamples);
            }

            if (_fadeOutSamples > 0)
            {
                sample.FadeOut(_fadeOutSamples);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Immediately applies all
        /// processing properties to
        /// the passed GATData object.
        /// </summary>
        public virtual void ProcessSample( GATData sample )
        {
            if( _normalize )
                sample.Normalize( _normalizeValue );

            if( _reverse )
                sample.Reverse();

            if( _fadeInSamples > 0 )
                sample.FadeIn( _fadeInSamples );

            if( _fadeOutSamples > 0 )
                sample.FadeOut( _fadeOutSamples );
        }
Beispiel #3
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);
        }