diff options
author | Carl Hetherington <carl@carlh.net> | 2011-08-09 12:53:24 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-08-09 12:53:24 +0000 |
commit | 7aac277ce1843676084c07365104ee5ac9210695 (patch) | |
tree | 669bc4824b72ffd0eb8c6d24eae09f4656719d5a /libs/ardour/audioregion.cc | |
parent | 2b2d49fffae72bd2081e783ebe1fc3064b79653f (diff) |
Add a few asserts.
git-svn-id: svn://localhost/ardour2/branches/3.0@9966 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audioregion.cc')
-rw-r--r-- | libs/ardour/audioregion.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index c0de894e7d..4e02c83ed5 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -364,10 +364,13 @@ AudioRegion::master_read_at (Sample *buf, Sample *mixdown_buffer, float *gain_bu { /* do not read gain/scaling/fades and do not count this disk i/o in statistics */ + assert (cnt >= 0); + return _read_at (_master_sources, _master_sources.front()->length(_master_sources.front()->timeline_position()), buf, mixdown_buffer, gain_buffer, position, cnt, chan_n, ReadOps (0)); } +/** @param position Position within the session */ framecnt_t AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit, Sample *buf, Sample *mixdown_buffer, float *gain_buffer, @@ -376,6 +379,8 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit, uint32_t chan_n, ReadOps rops) const { + assert (cnt >= 0); + frameoffset_t internal_offset; frameoffset_t buf_offset; framecnt_t to_read; @@ -394,6 +399,9 @@ AudioRegion::_read_at (const SourceList& srcs, framecnt_t limit, if (position < _position) { internal_offset = 0; buf_offset = _position - position; + /* if this fails then the requested section is entirely + before the position of this region */ + assert (cnt >= buf_offset); cnt -= buf_offset; } else { internal_offset = position - _position; |