public void Reset()
 {
     time            = -1.0;
     packetFrame     = 0;
     isInterpolating = false;
     startFrame      = 0;
     startTime       = 0.0;
     endFrame        = 0;
     endTime         = 0.0;
     buffer.Reset();
 }
예제 #2
0
    static void test_sequence_buffer32()
    {
        Log("test_sequence_buffer32");
        const int Size   = 256;
        var       buffer = new SequenceBuffer32 <TestPacketData32>(Size);

        for (int i = 0; i < Size; ++i)
        {
            TestPacketData entry;
            entry.sequence = 0;
            IsTrue(buffer.Exists((uint)i) == false);
            IsTrue(buffer.Available((uint)i) == true);
            IsTrue(buffer.Get((uint)i) == -1);
        }

        for (int i = 0; i <= Size * 4; ++i)
        {
            int index = buffer.Insert((uint)i);
            IsTrue(index != -1);
            IsTrue(buffer.id == i + 1);
            buffer.entries[index].sequence = (uint)i;
        }

        for (int i = 0; i <= Size; ++i)
        {
            int index = buffer.Insert((uint)i); //note: outside bounds!
            IsTrue(index == -1);
        }

        uint sequence = Size * 4;

        for (int i = 0; i < Size; ++i)
        {
            int index = buffer.Get(sequence);
            IsTrue(index >= 0);
            IsTrue(index < Size);
            IsTrue(buffer.entries[index].sequence == sequence);
            sequence--;
        }

        buffer.Reset();
        IsTrue(buffer.id == 0);

        for (int i = 0; i < Size; ++i)
        {
            IsTrue(buffer.Exists((uint)i) == false);
            IsTrue(buffer.Available((uint)i) == true);
            IsTrue(buffer.Get((uint)i) == -1);
        }
    }