Exemple #1
0
        public void testLfsr()
        {
            Lfsr lfsr          = new Lfsr();
            int  previousValue = 0;

            for (int i = 0; i < 100; i++)
            {
                lfsr.NextBit(false);
                Assert.AreNotEqual(previousValue, lfsr.Value);
                previousValue = lfsr.Value;
            }
        }
Exemple #2
0
        public override int Tick()
        {
            _volumeEnvelope.Tick();

            if (!UpdateLength())
            {
                return(0);
            }

            if (!DacEnabled)
            {
                return(0);
            }

            if (_polynomialCounter.Tick())
            {
                _lastResult = _lfsr.NextBit((Nr3 & (1 << 3)) != 0);
            }

            return(_lastResult * _volumeEnvelope.GetVolume());
        }