private long CalculateStreamPosition(AudioPlayback audioPlayback, double sliderPosition, double sliderMax) { return(Math.Min(audioPlayback.fileStream.Length, Convert.ToInt64((sliderPosition * audioPlayback.fileStream.Length) / sliderMax))); }