private void Detect() { while (dtmfAudio.Forward( (channel, tone) => { var start = DateTime.Now; DtmfToneStarted?.Invoke(new DtmfToneStart(tone, channel, start)); return(start); }, (channel, start, tone) => DtmfToneStopped?.Invoke(new DtmfToneEnd(tone, channel, DateTime.Now - start)))) { } }
public static bool AddNextFrom(this Queue <DtmfOccurence> detectedTones, DtmfAudio dtmfAudio, WaveStream waveFile) { return(dtmfAudio.Forward( (channel, tone) => waveFile.CurrentTime, (channel, start, tone) => detectedTones.Enqueue(new DtmfOccurence(tone, channel, start, waveFile.CurrentTime - start)))); }