Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_processing/audio_buffer.h @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 2.8 KB
Line 
1/*
2 *  Copyright (c) 2011 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_PROCESSING_MAIN_SOURCE_AUDIO_BUFFER_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_AUDIO_BUFFER_H_
13
14#include "webrtc/modules/interface/module_common_types.h"
15#include "webrtc/system_wrappers/interface/scoped_ptr.h"
16#include "webrtc/typedefs.h"
17
18namespace webrtc {
19
20struct AudioChannel;
21struct SplitAudioChannel;
22
23class AudioBuffer {
24 public:
25  AudioBuffer(int max_num_channels, int samples_per_channel);
26  virtual ~AudioBuffer();
27
28  int num_channels() const;
29  int samples_per_channel() const;
30  int samples_per_split_channel() const;
31
32  int16_t* data(int channel) const;
33  int16_t* low_pass_split_data(int channel) const;
34  int16_t* high_pass_split_data(int channel) const;
35  int16_t* mixed_data(int channel) const;
36  int16_t* mixed_low_pass_data(int channel) const;
37  int16_t* low_pass_reference(int channel) const;
38
39  int32_t* analysis_filter_state1(int channel) const;
40  int32_t* analysis_filter_state2(int channel) const;
41  int32_t* synthesis_filter_state1(int channel) const;
42  int32_t* synthesis_filter_state2(int channel) const;
43
44  void set_activity(AudioFrame::VADActivity activity);
45  AudioFrame::VADActivity activity() const;
46
47  bool is_muted() const;
48
49  void DeinterleaveFrom(AudioFrame* audioFrame);
50  void InterleaveTo(AudioFrame* audioFrame) const;
51  // If |data_changed| is false, only the non-audio data members will be copied
52  // to |frame|.
53  void InterleaveTo(AudioFrame* frame, bool data_changed) const;
54  void Mix(int num_mixed_channels);
55  void CopyAndMix(int num_mixed_channels);
56  void CopyAndMixLowPass(int num_mixed_channels);
57  void CopyLowPassToReference();
58
59 private:
60  const int max_num_channels_;
61  int num_channels_;
62  int num_mixed_channels_;
63  int num_mixed_low_pass_channels_;
64  // Whether the original data was replaced with mixed data.
65  bool data_was_mixed_;
66  const int samples_per_channel_;
67  int samples_per_split_channel_;
68  bool reference_copied_;
69  AudioFrame::VADActivity activity_;
70  bool is_muted_;
71
72  int16_t* data_;
73  scoped_array<AudioChannel> channels_;
74  scoped_array<SplitAudioChannel> split_channels_;
75  scoped_array<AudioChannel> mixed_channels_;
76  // TODO(andrew): improve this, we don't need the full 32 kHz space here.
77  scoped_array<AudioChannel> mixed_low_pass_channels_;
78  scoped_array<AudioChannel> low_pass_reference_channels_;
79};
80}  // namespace webrtc
81
82#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_AUDIO_BUFFER_H_
Note: See TracBrowser for help on using the repository browser.