LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/neteq - dtmf_tone_generator.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
       3             :  *
       4             :  *  Use of this source code is governed by a BSD-style license
       5             :  *  that can be found in the LICENSE file in the root of the source
       6             :  *  tree. An additional intellectual property rights grant can be found
       7             :  *  in the file PATENTS.  All contributing project authors may
       8             :  *  be found in the AUTHORS file in the root of the source tree.
       9             :  */
      10             : 
      11             : #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_
      12             : #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_
      13             : 
      14             : 
      15             : #include "webrtc/base/constructormagic.h"
      16             : #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
      17             : #include "webrtc/typedefs.h"
      18             : 
      19             : namespace webrtc {
      20             : 
      21             : const int NumDtmfSampleRates = 5;
      22             : const int DtmfSampleRates[NumDtmfSampleRates] = {
      23             :   8000,
      24             :   16000,
      25             :   32000,
      26             :   44100,
      27             :   48000
      28             : };
      29             : 
      30             : // This class provides a generator for DTMF tones.
      31             : class DtmfToneGenerator {
      32             :  public:
      33             :   enum ReturnCodes {
      34             :     kNotInitialized = -1,
      35             :     kParameterError = -2,
      36             :   };
      37             : 
      38             :   DtmfToneGenerator();
      39           0 :   virtual ~DtmfToneGenerator() {}
      40             :   virtual int Init(int fs, int event, int attenuation);
      41             :   virtual void Reset();
      42             :   virtual int Generate(size_t num_samples, AudioMultiVector* output);
      43             :   virtual bool initialized() const;
      44             : 
      45             :  private:
      46             :   static const int kCoeff1[NumDtmfSampleRates][16];  // 1st oscillator model coefficient table.
      47             :   static const int kCoeff2[NumDtmfSampleRates][16];  // 2nd oscillator model coefficient table.
      48             :   static const int kInitValue1[NumDtmfSampleRates][16];  // Initialization for 1st oscillator.
      49             :   static const int kInitValue2[NumDtmfSampleRates][16];  // Initialization for 2nd oscillator.
      50             :   static const int kAmplitude[64];  // Amplitude for 0 through -63 dBm0.
      51             :   static const int16_t kAmpMultiplier = 23171;  // 3 dB attenuation (in Q15).
      52             : 
      53             :   bool initialized_;            // True if generator is initialized properly.
      54             :   int coeff1_;                  // 1st oscillator coefficient for this event.
      55             :   int coeff2_;                  // 2nd oscillator coefficient for this event.
      56             :   int amplitude_;               // Amplitude for this event.
      57             :   int16_t sample_history1_[2];  // Last 2 samples for the 1st oscillator.
      58             :   int16_t sample_history2_[2];  // Last 2 samples for the 2nd oscillator.
      59             : 
      60             :   RTC_DISALLOW_COPY_AND_ASSIGN(DtmfToneGenerator);
      61             : };
      62             : 
      63             : }  // namespace webrtc
      64             : #endif  // WEBRTC_MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_

Generated by: LCOV version 1.13