DCPOMATIC_ASSERT (from);
DCPOMATIC_ASSERT (read_offset >= 0 && (read_offset + frames_to_copy) <= from->_allocated_frames);
- DCPOMATIC_ASSERT (write_offset >= 0 && (write_offset + frames_to_copy) <= _allocated_frames);
+ if (write_offset < 0 || (write_offset + frames_to_copy) > _allocated_frames) {
+ throw ProgrammingError(
+ __FILE__, __LINE__,
+ String::compose("frames_to_copy=%1, read_offset=%2, write_offset=%3", frames_to_copy, read_offset, write_offset)
+ );
+ }
for (int i = 0; i < _channels; ++i) {
memcpy (_data[i] + write_offset, from->_data[i] + read_offset, frames_to_copy * sizeof(float));
}
/** Add data from from `from', `from_channel' to our channel `to_channel'.
+ * @param from Buffers to copy data from.
+ * @param from_channel Channel index to read in \p from.
+ * @param to_channel Channel index to accumulate into.
* @param gain Linear gain to apply to the data before it is added.
*/
void