Exemple #1
0
        public long CurrentPosition()
        {
            if ((m_itCurrent == m_Clips.Count) || !m_bActive)
            {
                return(m_tStartPosition);
            }
            double dTime = 0;

            m_pController.GetSegmentTime(out dTime);
            long tNow = (long)(dTime * 10000000);

            ClipEntry ce = (ClipEntry)m_Clips[m_itCurrent];

            // this is relative to the start position within this particular clip.
            // Did we start at the beginning of this clip?
            if (m_tStartPosition > ce.GetStartPosition())
            {
                // no, we started some distance into the clip
                tNow += (m_tStartPosition - ce.GetStartPosition());
            }
            // offset from start of this clip to start of entire sequence
            tNow += ce.GetStartPosition();

            if ((tNow < 0) && m_bLoop)
            {
                // current time is near end of previous loop
                ce    = (ClipEntry)m_Clips[m_Clips.Count - 1];
                tNow += ce.GetStartPosition() + ce.Duration();
            }
            return(tNow);
        }
Exemple #2
0
        public int SetClipLimits(ClipEntry pClip, long tStart, long tEnd)
        {
            long tDur = pClip.Duration();
            int  hr   = pClip.SetLimits(tStart, tEnd);

            if (hr < 0 || (tDur == pClip.Duration()))
            {
                return(hr);
            }

            // this is called from the same message loop as the end-of-segment processing, so it's safe to
            // access the current segment
            if (pClip == CurrentClip())
            {
                // send just the stop time to the graph
                // in the hope that it is not too late
                hr = pClip.SetStopTime();
            }

            // clip duration has changed: update start position of
            // all subsequent clips (for current position slider UI)

            m_tDuration = 0;
            bool bFound = false;

            foreach (ClipEntry pThis in m_Clips)
            {
                if (pThis == pClip)
                {
                    bFound      = true;
                    m_tDuration = pClip.GetStartPosition() + pClip.Duration();
                }
                else if (bFound)
                {
                    // following clip: adjust
                    pClip.SetStartPosition(m_tDuration);
                    m_tDuration += pClip.Duration();
                }
            }
            return(S_OK);
        }
Exemple #3
0
        public int SetClipLimits(ClipEntry pClip, long tStart, long tEnd)
        {
            long tDur = pClip.Duration();
            int hr = pClip.SetLimits(tStart, tEnd);
            if (hr < 0 || (tDur == pClip.Duration()))
            {
                return hr;
            }

            // this is called from the same message loop as the end-of-segment processing, so it's safe to
            // access the current segment
            if (pClip == CurrentClip())
            {
                // send just the stop time to the graph
                // in the hope that it is not too late
                hr = pClip.SetStopTime();
            }

            // clip duration has changed: update start position of
            // all subsequent clips (for current position slider UI)

            m_tDuration = 0;
            bool bFound = false;
            foreach (ClipEntry pThis in m_Clips)
            {
                if (pThis == pClip)
                {
                    bFound = true;
                    m_tDuration = pClip.GetStartPosition() + pClip.Duration();
                }
                else if (bFound)
                {
                    // following clip: adjust
                    pClip.SetStartPosition(m_tDuration);
                    m_tDuration += pClip.Duration();
                }
            }
            return S_OK;
        }