Esempio n. 1
0
        /// <summary>
        /// Reads a time index from the buffer.
        /// </summary>
        /// <returns>The time index that has been read from the buffer.</returns>
        public static TimeIndex ReadTimeIndex(this Buffer buffer)
        {
            var segmentIndex = buffer.Read16();
            var frameIndex   = buffer.Read16();

            return(TimeIndex.Create(segmentIndex, frameIndex));
        }
Esempio n. 2
0
            /// <summary>
            /// Creates a time index relative to the beginning of the interval.
            /// </summary>
            /// <param name="frameIndex">An index that is relative to the beginning of the interval.</param>
            /// <returns>Time index relative to the beginning of the interval.</returns>
            public TimeIndex GetTimeIndex(int frameIndex)
            {
                Assert.IsTrue(Contains(frameIndex));

                return(TimeIndex.Create(
                           segmentIndex, frameIndex));
            }
        public void LoopSegmentIfEndReached(SamplingTime samplingTime)
        {
            int numSegmentFrames = Binary.GetSegment(samplingTime.segmentIndex).destination.NumFrames;

            if (samplingTime.frameIndex == numSegmentFrames - 1)
            {
                PlayAtTime(SamplingTime.Create(TimeIndex.Create(samplingTime.segmentIndex)));
            }
        }