diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-01-30 07:40:13 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-01-30 07:40:13 +0000 |
commit | 70b939da4f9d4097160e32f2373a7a5ff8f4957f (patch) | |
tree | 5917e5847c75e441c9df550d5101352d18e8286f /libs/ardour/ardour/audio_buffer.h | |
parent | ee62ee07d39f51ba1b70f390dc2158c57f54a572 (diff) |
first pass at internal sends. this is a very tentative work in progress, and it is possible that major changes may follow in the near future. it is certainly not complete, but the fundamental changes to Port/Buffer operation merit a commit at this point
git-svn-id: svn://localhost/ardour2/branches/3.0@4464 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/audio_buffer.h')
-rw-r--r-- | libs/ardour/ardour/audio_buffer.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libs/ardour/ardour/audio_buffer.h b/libs/ardour/ardour/audio_buffer.h index 9a41e8e093..829288a7af 100644 --- a/libs/ardour/ardour/audio_buffer.h +++ b/libs/ardour/ardour/audio_buffer.h @@ -68,9 +68,14 @@ public: /** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset * scaling by @a gain_coeff */ void accumulate_with_gain_from(const AudioBuffer& src, nframes_t len, nframes_t offset, gain_t gain_coeff) { + assert(_capacity > 0); assert(offset + len <= _capacity); + if (src.silent()) { + return; + } + Sample* const dst_raw = _data + offset; const Sample* const src_raw = src.data(); @@ -82,6 +87,7 @@ public: /** Accumulate (add) @a len frames FROM THE START OF @a src into self at @a offset * scaling by @a gain_coeff */ void accumulate_with_gain_from(const Sample* src_raw, nframes_t len, nframes_t offset, gain_t gain_coeff) { + assert(_capacity > 0); assert(offset + len <= _capacity); @@ -123,7 +129,22 @@ public: Sample* data (nframes_t nframes, nframes_t offset) { assert(offset + nframes <= _capacity); return _data + offset; } -private: + void replace_data (size_t nframes); + + void drop_data () { + assert (_owns_data); + assert (_data); + + free (_data); + _data = 0; + _size = 0; + _capacity = 0; + _silent = false; + } + + void copy_to_internal (Sample* p, nframes_t cnt, nframes_t offset); + + private: bool _owns_data; Sample* _data; ///< Actual buffer contents }; |