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

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

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