midiregion: remove internal_offset local variable

Even in 6.9, the logic of this conditional would always generate an
internal_offset value of zero samples.
This commit is contained in:
Paul Davis 2021-10-25 13:55:03 -06:00
parent 54f5c65f02
commit 787e5a2ea8

View File

@ -294,8 +294,6 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
timecnt_t const & read_length,
MidiChannelFilter* filter) const
{
timecnt_t internal_offset;
/* precondition: caller has verified that we cover the desired section */
assert(chan_n == 0);
@ -304,22 +302,6 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
return 0; /* read nothing */
}
/* render() pulls from zero to infinity ... */
if (!position().zero()) {
/* we are starting the read from before the start of the region */
internal_offset = timecnt_t (Temporal::BeatTime);
} else {
/* we are starting the read from after the start of the region */
internal_offset = timecnt_t (-position());
}
cerr << "RENDER , iffoset " << internal_offset << endl;
if (internal_offset >= _length) {
return 0; /* read nothing */
}
boost::shared_ptr<MidiSource> src = midi_source(chan_n);
Glib::Threads::Mutex::Lock lm(src->mutex());
@ -330,11 +312,9 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
cerr << "MR " << name () << " render "
<< " _position = " << _position
<< " _start = " << _start
<< " intoffset = " << internal_offset
<< " quarter_note = " << quarter_note()
<< " start_beat = " << _start_beats
<< " a1 " << _position - _start
<< " a2 " << _start + internal_offset
<< " a3 " << _length
<< endl;
#endif
@ -348,7 +328,7 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
lm, // source lock
dst, // destination buffer
this->source_position(), // start position of the source in session samples
read_start + internal_offset,
read_start,
read_length,
0,
cursor,
@ -360,7 +340,7 @@ MidiRegion::render_range (Evoral::EventSink<samplepos_t>& dst,
* Note-Off's get inserted at the end of the region
*/
const timepos_t end = source_position() + read_start + internal_offset + read_length;
const timepos_t end = source_position() + read_start + read_length;
tracker.resolve_notes (dst, end.samples());
return 0;