+ framepos_t output_buffer_position = 0;
+ framepos_t negative_output_buffer_position = 0;
+ if (_position >= _start) {
+ // handle resizing of beginnings of regions correctly
+ output_buffer_position = _position - _start;
+ } else {
+ // when _start is greater than _position, we have to subtract
+ // _start from the note times in the midi source
+ negative_output_buffer_position = _start;
+ }
+
+ /*cerr << "MR read @ " << position << " * " << to_read
+ << " _position = " << _position
+ << " _start = " << _start
+ << " offset = " << output_buffer_position
+ << " negoffset = " << negative_output_buffer_position
+ << " intoffset = " << internal_offset
+ << endl;*/
+
+ if (src->midi_read (
+ dst, // destination buffer
+ _position - _start, // start position of the source in this read context
+ _start + internal_offset, // where to start reading in the source
+ to_read, // read duration in frames
+ output_buffer_position, // the offset in the output buffer
+ negative_output_buffer_position, // amount to substract from note times
+ tracker
+ ) != to_read) {