Clear() public method

Clears all audio data
public Clear ( ) : void
return void
コード例 #1
0
ファイル: GATSampleBank.cs プロジェクト: uniphonic/G-Audio
        protected void FillWithResampledData(GATData sourceData, GATData targetData, int fromIndex, int targetLength, double pitch)
        {
            //check that we have enough samples to fulfill the request:
            int appliedLength = GATMaths.ClampedResampledLength(sourceData.Count - fromIndex, targetLength, pitch);

            if (appliedLength < 0)
            {
                                #if GAT_DEBUG
                Debug.LogWarning("requested offset is out of bounds.");
                                #endif
                return;
            }

            sourceData.ResampleCopyTo(fromIndex, targetData, appliedLength, pitch);

            //if we did not have enough samples, clear the rest:
            if (appliedLength < targetLength)
            {
                targetData.Clear(appliedLength, targetData.Count - appliedLength);
            }
        }
コード例 #2
0
ファイル: GATSampleBank.cs プロジェクト: gregzo/G-Audio
        protected void FillWithResampledData( GATData sourceData, GATData targetData, int fromIndex, int targetLength, double pitch )
        {
            //check that we have enough samples to fulfill the request:
            int appliedLength = GATMaths.ClampedResampledLength( sourceData.Count - fromIndex, targetLength, pitch );

            if( appliedLength < 0 )
            {
                #if GAT_DEBUG
                Debug.LogWarning( "requested offset is out of bounds." );
                #endif
                return;
            }

            sourceData.ResampleCopyTo( fromIndex, targetData, appliedLength, pitch );

            //if we did not have enough samples, clear the rest:
            if( appliedLength < targetLength )
            {
                targetData.Clear( appliedLength, targetData.Count - appliedLength );
            }
        }
コード例 #3
0
ファイル: GATTrack.cs プロジェクト: uniphonic/G-Audio
        // 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);
        }