Beispiel #1
0
        /// <summary>
        /// Seeks the current stream to the sample position specified.
        /// </summary>
        /// <param name="samplePosition">The sample position to seek to.</param>
        /// <returns>The sample position seeked to.</returns>
        public long Seek(long samplePosition)
        {
            if (!CanSeek)
            {
                throw new InvalidOperationException("Cannot seek underlying stream!");
            }
            if (samplePosition < 0 || samplePosition > _streamDecoder.TotalSamples)
            {
                throw new ArgumentOutOfRangeException(nameof(samplePosition));
            }

            _streamDecoder.SeekTo(samplePosition);

            return(_streamDecoder.SamplePosition);
        }