/// <summary>
        /// Sets the range of the sound to play.
        /// </summary>
        /// <param name="range">a PlayRange structure that describes the starting offset and ending point of the sound to play in seconds.</param>
        public void SetRange(PlayRange range)
        {
            if (engine.State == AudioEngineState.Invalidated)
            {
                return;
            }

            var state = PlayState;

            if (state == SoundPlayState.Playing)
            {
                Stop();
            }

            if (soundSource == null)
            {
                AudioLayer.SourceSetRange(Source, range.Start.TotalSeconds, range.End.TotalSeconds);
            }
            else
            {
                soundSource.SetRange(range);
            }

            if (state == SoundPlayState.Playing)
            {
                Play();
            }
        }