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 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
13 | 13 |
14 #include <stddef.h> // size_t | 14 #include <stddef.h> // size_t |
15 #include <stdio.h> // FILE | 15 #include <stdio.h> // FILE |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/arraysize.h" | |
18 #include "webrtc/base/platform_file.h" | 19 #include "webrtc/base/platform_file.h" |
19 #include "webrtc/common.h" | 20 #include "webrtc/common.h" |
20 #include "webrtc/modules/audio_processing/beamformer/array_util.h" | 21 #include "webrtc/modules/audio_processing/beamformer/array_util.h" |
21 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
22 | 23 |
23 struct AecCore; | 24 struct AecCore; |
24 | 25 |
25 namespace webrtc { | 26 namespace webrtc { |
26 | 27 |
27 class AudioFrame; | 28 class AudioFrame; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 // AudioProcessing::SetExtraOptions(). | 122 // AudioProcessing::SetExtraOptions(). |
122 // | 123 // |
123 // Note: If enabled and the reverse stream has more than one output channel, | 124 // Note: If enabled and the reverse stream has more than one output channel, |
124 // the reverse stream will become an upmixed mono signal. | 125 // the reverse stream will become an upmixed mono signal. |
125 struct Intelligibility { | 126 struct Intelligibility { |
126 Intelligibility() : enabled(false) {} | 127 Intelligibility() : enabled(false) {} |
127 explicit Intelligibility(bool enabled) : enabled(enabled) {} | 128 explicit Intelligibility(bool enabled) : enabled(enabled) {} |
128 bool enabled; | 129 bool enabled; |
129 }; | 130 }; |
130 | 131 |
131 static const int kAudioProcMaxNativeSampleRateHz = 32000; | |
132 | |
133 // The Audio Processing Module (APM) provides a collection of voice processing | 132 // The Audio Processing Module (APM) provides a collection of voice processing |
134 // components designed for real-time communications software. | 133 // components designed for real-time communications software. |
135 // | 134 // |
136 // APM operates on two audio streams on a frame-by-frame basis. Frames of the | 135 // APM operates on two audio streams on a frame-by-frame basis. Frames of the |
137 // primary stream, on which all processing is applied, are passed to | 136 // primary stream, on which all processing is applied, are passed to |
138 // |ProcessStream()|. Frames of the reverse direction stream, which are used for | 137 // |ProcessStream()|. Frames of the reverse direction stream, which are used for |
139 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the | 138 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the |
140 // client-side, this will typically be the near-end (capture) and far-end | 139 // client-side, this will typically be the near-end (capture) and far-end |
141 // (render) streams, respectively. APM should be placed in the signal chain as | 140 // (render) streams, respectively. APM should be placed in the signal chain as |
142 // close to the audio hardware abstraction layer (HAL) as possible. | 141 // close to the audio hardware abstraction layer (HAL) as possible. |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
467 enum NativeRate { | 466 enum NativeRate { |
468 kSampleRate8kHz = 8000, | 467 kSampleRate8kHz = 8000, |
469 kSampleRate16kHz = 16000, | 468 kSampleRate16kHz = 16000, |
470 kSampleRate32kHz = 32000, | 469 kSampleRate32kHz = 32000, |
471 kSampleRate48kHz = 48000 | 470 kSampleRate48kHz = 48000 |
472 }; | 471 }; |
473 | 472 |
474 static const int kChunkSizeMs = 10; | 473 static const int kChunkSizeMs = 10; |
475 }; | 474 }; |
476 | 475 |
476 static const int kAudioProcNativeSampleRatesHz[] = { | |
Andrew MacDonald
2015/09/16 02:35:08
nit: Make these class members:
class AudioProcess
aluebs-webrtc
2015/09/16 03:02:53
I though about that, but there is no cc file. Is t
Andrew MacDonald
2015/09/16 04:04:08
You can use audio_processing_impl.cc.
aluebs-webrtc
2015/09/22 01:35:29
Good point. Done.
| |
477 AudioProcessing::kSampleRate8kHz, | |
478 AudioProcessing::kSampleRate16kHz, | |
479 AudioProcessing::kSampleRate32kHz, | |
480 AudioProcessing::kSampleRate48kHz}; | |
481 static const size_t kNumAudioProcNativeSampleRates = | |
482 arraysize(kAudioProcNativeSampleRatesHz); | |
483 static const int kAudioProcMaxNativeSampleRateHz = | |
484 kAudioProcNativeSampleRatesHz[kNumAudioProcNativeSampleRates - 1]; | |
485 | |
477 class StreamConfig { | 486 class StreamConfig { |
478 public: | 487 public: |
479 // sample_rate_hz: The sampling rate of the stream. | 488 // sample_rate_hz: The sampling rate of the stream. |
480 // | 489 // |
481 // num_channels: The number of audio channels in the stream, excluding the | 490 // num_channels: The number of audio channels in the stream, excluding the |
482 // keyboard channel if it is present. When passing a | 491 // keyboard channel if it is present. When passing a |
483 // StreamConfig with an array of arrays T*[N], | 492 // StreamConfig with an array of arrays T*[N], |
484 // | 493 // |
485 // N == {num_channels + 1 if has_keyboard | 494 // N == {num_channels + 1 if has_keyboard |
486 // {num_channels if !has_keyboard | 495 // {num_channels if !has_keyboard |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
936 // This does not impact the size of frames passed to |ProcessStream()|. | 945 // This does not impact the size of frames passed to |ProcessStream()|. |
937 virtual int set_frame_size_ms(int size) = 0; | 946 virtual int set_frame_size_ms(int size) = 0; |
938 virtual int frame_size_ms() const = 0; | 947 virtual int frame_size_ms() const = 0; |
939 | 948 |
940 protected: | 949 protected: |
941 virtual ~VoiceDetection() {} | 950 virtual ~VoiceDetection() {} |
942 }; | 951 }; |
943 } // namespace webrtc | 952 } // namespace webrtc |
944 | 953 |
945 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 954 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
OLD | NEW |