Example #1
0
        public static DtmfAudio CreateFrom(ISampleSource source, DetectorConfig config)
        {
            var pureTones = Enumerable
                            .Range(0, source.Channels)
                            .Select(c => new PureTones(new AmplitudeEstimatorFactory(source.SampleRate, config.SampleBlockSize)))
                            .ToArray();

            var dtmfChangeHandlers = Enumerable
                                     .Range(0, source.Channels)
                                     .Select(c => new DtmfChangeHandler())
                                     .ToArray();

            return(new DtmfAudio(new DtmfDetector(config, pureTones), source, dtmfChangeHandlers));
        }
Example #2
0
 public DtmfDetector(DetectorConfig config, PureTones[] powers)
 {
     this.config = config;
     this.powers = powers;
     numChannels = powers.Length;
 }