aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cubeb_utils.h
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2016-02-15 10:43:52 +0100
committerPaul Adenot <[email protected]>2016-02-17 14:53:51 +0100
commit0af781aa95dac414a8c960d4524813bdf33a34db (patch)
treeccc9975592017ba9bc438d6524dc1a635fe975f5 /src/cubeb_utils.h
parent912097b84ef9683ac2d35fe61adedb8d88d5f672 (diff)
downloadcubeb-0af781aa95dac414a8c960d4524813bdf33a34db.tar.gz
cubeb-0af781aa95dac414a8c960d4524813bdf33a34db.zip
Address review comments.
Build system. Review comments: cubeb_resampler_speex_one_way ctor should take uint32_t. Review comments: Use the default device for test_record.cpp Review comments: use the correct path to include cubeb.h. Review comments: use std::unique_ptr instead of auto_ptr, and remove auto_ptr implementation. Review comments: Add test_duplex{,.exe} to .gitignore. Review comments: Formatting in noop_resampler::fill. Review comments: rename auto_array::resize to auto_array::reserve. Review comments: Rename the method that push silence in an auto_array push_silence. Review comments: Make test_duplex work with backend that use integers. Review comments: indent in cubeb_resampler.cpp. Review comments: call the target rate in the public interface of the resampler `target_rate`. Review comments: Clarify the comment on cubeb_speex_resampler_one_way::drain. Review comments: trailing space in cubeb_resampler_one_way::output assert. Review comments: space between T and *. Review comments: s/outut/output/. Review comments: return before {. Review comments: Use unique_ptr to create resampler objects. We can't really use std::move here, as we appear to target platforms that don't have it (Gecko on Android uses stlport that does not have std::move). Review comments: check that the delay lign creation succeeded. Review comments: Remove frame_count_at_rate. Review comments: assert speex resampling suceeds. Review comments: s/l atency/latency/. Review comments: Remove comment. Review comments: skip the tests that require an available audio input if none is available.
Diffstat (limited to 'src/cubeb_utils.h')
-rw-r--r--src/cubeb_utils.h35
1 files changed, 4 insertions, 31 deletions
diff --git a/src/cubeb_utils.h b/src/cubeb_utils.h
index 60d7d39..4f881f1 100644
--- a/src/cubeb_utils.h
+++ b/src/cubeb_utils.h
@@ -90,7 +90,7 @@ public:
* @returns false if the new capacity is not big enough to accomodate for the
* elements in the array.
*/
- bool resize(size_t new_capacity)
+ bool reserve(size_t new_capacity)
{
if (new_capacity < length_) {
return false;
@@ -114,7 +114,7 @@ public:
void push(const T * elements, size_t length)
{
if (length_ + length > capacity_) {
- resize(length_ + length);
+ reserve(length_ + length);
}
PodCopy(data_ + length_, elements, length);
length_ += length;
@@ -124,10 +124,10 @@ public:
* array if needed.
* @parameter length the number of elements to append to the array.
*/
- void push(size_t length)
+ void push_silence(size_t length)
{
if (length_ + length > capacity_) {
- resize(length + length_);
+ reserve(length + length_);
}
PodZero(data_ + length_, length);
length_ += length;
@@ -169,31 +169,4 @@ private:
size_t length_;
};
-template<typename T>
-class auto_ptr
-{
-public:
- auto_ptr(T * ptr)
- : ptr(ptr)
- {}
- ~auto_ptr()
- {
- delete ptr;
- }
- T * get() const
- {
- return ptr;
- }
- T* operator->() const {
- assert(ptr && "null pointer dereference.");
- return ptr;
- }
- operator bool() const
- {
- return !!ptr;
- }
-private:
- T * ptr;
-};
-
#endif /* CUBEB_UTILS */