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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 // Use to enable 48kHz support in audio processing. Must be provided through the | 116 // Use to enable 48kHz support in audio processing. Must be provided through the |
117 // constructor. It will have no impact if used with | 117 // constructor. It will have no impact if used with |
118 // AudioProcessing::SetExtraOptions(). | 118 // AudioProcessing::SetExtraOptions(). |
119 struct AudioProcessing48kHzSupport { | 119 struct AudioProcessing48kHzSupport { |
120 AudioProcessing48kHzSupport() : enabled(true) {} | 120 AudioProcessing48kHzSupport() : enabled(true) {} |
121 explicit AudioProcessing48kHzSupport(bool enabled) : enabled(enabled) {} | 121 explicit AudioProcessing48kHzSupport(bool enabled) : enabled(enabled) {} |
122 bool enabled; | 122 bool enabled; |
123 }; | 123 }; |
124 | 124 |
| 125 // Use to enable intelligibility enhancer in audio processing. It can be set |
| 126 // in the constructor or using AudioProcessing::SetExtraOptions(). |
| 127 struct Intelligibility { |
| 128 Intelligibility() : enabled(false) {} |
| 129 explicit Intelligibility(bool enabled) : enabled(enabled) {} |
| 130 bool enabled; |
| 131 }; |
| 132 |
125 static const int kAudioProcMaxNativeSampleRateHz = 32000; | 133 static const int kAudioProcMaxNativeSampleRateHz = 32000; |
126 | 134 |
127 // The Audio Processing Module (APM) provides a collection of voice processing | 135 // The Audio Processing Module (APM) provides a collection of voice processing |
128 // components designed for real-time communications software. | 136 // components designed for real-time communications software. |
129 // | 137 // |
130 // APM operates on two audio streams on a frame-by-frame basis. Frames of the | 138 // APM operates on two audio streams on a frame-by-frame basis. Frames of the |
131 // primary stream, on which all processing is applied, are passed to | 139 // primary stream, on which all processing is applied, are passed to |
132 // |ProcessStream()|. Frames of the reverse direction stream, which are used for | 140 // |ProcessStream()|. Frames of the reverse direction stream, which are used for |
133 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the | 141 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the |
134 // client-side, this will typically be the near-end (capture) and far-end | 142 // client-side, this will typically be the near-end (capture) and far-end |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // may use the same memory, if desired. | 304 // may use the same memory, if desired. |
297 virtual int ProcessStream(const float* const* src, | 305 virtual int ProcessStream(const float* const* src, |
298 int samples_per_channel, | 306 int samples_per_channel, |
299 int input_sample_rate_hz, | 307 int input_sample_rate_hz, |
300 ChannelLayout input_layout, | 308 ChannelLayout input_layout, |
301 int output_sample_rate_hz, | 309 int output_sample_rate_hz, |
302 ChannelLayout output_layout, | 310 ChannelLayout output_layout, |
303 float* const* dest) = 0; | 311 float* const* dest) = 0; |
304 | 312 |
305 // Analyzes a 10 ms |frame| of the reverse direction audio stream. The frame | 313 // Analyzes a 10 ms |frame| of the reverse direction audio stream. The frame |
306 // will not be modified. On the client-side, this is the far-end (or to be | 314 // will not be modified, unless intelligibility is enabled. On the client- |
307 // rendered) audio. | 315 // side, this is the far-end (or to be rendered) audio. |
308 // | 316 // |
309 // It is only necessary to provide this if echo processing is enabled, as the | 317 // It is only necessary to provide this if echo processing is enabled, as the |
310 // reverse stream forms the echo reference signal. It is recommended, but not | 318 // reverse stream forms the echo reference signal. It is recommended, but not |
311 // necessary, to provide if gain control is enabled. On the server-side this | 319 // necessary, to provide if gain control is enabled. On the server-side this |
312 // typically will not be used. If you're not sure what to pass in here, | 320 // typically will not be used. If you're not sure what to pass in here, |
313 // chances are you don't need to use it. | 321 // chances are you don't need to use it. |
314 // | 322 // |
315 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| | 323 // The |sample_rate_hz_|, |num_channels_|, and |samples_per_channel_| |
316 // members of |frame| must be valid. |sample_rate_hz_| must correspond to | 324 // members of |frame| must be valid. |sample_rate_hz_| must correspond to |
317 // |input_sample_rate_hz()| | 325 // |input_sample_rate_hz()| |
318 // | 326 // |
319 // TODO(ajm): add const to input; requires an implementation fix. | 327 // TODO(ajm): add const to input; requires an implementation fix. |
320 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0; | 328 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0; |
321 | 329 |
322 // Accepts deinterleaved float audio with the range [-1, 1]. Each element | 330 // Accepts deinterleaved float audio with the range [-1, 1]. Each element |
323 // of |data| points to a channel buffer, arranged according to |layout|. | 331 // of |data| points to a channel buffer, arranged according to |layout|. |
324 virtual int AnalyzeReverseStream(const float* const* data, | 332 virtual int AnalyzeReverseStream(float* const* data, |
325 int samples_per_channel, | 333 int samples_per_channel, |
326 int sample_rate_hz, | 334 int sample_rate_hz, |
327 ChannelLayout layout) = 0; | 335 ChannelLayout layout) = 0; |
328 | 336 |
329 // This must be called if and only if echo processing is enabled. | 337 // This must be called if and only if echo processing is enabled. |
330 // | 338 // |
331 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end | 339 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end |
332 // frame and ProcessStream() receiving a near-end frame containing the | 340 // frame and ProcessStream() receiving a near-end frame containing the |
333 // corresponding echo. On the client-side this can be expressed as | 341 // corresponding echo. On the client-side this can be expressed as |
334 // delay = (t_render - t_analyze) + (t_process - t_capture) | 342 // delay = (t_render - t_analyze) + (t_process - t_capture) |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 // This does not impact the size of frames passed to |ProcessStream()|. | 795 // This does not impact the size of frames passed to |ProcessStream()|. |
788 virtual int set_frame_size_ms(int size) = 0; | 796 virtual int set_frame_size_ms(int size) = 0; |
789 virtual int frame_size_ms() const = 0; | 797 virtual int frame_size_ms() const = 0; |
790 | 798 |
791 protected: | 799 protected: |
792 virtual ~VoiceDetection() {} | 800 virtual ~VoiceDetection() {} |
793 }; | 801 }; |
794 } // namespace webrtc | 802 } // namespace webrtc |
795 | 803 |
796 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 804 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |