ResampleCopyTo() public méthode

Performs a resampled copy to another GATData instance. The resampling algorithm performs naive linear interpolation.
public ResampleCopyTo ( double trueInterpolatedIndex, GATData destinationSample, int targetLength, double resamplingFactor ) : double
trueInterpolatedIndex double
destinationSample GATData
targetLength int
resamplingFactor double
Résultat double
Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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 );
            }
        }