From bfacaabfce3cee012672d8fcf15326e248261996 Mon Sep 17 00:00:00 2001 From: "claguna@google.com" Date: Thu, 25 Sep 2014 20:52:08 +0000 Subject: [PATCH] Add accessors for array of channel pointers in AudioBuffer. They are needed as arguments to any multichannel audio processing unit. R=andrew@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/30499004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7303 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../modules/audio_processing/audio_buffer.cc | 34 +++++++++++++++++++ .../modules/audio_processing/audio_buffer.h | 11 +++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc index 2bbd7710eb..8aff61cc26 100644 --- a/webrtc/modules/audio_processing/audio_buffer.cc +++ b/webrtc/modules/audio_processing/audio_buffer.cc @@ -289,6 +289,15 @@ float* AudioBuffer::data_f(int channel) { return channels_->fbuf()->channel(channel); } +const float* const* AudioBuffer::channels_f() const { + return channels_->fbuf_const()->channels(); +} + +float* const* AudioBuffer::channels_f() { + mixed_low_pass_valid_ = false; + return channels_->fbuf()->channels(); +} + const int16_t* AudioBuffer::low_pass_split_data(int channel) const { return split_channels_low_.get() ? split_channels_low_->ibuf_const()->channel(channel) @@ -315,6 +324,19 @@ float* AudioBuffer::low_pass_split_data_f(int channel) { : data_f(channel); } +const float* const* AudioBuffer::low_pass_split_channels_f() const { + return split_channels_low_.get() + ? split_channels_low_->fbuf_const()->channels() + : channels_f(); +} + +float* const* AudioBuffer::low_pass_split_channels_f() { + mixed_low_pass_valid_ = false; + return split_channels_low_.get() + ? split_channels_low_->fbuf()->channels() + : channels_f(); +} + const int16_t* AudioBuffer::high_pass_split_data(int channel) const { return split_channels_high_.get() ? split_channels_high_->ibuf_const()->channel(channel) @@ -339,6 +361,18 @@ float* AudioBuffer::high_pass_split_data_f(int channel) { : NULL; } +const float* const* AudioBuffer::high_pass_split_channels_f() const { + return split_channels_high_.get() + ? split_channels_high_->fbuf_const()->channels() + : NULL; +} + +float* const* AudioBuffer::high_pass_split_channels_f() { + return split_channels_high_.get() + ? split_channels_high_->fbuf()->channels() + : NULL; +} + const int16_t* AudioBuffer::mixed_low_pass_data() { // Currently only mixing stereo to mono is supported. assert(num_proc_channels_ == 1 || num_proc_channels_ == 2); diff --git a/webrtc/modules/audio_processing/audio_buffer.h b/webrtc/modules/audio_processing/audio_buffer.h index acf5753cbb..12a99eccdc 100644 --- a/webrtc/modules/audio_processing/audio_buffer.h +++ b/webrtc/modules/audio_processing/audio_buffer.h @@ -63,7 +63,7 @@ class AudioBuffer { int16_t* low_pass_split_data(int channel); const int16_t* low_pass_split_data(int channel) const; int16_t* high_pass_split_data(int channel); - const int16_t* high_pass_split_data(int channel) const; + const int16_t* high_pass_split_data(int channel) const;\ // Returns a pointer to the low-pass data downmixed to mono. If this data // isn't already available it re-calculates it. const int16_t* mixed_low_pass_data(); @@ -73,11 +73,20 @@ class AudioBuffer { // as necessary. The range of the numbers are the same as for int16_t. float* data_f(int channel); const float* data_f(int channel) const; + + float* const* channels_f(); + const float* const* channels_f() const; + float* low_pass_split_data_f(int channel); const float* low_pass_split_data_f(int channel) const; float* high_pass_split_data_f(int channel); const float* high_pass_split_data_f(int channel) const; + float* const* low_pass_split_channels_f(); + const float* const* low_pass_split_channels_f() const; + float* const* high_pass_split_channels_f(); + const float* const* high_pass_split_channels_f() const; + const float* keyboard_data() const; SplitFilterStates* filter_states(int channel);