public ResampleCopyFrom ( float sourceArray, double trueInterpolatedIndex, int targetLength, int targetOffset, double resamplingFactor ) : double | ||
sourceArray | float | |
trueInterpolatedIndex | double | |
targetLength | int | |
targetOffset | int | |
resamplingFactor | double | |
Résultat | double |
public int GetResampledData(GATData target, int targetLength, int offsetInTarget, double pitch) { double dLastIndex = _nextIndex + pitch * (targetLength - 1); int iLastIndex = ( int )dLastIndex;; int sign = System.Math.Sign(pitch); if (dLastIndex - ( double )iLastIndex > 0d) { iLastIndex += sign; } if (iLastIndex >= _data.Count - 1) { targetLength = ( int )((( double )(_data.Count - 1) - _nextIndex) / pitch); target.ResampleCopyFrom(_data.ParentArray, _nextIndex + ( double )_data.MemOffset, targetLength, offsetInTarget, pitch); return(targetLength); } else if (iLastIndex < 0) { targetLength = -( int )((_nextIndex - 1d) / pitch) + 1; target.ResampleCopyFrom(_data.ParentArray, _nextIndex + ( double )_data.MemOffset, targetLength, offsetInTarget, pitch); return(targetLength); } else { target.ResampleCopyFrom(_data.ParentArray, _nextIndex + ( double )_data.MemOffset, targetLength, offsetInTarget, pitch); _nextIndex = dLastIndex + pitch; return(targetLength); } }
/// <summary> /// Performs a resampled /// copy to another GATData /// instance. /// The resampling algorithm /// performs naive linear interpolation. /// </summary> /// <returns> /// The next interpolated index. /// </returns> public double ResampleCopyTo(double trueInterpolatedIndex, GATData destinationSample, int targetLength, double resamplingFactor) { return(destinationSample.ResampleCopyFrom(_parentArray, trueInterpolatedIndex, targetLength, 0, resamplingFactor)); }
/// <summary> /// Performs a resampled /// copy to another /// GATData instance /// The resampling algorithm /// performs naive linear interpolation. /// Warning: for resampling in chunks, use /// the method of the same name which returns /// a double interpolated index. /// </summary> public void ResampleCopyTo(int sourceIndex, GATData destinationSample, int targetLength, double resamplingFactor) { sourceIndex += _offset; destinationSample.ResampleCopyFrom(_parentArray, ( double )sourceIndex, targetLength, 0, resamplingFactor); }
/// <summary> /// Performs a resampled /// copy to another GATData /// instance. /// The resampling algorithm /// performs naive linear interpolation. /// </summary> /// <returns> /// The next interpolated index. /// </returns> public double ResampleCopyTo( double trueInterpolatedIndex, GATData destinationSample, int targetLength, double resamplingFactor ) { return destinationSample.ResampleCopyFrom( _parentArray, trueInterpolatedIndex, targetLength, 0, resamplingFactor ); }
/// <summary> /// Performs a resampled /// copy to another /// GATData instance /// The resampling algorithm /// performs naive linear interpolation. /// Warning: for resampling in chunks, use /// the method of the same name which returns /// a double interpolated index. /// </summary> public void ResampleCopyTo( int sourceIndex, GATData destinationSample, int targetLength, double resamplingFactor ) { sourceIndex += _offset; destinationSample.ResampleCopyFrom( _parentArray, ( double )sourceIndex, targetLength, 0, resamplingFactor ); }