public void DtmfDecoderTest8() { byte[][] pack1 = new byte[][] { // Timestamp: 115840423 (0x6E795A7) 14480,052875 seconds client_1_1, // Timestamp: 115873063 (0x6E81527) 14484,132875 seconds client_2_1, }; DtmfDecoder decoder = new DtmfDecoder(106, 8000); foreach (var message in pack1) { decoder.EnqueueMessage(message, 0, message.Length); } decoder.DelayMilliseconds = 1000; decoder.Process(); Assert.AreEqual(0, decoder.Proccessed); decoder.DelayMilliseconds = 0; decoder.Process(); Assert.AreEqual(1, decoder.Proccessed); System.Threading.Thread.Sleep(1000); decoder.Process(); Assert.AreEqual(1, decoder.Proccessed); System.Threading.Thread.Sleep(4000); decoder.Process(); Assert.AreEqual(2, decoder.Proccessed); Assert.AreEqual(2, decoder.DtmfCodes.Count); Assert.AreEqual(1, decoder.DtmfCodes[0].Code); Assert.AreEqual(2, decoder.DtmfCodes[1].Code); }
private DtmfDecoder ProcessEach(byte[][] pack) { DtmfDecoder decoder = new DtmfDecoder(106, 8000) { DelayMilliseconds = -600000, }; foreach (var message in pack) { decoder.EnqueueMessage(message, 0, message.Length); decoder.Process(); } return(decoder); }