Exemplo n.º 1
0
        public void TestConvertTimeToSamples()
        {
            bool integer;

            var result = Dsp.ConvertTimeToSamples(1, 44100, out integer);

            Assert.That(integer);
            Assert.That(result == 44100);

            result = Dsp.ConvertTimeToSamples(44100.6 / 44100, 44100, out integer);
            Assert.That(!integer);
            Assert.That(result == 44101);

            result = Dsp.ConvertTimeToSamples(-1, 44100, out integer);
            Assert.That(integer);
            Assert.That(result == -44100);

            Assert.Throws <ArgumentOutOfRangeException>(() => Dsp.ConvertTimeToSamples(1, -1, out integer));
        }