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);
}
}