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:
henrik.lundin@webrtc.org
2013-10-14 20:33:25 +00:00
parent fc89ba580b
commit 1871dd2fb7
8 changed files with 74 additions and 123 deletions

View File

@ -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);
};