| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |     2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 
|     3  * |     3  * | 
|     4  *  Use of this source code is governed by a BSD-style license |     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 |     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 |     6  *  tree. An additional intellectual property rights grant can be found | 
|     7  *  in the file PATENTS.  All contributing project authors may |     7  *  in the file PATENTS.  All contributing project authors may | 
|     8  *  be found in the AUTHORS file in the root of the source tree. |     8  *  be found in the AUTHORS file in the root of the source tree. | 
|     9  */ |     9  */ | 
|    10  |    10  | 
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   192 // |   192 // | 
|   193 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16 |   193 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16 | 
|   194 // interfaces use interleaved data, while the float interfaces use deinterleaved |   194 // interfaces use interleaved data, while the float interfaces use deinterleaved | 
|   195 // data. |   195 // data. | 
|   196 // |   196 // | 
|   197 // Usage example, omitting error checking: |   197 // Usage example, omitting error checking: | 
|   198 // AudioProcessing* apm = AudioProcessing::Create(0); |   198 // AudioProcessing* apm = AudioProcessing::Create(0); | 
|   199 // |   199 // | 
|   200 // AudioProcessing::Config config; |   200 // AudioProcessing::Config config; | 
|   201 // config.level_controller.enabled = true; |   201 // config.level_controller.enabled = true; | 
 |   202 // config.high_pass_filter.enabled = true; | 
|   202 // apm->ApplyConfig(config) |   203 // apm->ApplyConfig(config) | 
|   203 // |   204 // | 
|   204 // apm->high_pass_filter()->Enable(true); |  | 
|   205 // |  | 
|   206 // apm->echo_cancellation()->enable_drift_compensation(false); |   205 // apm->echo_cancellation()->enable_drift_compensation(false); | 
|   207 // apm->echo_cancellation()->Enable(true); |   206 // apm->echo_cancellation()->Enable(true); | 
|   208 // |   207 // | 
|   209 // apm->noise_reduction()->set_level(kHighSuppression); |   208 // apm->noise_reduction()->set_level(kHighSuppression); | 
|   210 // apm->noise_reduction()->Enable(true); |   209 // apm->noise_reduction()->Enable(true); | 
|   211 // |   210 // | 
|   212 // apm->gain_control()->set_analog_level_limits(0, 255); |   211 // apm->gain_control()->set_analog_level_limits(0, 255); | 
|   213 // apm->gain_control()->set_mode(kAdaptiveAnalog); |   212 // apm->gain_control()->set_mode(kAdaptiveAnalog); | 
|   214 // apm->gain_control()->Enable(true); |   213 // apm->gain_control()->Enable(true); | 
|   215 // |   214 // | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   251   // The config is applied by passing the struct to the ApplyConfig method. |   250   // The config is applied by passing the struct to the ApplyConfig method. | 
|   252   struct Config { |   251   struct Config { | 
|   253     struct LevelController { |   252     struct LevelController { | 
|   254       bool enabled = false; |   253       bool enabled = false; | 
|   255  |   254  | 
|   256       // Sets the initial peak level to use inside the level controller in order |   255       // Sets the initial peak level to use inside the level controller in order | 
|   257       // to compute the signal gain. The unit for the peak level is dBFS and |   256       // to compute the signal gain. The unit for the peak level is dBFS and | 
|   258       // the allowed range is [-100, 0]. |   257       // the allowed range is [-100, 0]. | 
|   259       float initial_peak_level_dbfs = -6.0206f; |   258       float initial_peak_level_dbfs = -6.0206f; | 
|   260     } level_controller; |   259     } level_controller; | 
 |   260  | 
 |   261     struct HighPassFilter { | 
 |   262       bool enabled = false; | 
 |   263     } high_pass_filter; | 
|   261   }; |   264   }; | 
|   262  |   265  | 
|   263   // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone. |   266   // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone. | 
|   264   enum ChannelLayout { |   267   enum ChannelLayout { | 
|   265     kMono, |   268     kMono, | 
|   266     // Left, right. |   269     // Left, right. | 
|   267     kStereo, |   270     kStereo, | 
|   268     // Mono, keyboard, and mic. |   271     // Mono, keyboard, and mic. | 
|   269     kMonoAndKeyboard, |   272     kMonoAndKeyboard, | 
|   270     // Left, right, keyboard, and mic. |   273     // Left, right, keyboard, and mic. | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   468   // Use to send UMA histograms at end of a call. Note that all histogram |   471   // Use to send UMA histograms at end of a call. Note that all histogram | 
|   469   // specific member variables are reset. |   472   // specific member variables are reset. | 
|   470   virtual void UpdateHistogramsOnCallEnd() = 0; |   473   virtual void UpdateHistogramsOnCallEnd() = 0; | 
|   471  |   474  | 
|   472   // These provide access to the component interfaces and should never return |   475   // These provide access to the component interfaces and should never return | 
|   473   // NULL. The pointers will be valid for the lifetime of the APM instance. |   476   // NULL. The pointers will be valid for the lifetime of the APM instance. | 
|   474   // The memory for these objects is entirely managed internally. |   477   // The memory for these objects is entirely managed internally. | 
|   475   virtual EchoCancellation* echo_cancellation() const = 0; |   478   virtual EchoCancellation* echo_cancellation() const = 0; | 
|   476   virtual EchoControlMobile* echo_control_mobile() const = 0; |   479   virtual EchoControlMobile* echo_control_mobile() const = 0; | 
|   477   virtual GainControl* gain_control() const = 0; |   480   virtual GainControl* gain_control() const = 0; | 
 |   481   // TODO(peah): Deprecate this API call. | 
|   478   virtual HighPassFilter* high_pass_filter() const = 0; |   482   virtual HighPassFilter* high_pass_filter() const = 0; | 
|   479   virtual LevelEstimator* level_estimator() const = 0; |   483   virtual LevelEstimator* level_estimator() const = 0; | 
|   480   virtual NoiseSuppression* noise_suppression() const = 0; |   484   virtual NoiseSuppression* noise_suppression() const = 0; | 
|   481   virtual VoiceDetection* voice_detection() const = 0; |   485   virtual VoiceDetection* voice_detection() const = 0; | 
|   482  |   486  | 
|   483   struct Statistic { |   487   struct Statistic { | 
|   484     int instant;  // Instantaneous value. |   488     int instant;  // Instantaneous value. | 
|   485     int average;  // Long-term average. |   489     int average;  // Long-term average. | 
|   486     int maximum;  // Long-term maximum. |   490     int maximum;  // Long-term maximum. | 
|   487     int minimum;  // Long-term minimum. |   491     int minimum;  // Long-term minimum. | 
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   879   // signal reaches digital full-scale) in the current frame and the analog |   883   // signal reaches digital full-scale) in the current frame and the analog | 
|   880   // level cannot be reduced. |   884   // level cannot be reduced. | 
|   881   // |   885   // | 
|   882   // This could be used as an indicator to reduce or disable analog mic gain at |   886   // This could be used as an indicator to reduce or disable analog mic gain at | 
|   883   // the audio HAL. |   887   // the audio HAL. | 
|   884   virtual bool stream_is_saturated() const = 0; |   888   virtual bool stream_is_saturated() const = 0; | 
|   885  |   889  | 
|   886  protected: |   890  protected: | 
|   887   virtual ~GainControl() {} |   891   virtual ~GainControl() {} | 
|   888 }; |   892 }; | 
|   889  |   893 // TODO(peah): Remove this interface. | 
|   890 // A filtering component which removes DC offset and low-frequency noise. |   894 // A filtering component which removes DC offset and low-frequency noise. | 
|   891 // Recommended to be enabled on the client-side. |   895 // Recommended to be enabled on the client-side. | 
|   892 class HighPassFilter { |   896 class HighPassFilter { | 
|   893  public: |   897  public: | 
|   894   virtual int Enable(bool enable) = 0; |   898   virtual int Enable(bool enable) = 0; | 
|   895   virtual bool is_enabled() const = 0; |   899   virtual bool is_enabled() const = 0; | 
|   896  |   900  | 
|   897  protected: |  | 
|   898   virtual ~HighPassFilter() {} |   901   virtual ~HighPassFilter() {} | 
|   899 }; |   902 }; | 
|   900  |   903  | 
|   901 // An estimation component used to retrieve level metrics. |   904 // An estimation component used to retrieve level metrics. | 
|   902 class LevelEstimator { |   905 class LevelEstimator { | 
|   903  public: |   906  public: | 
|   904   virtual int Enable(bool enable) = 0; |   907   virtual int Enable(bool enable) = 0; | 
|   905   virtual bool is_enabled() const = 0; |   908   virtual bool is_enabled() const = 0; | 
|   906  |   909  | 
|   907   // Returns the root mean square (RMS) level in dBFs (decibels from digital |   910   // Returns the root mean square (RMS) level in dBFs (decibels from digital | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   998   // This does not impact the size of frames passed to |ProcessStream()|. |  1001   // This does not impact the size of frames passed to |ProcessStream()|. | 
|   999   virtual int set_frame_size_ms(int size) = 0; |  1002   virtual int set_frame_size_ms(int size) = 0; | 
|  1000   virtual int frame_size_ms() const = 0; |  1003   virtual int frame_size_ms() const = 0; | 
|  1001  |  1004  | 
|  1002  protected: |  1005  protected: | 
|  1003   virtual ~VoiceDetection() {} |  1006   virtual ~VoiceDetection() {} | 
|  1004 }; |  1007 }; | 
|  1005 }  // namespace webrtc |  1008 }  // namespace webrtc | 
|  1006  |  1009  | 
|  1007 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |  1010 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 
| OLD | NEW |