diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-04 14:21:35 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-02-04 14:21:35 -0500 |
commit | 2b9421fd391efcddde0be3397cb66e19b744a155 (patch) | |
tree | 9379555f58acff44337676416d229a0f4c0562e8 /libs/ardour/ardour | |
parent | c11bf0cc72669feea1a6c2071cef5255bbb1905a (diff) | |
parent | 4818621a2797871a10c47fc2f813e51668479fcc (diff) |
merge (w/fix) with master
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_buffer.h | 7 | ||||
-rw-r--r-- | libs/ardour/ardour/buffer.h | 12 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_buffer.h | 3 |
3 files changed, 7 insertions, 15 deletions
diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index a32e679b69..91f463cc7f 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -62,7 +62,7 @@ public: assert(&src != this); assert(_capacity > 0); assert(src.type() == DataType::AUDIO); - assert(len <= _capacity); + assert(dst_offset + len <= _capacity); assert( src_offset <= ((framecnt_t) src.capacity()-len)); memcpy(_data + dst_offset, ((const AudioBuffer&)src).data() + src_offset, sizeof(Sample) * len); if (dst_offset == 0 && src_offset == 0 && len == _capacity) { @@ -173,7 +173,6 @@ public: void set_data (Sample* data, size_t size) { assert(!_owns_data); // prevent leaks _capacity = size; - _size = size; _data = data; _silent = false; _written = false; @@ -185,8 +184,6 @@ public: */ void resize (size_t nframes); - bool empty() const { return _size == 0; } - const Sample* data (framecnt_t offset = 0) const { assert(offset <= _capacity); return _data + offset; @@ -198,7 +195,7 @@ public: return _data + offset; } - bool check_silence (pframes_t, bool, pframes_t&) const; + bool check_silence (pframes_t, pframes_t&) const; void prepare () { _written = false; _silent = false; } bool written() const { return _written; } diff --git a/libs/ardour/ardour/buffer.h b/libs/ardour/ardour/buffer.h index d6f333a5a1..8293a22beb 100644 --- a/libs/ardour/ardour/buffer.h +++ b/libs/ardour/ardour/buffer.h @@ -47,16 +47,9 @@ public: /** Factory function */ static Buffer* create(DataType type, size_t capacity); - /** Maximum capacity of buffer. - * Note in some cases the entire buffer may not contain valid data, use size. */ + /** Maximum capacity of buffer. */ size_t capacity() const { return _capacity; } - /** Amount of valid data in buffer. Use this over capacity almost always. */ - size_t size() const { return _size; } - - /** Return true if the buffer contains no data, false otherwise */ - virtual bool empty() const { return _size == 0; } - /** Type of this buffer. * Based on this you can static cast a Buffer* to the desired type. */ DataType type() const { return _type; } @@ -81,12 +74,11 @@ public: protected: Buffer(DataType type) - : _type(type), _capacity(0), _size(0), _silent (true) + : _type(type), _capacity(0), _silent (true) {} DataType _type; pframes_t _capacity; - pframes_t _size; bool _silent; }; diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h index 0a799c41ab..10105cfbb3 100644 --- a/libs/ardour/ardour/midi_buffer.h +++ b/libs/ardour/ardour/midi_buffer.h @@ -48,6 +48,8 @@ public: uint8_t* reserve(TimeType time, size_t size); void resize(size_t); + size_t size() const { return _size; } + bool empty() const { return _size == 0; } bool merge_in_place(const MidiBuffer &other); @@ -159,6 +161,7 @@ private: friend class iterator_base< const MidiBuffer, const Evoral::MIDIEvent<TimeType> >; uint8_t* _data; ///< timestamp, event, timestamp, event, ... + pframes_t _size; }; |