Esempio n. 1
0
        public bool renderAtPosition(long ms)
        {
            CdgPacket pack     = new CdgPacket();
            long      numPacks = 0;
            bool      res      = true;

            if ((m_pStream == null))
            {
                return(false);
            }

            if ((ms < m_positionMs))
            {
                if ((m_pStream.seek(0, SeekOrigin.Begin) < 0))
                {
                    return(false);
                }
                m_positionMs = 0;
            }

            //duration of one packet is 1/300 seconds (4 packets per sector, 75 sectors per second)

            numPacks  = ms - m_positionMs;
            numPacks /= 10;

            m_positionMs += numPacks * 10;
            numPacks     *= 3;

            //TODO: double check logic due to inline while loop fucntionality
            //AndAlso m_pSurface.rgbData Is Nothing
            while (numPacks > 0)
            {
                res = readPacket(ref pack);
                processPacket(ref pack);
                numPacks -= 1;
            }

            render();
            return(res);
        }