Example #1
0
        public void TestCopyFrom()
        {
            RingBuffer <float> r1 = new RingBuffer <float>(3);
            RingBuffer <float> r2 = new RingBuffer <float>(10);
            RingBuffer <float> r3 = new RingBuffer <float>(1);

            Assert.IsTrue(r1.Enqueue(1.5f));
            Assert.IsTrue(r1.Enqueue(2.5f));
            Assert.IsTrue(r1.Enqueue(3.5f));

            r2.CopyFrom(r1);
            r3.CopyFrom(r2);

            Assert.AreEqual(r1.IsFull, r2.IsFull);
            Assert.AreEqual(r1.IsEmpty, r2.IsEmpty);
            Assert.AreEqual(r1[0], r2[0]);
            Assert.AreEqual(r1[1], r2[1]);
            Assert.AreEqual(r1[2], r2[2]);

            Assert.AreEqual(r3.IsFull, r2.IsFull);
            Assert.AreEqual(r3.IsEmpty, r2.IsEmpty);
            Assert.AreEqual(r3[0], r2[0]);
            Assert.AreEqual(r3[1], r2[1]);
            Assert.AreEqual(r3[2], r2[2]);

            r2.Clear();

            Assert.AreEqual(r3.IsFull, r1.IsFull);
            Assert.AreEqual(r3.IsEmpty, r1.IsEmpty);
            Assert.AreEqual(r3[0], r1[0]);
            Assert.AreEqual(r3[1], r1[1]);
            Assert.AreEqual(r3[2], r1[2]);
        }
Example #2
0
        public void TestClear()
        {
            RingBuffer <float> rbf = new RingBuffer <float>(3);

            Assert.IsTrue(rbf.IsEmpty);
            Assert.IsFalse(rbf.IsFull);

            Assert.IsTrue(rbf.Enqueue(1.5f));
            Assert.IsTrue(rbf.Enqueue(2.5f));
            Assert.IsTrue(rbf.Enqueue(3.5f));

            Assert.IsFalse(rbf.IsEmpty);
            Assert.IsTrue(rbf.IsFull);
            Assert.AreEqual(3, rbf.Count);

            rbf.Clear();

            Assert.IsTrue(rbf.IsEmpty);
            Assert.IsFalse(rbf.IsFull);
            Assert.AreEqual(0, rbf.Count);
        }
Example #3
0
 public void Clear()
 {
     m_frameSamples = 0;
     m_leftChannel.Clear();
     m_rightChannel.Clear();
 }