NetEq4: Removing templatization for AudioVector
This is the last CL for removing templates in Audio(Multi)Vector. BUG=1363 R=turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2341004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4960 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
fc89ba580b
commit
1871dd2fb7
@ -22,7 +22,7 @@ AudioMultiVector::AudioMultiVector(size_t N) {
|
||||
assert(N > 0);
|
||||
if (N < 1) N = 1;
|
||||
for (size_t n = 0; n < N; ++n) {
|
||||
channels_.push_back(new AudioVector<int16_t>);
|
||||
channels_.push_back(new AudioVector);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,12 +30,12 @@ AudioMultiVector::AudioMultiVector(size_t N, size_t initial_size) {
|
||||
assert(N > 0);
|
||||
if (N < 1) N = 1;
|
||||
for (size_t n = 0; n < N; ++n) {
|
||||
channels_.push_back(new AudioVector<int16_t>(initial_size));
|
||||
channels_.push_back(new AudioVector(initial_size));
|
||||
}
|
||||
}
|
||||
|
||||
AudioMultiVector::~AudioMultiVector() {
|
||||
std::vector<AudioVector<int16_t>*>::iterator it = channels_.begin();
|
||||
std::vector<AudioVector*>::iterator it = channels_.begin();
|
||||
while (it != channels_.end()) {
|
||||
delete (*it);
|
||||
++it;
|
||||
@ -196,11 +196,11 @@ bool AudioMultiVector::Empty() const {
|
||||
return channels_[0]->Empty();
|
||||
}
|
||||
|
||||
const AudioVector<int16_t>& AudioMultiVector::operator[](size_t index) const {
|
||||
const AudioVector& AudioMultiVector::operator[](size_t index) const {
|
||||
return *(channels_[index]);
|
||||
}
|
||||
|
||||
AudioVector<int16_t>& AudioMultiVector::operator[](size_t index) {
|
||||
AudioVector& AudioMultiVector::operator[](size_t index) {
|
||||
return *(channels_[index]);
|
||||
}
|
||||
|
||||
|
@ -119,11 +119,11 @@ class AudioMultiVector {
|
||||
|
||||
// Accesses and modifies a channel (i.e., an AudioVector object) of this
|
||||
// AudioMultiVector.
|
||||
const AudioVector<int16_t>& operator[](size_t index) const;
|
||||
AudioVector<int16_t>& operator[](size_t index);
|
||||
const AudioVector& operator[](size_t index) const;
|
||||
AudioVector& operator[](size_t index);
|
||||
|
||||
protected:
|
||||
std::vector<AudioVector<int16_t>*> channels_;
|
||||
std::vector<AudioVector*> channels_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioMultiVector);
|
||||
|
@ -89,7 +89,7 @@ TEST_P(AudioMultiVectorTest, SubscriptOperator) {
|
||||
for (size_t i = 0; i < array_length(); ++i) {
|
||||
vec[channel][i] = static_cast<int16_t>(i);
|
||||
// Make sure to use the const version.
|
||||
const AudioVector<int16_t>& audio_vec = vec[channel];
|
||||
const AudioVector& audio_vec = vec[channel];
|
||||
EXPECT_EQ(static_cast<int16_t>(i), audio_vec[i]);
|
||||
}
|
||||
}
|
||||
|
@ -18,53 +18,46 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::Clear() {
|
||||
void AudioVector::Clear() {
|
||||
vector_.clear();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::CopyFrom(AudioVector<T>* copy_to) const {
|
||||
void AudioVector::CopyFrom(AudioVector* copy_to) const {
|
||||
if (copy_to) {
|
||||
copy_to->vector_.assign(vector_.begin(), vector_.end());
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PushFront(const AudioVector<T>& prepend_this) {
|
||||
void AudioVector::PushFront(const AudioVector& prepend_this) {
|
||||
vector_.insert(vector_.begin(), prepend_this.vector_.begin(),
|
||||
prepend_this.vector_.end());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PushFront(const T* prepend_this, size_t length) {
|
||||
void AudioVector::PushFront(const int16_t* prepend_this, size_t length) {
|
||||
// Same operation as InsertAt beginning.
|
||||
InsertAt(prepend_this, length, 0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PushBack(const AudioVector<T>& append_this) {
|
||||
void AudioVector::PushBack(const AudioVector& append_this) {
|
||||
vector_.reserve(vector_.size() + append_this.Size());
|
||||
for (size_t i = 0; i < append_this.Size(); ++i) {
|
||||
vector_.push_back(append_this[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PushBack(const T* append_this, size_t length) {
|
||||
void AudioVector::PushBack(const int16_t* append_this, size_t length) {
|
||||
vector_.reserve(vector_.size() + length);
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
vector_.push_back(append_this[i]);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PopFront(size_t length) {
|
||||
void AudioVector::PopFront(size_t length) {
|
||||
if (length >= vector_.size()) {
|
||||
// Remove all elements.
|
||||
vector_.clear();
|
||||
} else {
|
||||
typename std::vector<T>::iterator end_range = vector_.begin();
|
||||
std::vector<int16_t>::iterator end_range = vector_.begin();
|
||||
end_range += length;
|
||||
// Erase all elements in range vector_.begin() and |end_range| (not
|
||||
// including |end_range|).
|
||||
@ -72,23 +65,20 @@ void AudioVector<T>::PopFront(size_t length) {
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::PopBack(size_t length) {
|
||||
void AudioVector::PopBack(size_t length) {
|
||||
// Make sure that new_size is never negative (which causes wrap-around).
|
||||
size_t new_size = vector_.size() - std::min(length, vector_.size());
|
||||
vector_.resize(new_size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::Extend(size_t extra_length) {
|
||||
void AudioVector::Extend(size_t extra_length) {
|
||||
vector_.insert(vector_.end(), extra_length, 0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::InsertAt(const T* insert_this,
|
||||
size_t length,
|
||||
size_t position) {
|
||||
typename std::vector<T>::iterator insert_position = vector_.begin();
|
||||
void AudioVector::InsertAt(const int16_t* insert_this,
|
||||
size_t length,
|
||||
size_t position) {
|
||||
std::vector<int16_t>::iterator insert_position = vector_.begin();
|
||||
// Cap the position at the current vector length, to be sure the iterator
|
||||
// does not extend beyond the end of the vector.
|
||||
position = std::min(vector_.size(), position);
|
||||
@ -102,10 +92,9 @@ void AudioVector<T>::InsertAt(const T* insert_this,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::InsertZerosAt(size_t length,
|
||||
size_t position) {
|
||||
typename std::vector<T>::iterator insert_position = vector_.begin();
|
||||
void AudioVector::InsertZerosAt(size_t length,
|
||||
size_t position) {
|
||||
std::vector<int16_t>::iterator insert_position = vector_.begin();
|
||||
// Cap the position at the current vector length, to be sure the iterator
|
||||
// does not extend beyond the end of the vector.
|
||||
position = std::min(vector_.size(), position);
|
||||
@ -115,10 +104,9 @@ void AudioVector<T>::InsertZerosAt(size_t length,
|
||||
vector_.insert(insert_position, length, 0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::OverwriteAt(const T* insert_this,
|
||||
size_t length,
|
||||
size_t position) {
|
||||
void AudioVector::OverwriteAt(const int16_t* insert_this,
|
||||
size_t length,
|
||||
size_t position) {
|
||||
// Cap the insert position at the current vector length.
|
||||
position = std::min(vector_.size(), position);
|
||||
// Extend the vector if needed. (It is valid to overwrite beyond the current
|
||||
@ -131,9 +119,8 @@ void AudioVector<T>::OverwriteAt(const T* insert_this,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void AudioVector<T>::CrossFade(const AudioVector<T>& append_this,
|
||||
size_t fade_length) {
|
||||
void AudioVector::CrossFade(const AudioVector& append_this,
|
||||
size_t fade_length) {
|
||||
// Fade length cannot be longer than the current vector or |append_this|.
|
||||
assert(fade_length <= Size());
|
||||
assert(fade_length <= append_this.Size());
|
||||
@ -158,49 +145,12 @@ void AudioVector<T>::CrossFade(const AudioVector<T>& append_this,
|
||||
PushBack(&append_this[fade_length], samples_to_push_back);
|
||||
}
|
||||
|
||||
// Template specialization for double. The only difference is in the calculation
|
||||
// of the cross-faded value, where we divide by 16384 instead of shifting with
|
||||
// 14 steps, and also not adding 8192 before scaling.
|
||||
template<>
|
||||
void AudioVector<double>::CrossFade(const AudioVector<double>& append_this,
|
||||
size_t fade_length) {
|
||||
// Fade length cannot be longer than the current vector or |append_this|.
|
||||
assert(fade_length <= Size());
|
||||
assert(fade_length <= append_this.Size());
|
||||
fade_length = std::min(fade_length, Size());
|
||||
fade_length = std::min(fade_length, append_this.Size());
|
||||
size_t position = Size() - fade_length;
|
||||
// Cross fade the overlapping regions.
|
||||
// |alpha| is the mixing factor in Q14.
|
||||
// TODO(hlundin): Consider skipping +1 in the denominator to produce a
|
||||
// smoother cross-fade, in particular at the end of the fade.
|
||||
int alpha_step = 16384 / (static_cast<int>(fade_length) + 1);
|
||||
int alpha = 16384;
|
||||
for (size_t i = 0; i < fade_length; ++i) {
|
||||
alpha -= alpha_step;
|
||||
vector_[position + i] = (alpha * vector_[position + i] +
|
||||
(16384 - alpha) * append_this[i]) / 16384;
|
||||
}
|
||||
assert(alpha >= 0); // Verify that the slope was correct.
|
||||
// Append what is left of |append_this|.
|
||||
size_t samples_to_push_back = append_this.Size() - fade_length;
|
||||
if (samples_to_push_back > 0)
|
||||
PushBack(&append_this[fade_length], samples_to_push_back);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& AudioVector<T>::operator[](size_t index) const {
|
||||
const int16_t& AudioVector::operator[](size_t index) const {
|
||||
return vector_[index];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& AudioVector<T>::operator[](size_t index) {
|
||||
int16_t& AudioVector::operator[](size_t index) {
|
||||
return vector_[index];
|
||||
}
|
||||
|
||||
// Instantiate the template for a few types.
|
||||
template class AudioVector<int16_t>;
|
||||
template class AudioVector<int32_t>;
|
||||
template class AudioVector<double>;
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -16,10 +16,10 @@
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/system_wrappers/interface/constructor_magic.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
template <typename T>
|
||||
class AudioVector {
|
||||
public:
|
||||
// Creates an empty AudioVector.
|
||||
@ -37,21 +37,21 @@ class AudioVector {
|
||||
// Copies all values from this vector to |copy_to|. Any contents in |copy_to|
|
||||
// are deleted before the copy operation. After the operation is done,
|
||||
// |copy_to| will be an exact replica of this object.
|
||||
virtual void CopyFrom(AudioVector<T>* copy_to) const;
|
||||
virtual void CopyFrom(AudioVector* copy_to) const;
|
||||
|
||||
// Prepends the contents of AudioVector |prepend_this| to this object. The
|
||||
// length of this object is increased with the length of |prepend_this|.
|
||||
virtual void PushFront(const AudioVector<T>& prepend_this);
|
||||
virtual void PushFront(const AudioVector& prepend_this);
|
||||
|
||||
// Same as above, but with an array |prepend_this| with |length| elements as
|
||||
// source.
|
||||
virtual void PushFront(const T* prepend_this, size_t length);
|
||||
virtual void PushFront(const int16_t* prepend_this, size_t length);
|
||||
|
||||
// Same as PushFront but will append to the end of this object.
|
||||
virtual void PushBack(const AudioVector<T>& append_this);
|
||||
virtual void PushBack(const AudioVector& append_this);
|
||||
|
||||
// Same as PushFront but will append to the end of this object.
|
||||
virtual void PushBack(const T* append_this, size_t length);
|
||||
virtual void PushBack(const int16_t* append_this, size_t length);
|
||||
|
||||
// Removes |length| elements from the beginning of this object.
|
||||
virtual void PopFront(size_t length);
|
||||
@ -67,7 +67,8 @@ class AudioVector {
|
||||
// them at |position|. The length of the AudioVector is increased by |length|.
|
||||
// |position| = 0 means that the new values are prepended to the vector.
|
||||
// |position| = Size() means that the new values are appended to the vector.
|
||||
virtual void InsertAt(const T* insert_this, size_t length, size_t position);
|
||||
virtual void InsertAt(const int16_t* insert_this, size_t length,
|
||||
size_t position);
|
||||
|
||||
// Like InsertAt, but inserts |length| zero elements at |position|.
|
||||
virtual void InsertZerosAt(size_t length, size_t position);
|
||||
@ -77,14 +78,14 @@ class AudioVector {
|
||||
// is the same as for InsertAt(). If |length| and |position| are selected
|
||||
// such that the new data extends beyond the end of the current AudioVector,
|
||||
// the vector is extended to accommodate the new data.
|
||||
virtual void OverwriteAt(const T* insert_this,
|
||||
virtual void OverwriteAt(const int16_t* insert_this,
|
||||
size_t length,
|
||||
size_t position);
|
||||
|
||||
// Appends |append_this| to the end of the current vector. Lets the two
|
||||
// vectors overlap by |fade_length| samples, and cross-fade linearly in this
|
||||
// region.
|
||||
virtual void CrossFade(const AudioVector<T>& append_this, size_t fade_length);
|
||||
virtual void CrossFade(const AudioVector& append_this, size_t fade_length);
|
||||
|
||||
// Returns the number of elements in this AudioVector.
|
||||
virtual size_t Size() const { return vector_.size(); }
|
||||
@ -93,11 +94,11 @@ class AudioVector {
|
||||
virtual bool Empty() const { return vector_.empty(); }
|
||||
|
||||
// Accesses and modifies an element of AudioVector.
|
||||
const T& operator[](size_t index) const;
|
||||
T& operator[](size_t index);
|
||||
const int16_t& operator[](size_t index) const;
|
||||
int16_t& operator[](size_t index);
|
||||
|
||||
private:
|
||||
std::vector<T> vector_;
|
||||
std::vector<int16_t> vector_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioVector);
|
||||
};
|
||||
|
@ -39,19 +39,19 @@ class AudioVectorTest : public ::testing::Test {
|
||||
// Create and destroy AudioVector objects, both empty and with a predefined
|
||||
// length.
|
||||
TEST_F(AudioVectorTest, CreateAndDestroy) {
|
||||
AudioVector<int16_t> vec1;
|
||||
AudioVector vec1;
|
||||
EXPECT_TRUE(vec1.Empty());
|
||||
EXPECT_EQ(0u, vec1.Size());
|
||||
|
||||
size_t initial_size = 17;
|
||||
AudioVector<int16_t> vec2(initial_size);
|
||||
AudioVector vec2(initial_size);
|
||||
EXPECT_FALSE(vec2.Empty());
|
||||
EXPECT_EQ(initial_size, vec2.Size());
|
||||
}
|
||||
|
||||
// Test the subscript operator [] for getting and setting.
|
||||
TEST_F(AudioVectorTest, SubscriptOperator) {
|
||||
AudioVector<int16_t> vec(array_length());
|
||||
AudioVector vec(array_length());
|
||||
for (size_t i = 0; i < array_length(); ++i) {
|
||||
vec[i] = static_cast<int16_t>(i);
|
||||
const int16_t& value = vec[i]; // Make sure to use the const version.
|
||||
@ -62,8 +62,8 @@ TEST_F(AudioVectorTest, SubscriptOperator) {
|
||||
// Test the PushBack method and the CopyFrom method. The Clear method is also
|
||||
// invoked.
|
||||
TEST_F(AudioVectorTest, PushBackAndCopy) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector<int16_t> vec_copy;
|
||||
AudioVector vec;
|
||||
AudioVector vec_copy;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec.CopyFrom(&vec_copy); // Copy from |vec| to |vec_copy|.
|
||||
ASSERT_EQ(array_length(), vec.Size());
|
||||
@ -84,8 +84,8 @@ TEST_F(AudioVectorTest, PushBackAndCopy) {
|
||||
|
||||
// Try to copy to a NULL pointer. Nothing should happen.
|
||||
TEST_F(AudioVectorTest, CopyToNull) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector<int16_t>* vec_copy = NULL;
|
||||
AudioVector vec;
|
||||
AudioVector* vec_copy = NULL;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec.CopyFrom(vec_copy);
|
||||
}
|
||||
@ -93,8 +93,8 @@ TEST_F(AudioVectorTest, CopyToNull) {
|
||||
// Test the PushBack method with another AudioVector as input argument.
|
||||
TEST_F(AudioVectorTest, PushBackVector) {
|
||||
static const size_t kLength = 10;
|
||||
AudioVector<int16_t> vec1(kLength);
|
||||
AudioVector<int16_t> vec2(kLength);
|
||||
AudioVector vec1(kLength);
|
||||
AudioVector vec2(kLength);
|
||||
// Set the first vector to [0, 1, ..., kLength - 1].
|
||||
// Set the second vector to [kLength, kLength + 1, ..., 2 * kLength - 1].
|
||||
for (size_t i = 0; i < kLength; ++i) {
|
||||
@ -111,7 +111,7 @@ TEST_F(AudioVectorTest, PushBackVector) {
|
||||
|
||||
// Test the PushFront method.
|
||||
TEST_F(AudioVectorTest, PushFront) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushFront(array_, array_length());
|
||||
ASSERT_EQ(array_length(), vec.Size());
|
||||
for (size_t i = 0; i < array_length(); ++i) {
|
||||
@ -122,8 +122,8 @@ TEST_F(AudioVectorTest, PushFront) {
|
||||
// Test the PushFront method with another AudioVector as input argument.
|
||||
TEST_F(AudioVectorTest, PushFrontVector) {
|
||||
static const size_t kLength = 10;
|
||||
AudioVector<int16_t> vec1(kLength);
|
||||
AudioVector<int16_t> vec2(kLength);
|
||||
AudioVector vec1(kLength);
|
||||
AudioVector vec2(kLength);
|
||||
// Set the first vector to [0, 1, ..., kLength - 1].
|
||||
// Set the second vector to [kLength, kLength + 1, ..., 2 * kLength - 1].
|
||||
for (size_t i = 0; i < kLength; ++i) {
|
||||
@ -140,7 +140,7 @@ TEST_F(AudioVectorTest, PushFrontVector) {
|
||||
|
||||
// Test the PopFront method.
|
||||
TEST_F(AudioVectorTest, PopFront) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec.PopFront(1); // Remove one element.
|
||||
EXPECT_EQ(array_length() - 1u, vec.Size());
|
||||
@ -153,7 +153,7 @@ TEST_F(AudioVectorTest, PopFront) {
|
||||
|
||||
// Test the PopBack method.
|
||||
TEST_F(AudioVectorTest, PopBack) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec.PopBack(1); // Remove one element.
|
||||
EXPECT_EQ(array_length() - 1u, vec.Size());
|
||||
@ -166,7 +166,7 @@ TEST_F(AudioVectorTest, PopBack) {
|
||||
|
||||
// Test the Extend method.
|
||||
TEST_F(AudioVectorTest, Extend) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec.Extend(5); // Extend with 5 elements, which should all be zeros.
|
||||
ASSERT_EQ(array_length() + 5u, vec.Size());
|
||||
@ -178,7 +178,7 @@ TEST_F(AudioVectorTest, Extend) {
|
||||
|
||||
// Test the InsertAt method with an insert position in the middle of the vector.
|
||||
TEST_F(AudioVectorTest, InsertAt) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -209,8 +209,8 @@ TEST_F(AudioVectorTest, InsertAt) {
|
||||
// Test the InsertZerosAt method with an insert position in the middle of the
|
||||
// vector. Use the InsertAt method as reference.
|
||||
TEST_F(AudioVectorTest, InsertZerosAt) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector<int16_t> vec_ref;
|
||||
AudioVector vec;
|
||||
AudioVector vec_ref;
|
||||
vec.PushBack(array_, array_length());
|
||||
vec_ref.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
@ -227,7 +227,7 @@ TEST_F(AudioVectorTest, InsertZerosAt) {
|
||||
|
||||
// Test the InsertAt method with an insert position at the start of the vector.
|
||||
TEST_F(AudioVectorTest, InsertAtBeginning) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -253,7 +253,7 @@ TEST_F(AudioVectorTest, InsertAtBeginning) {
|
||||
|
||||
// Test the InsertAt method with an insert position at the end of the vector.
|
||||
TEST_F(AudioVectorTest, InsertAtEnd) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -282,7 +282,7 @@ TEST_F(AudioVectorTest, InsertAtEnd) {
|
||||
// input position. That is, the input position should be capped at the maximum
|
||||
// allowed value.
|
||||
TEST_F(AudioVectorTest, InsertBeyondEnd) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -308,7 +308,7 @@ TEST_F(AudioVectorTest, InsertBeyondEnd) {
|
||||
// Test the OverwriteAt method with a position such that all of the new values
|
||||
// fit within the old vector.
|
||||
TEST_F(AudioVectorTest, OverwriteAt) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -338,7 +338,7 @@ TEST_F(AudioVectorTest, OverwriteAt) {
|
||||
// extend beyond the end of the current vector. This is valid, and the vector is
|
||||
// expected to expand to accommodate the new values.
|
||||
TEST_F(AudioVectorTest, OverwriteBeyondEnd) {
|
||||
AudioVector<int16_t> vec;
|
||||
AudioVector vec;
|
||||
vec.PushBack(array_, array_length());
|
||||
static const int kNewLength = 5;
|
||||
int16_t new_array[kNewLength];
|
||||
@ -367,8 +367,8 @@ TEST_F(AudioVectorTest, OverwriteBeyondEnd) {
|
||||
TEST_F(AudioVectorTest, CrossFade) {
|
||||
static const size_t kLength = 100;
|
||||
static const size_t kFadeLength = 10;
|
||||
AudioVector<int16_t> vec1(kLength);
|
||||
AudioVector<int16_t> vec2(kLength);
|
||||
AudioVector vec1(kLength);
|
||||
AudioVector vec2(kLength);
|
||||
// Set all vector elements to 0 in |vec1| and 100 in |vec2|.
|
||||
for (size_t i = 0; i < kLength; ++i) {
|
||||
vec1[i] = 0;
|
||||
|
@ -116,8 +116,8 @@ class Expand {
|
||||
int16_t ar_gain_scale;
|
||||
int16_t voice_mix_factor; /* Q14 */
|
||||
int16_t current_voice_mix_factor; /* Q14 */
|
||||
AudioVector<int16_t> expand_vector0;
|
||||
AudioVector<int16_t> expand_vector1;
|
||||
AudioVector expand_vector0;
|
||||
AudioVector expand_vector1;
|
||||
bool onset;
|
||||
int16_t mute_slope; /* Q20 */
|
||||
};
|
||||
|
@ -78,7 +78,7 @@ class SyncBuffer : public AudioMultiVector {
|
||||
// created.
|
||||
void Flush();
|
||||
|
||||
const AudioVector<int16_t>& Channel(size_t n) { return *channels_[n]; }
|
||||
const AudioVector& Channel(size_t n) { return *channels_[n]; }
|
||||
|
||||
// Accessors and mutators.
|
||||
size_t next_index() const { return next_index_; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user