mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-02 03:47:42 +01:00
avoid off-by-one error when overwriting w/loop
This commit is contained in:
parent
7232ac2f67
commit
7660ea29d2
1 changed files with 9 additions and 1 deletions
|
|
@ -692,8 +692,16 @@ DiskReader::overwrite_existing_audio ()
|
|||
chunk1_offset = overwrite_offset;
|
||||
chunk1_cnt = min (c->front()->rbuf->bufsize() - overwrite_offset, to_overwrite);
|
||||
|
||||
/* note: because we are overwriting buffer contents but not moving the
|
||||
* write/read pointers, we do actually want to fill all the way to the
|
||||
* write pointer (the value given by PlaybackBuffer::overwritable_at().
|
||||
*
|
||||
* This differs from what happens during ::refill_audio() where we are
|
||||
* careful not to allow the read pointer to catch the write pointer
|
||||
* (that indicates an empty buffer)
|
||||
*/
|
||||
|
||||
if (chunk1_cnt == to_overwrite) {
|
||||
chunk1_cnt--;
|
||||
chunk2_cnt = 0;
|
||||
} else {
|
||||
chunk2_cnt = to_overwrite - chunk1_cnt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue