Add a few asserts.
git-svn-id: svn://localhost/ardour2/branches/3.0@9966 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
2b2d49fffa
commit
7aac277ce1
@ -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;
|
||||
|
@ -287,6 +287,8 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
|
||||
framecnt_t
|
||||
AudioSource::read (Sample *dst, framepos_t start, framecnt_t cnt, int /*channel*/) const
|
||||
{
|
||||
assert (cnt >= 0);
|
||||
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
return read_unlocked (dst, start, cnt);
|
||||
}
|
||||
|
@ -269,6 +269,8 @@ SndFileSource::sample_rate () const
|
||||
framecnt_t
|
||||
SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const
|
||||
{
|
||||
assert (cnt >= 0);
|
||||
|
||||
int32_t nread;
|
||||
float *ptr;
|
||||
uint32_t real_cnt;
|
||||
@ -306,6 +308,8 @@ SndFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con
|
||||
file_cnt = cnt;
|
||||
}
|
||||
|
||||
assert (file_cnt >= 0);
|
||||
|
||||
if (file_cnt != cnt) {
|
||||
framepos_t delta = cnt - file_cnt;
|
||||
memset (dst+file_cnt, 0, sizeof (Sample) * delta);
|
||||
|
Loading…
Reference in New Issue
Block a user