mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00

This CL is the result of running include-what-you-use tool on part of the code base (audio target and dependencies) plus manual fixes. bug: webrtc:8311 Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604 Reviewed-on: https://webrtc-review.googlesource.com/c/106280 Commit-Queue: Yves Gerey <yvesg@google.com> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25311}
56 lines
2.1 KiB
C++
56 lines
2.1 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_
|
|
#define MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "modules/audio_coding/neteq/audio_multi_vector.h"
|
|
#include "rtc_base/constructormagic.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// This class provides a generator for DTMF tones.
|
|
class DtmfToneGenerator {
|
|
public:
|
|
enum ReturnCodes {
|
|
kNotInitialized = -1,
|
|
kParameterError = -2,
|
|
};
|
|
|
|
DtmfToneGenerator();
|
|
virtual ~DtmfToneGenerator() {}
|
|
virtual int Init(int fs, int event, int attenuation);
|
|
virtual void Reset();
|
|
virtual int Generate(size_t num_samples, AudioMultiVector* output);
|
|
virtual bool initialized() const;
|
|
|
|
private:
|
|
static const int kCoeff1[4][16]; // 1st oscillator model coefficient table.
|
|
static const int kCoeff2[4][16]; // 2nd oscillator model coefficient table.
|
|
static const int kInitValue1[4][16]; // Initialization for 1st oscillator.
|
|
static const int kInitValue2[4][16]; // Initialization for 2nd oscillator.
|
|
static const int kAmplitude[64]; // Amplitude for 0 through -63 dBm0.
|
|
static const int16_t kAmpMultiplier = 23171; // 3 dB attenuation (in Q15).
|
|
|
|
bool initialized_; // True if generator is initialized properly.
|
|
int coeff1_; // 1st oscillator coefficient for this event.
|
|
int coeff2_; // 2nd oscillator coefficient for this event.
|
|
int amplitude_; // Amplitude for this event.
|
|
int16_t sample_history1_[2]; // Last 2 samples for the 1st oscillator.
|
|
int16_t sample_history2_[2]; // Last 2 samples for the 2nd oscillator.
|
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(DtmfToneGenerator);
|
|
};
|
|
|
|
} // namespace webrtc
|
|
#endif // MODULES_AUDIO_CODING_NETEQ_DTMF_TONE_GENERATOR_H_
|