Optimize stem and direct-out export
This commit is contained in:
parent
a1f40979bd
commit
a529122249
@ -120,12 +120,18 @@ PortExportChannel::read (Sample const *& data, samplecnt_t samples) const
|
|||||||
Sample* port_buffer = ab.data();
|
Sample* port_buffer = ab.data();
|
||||||
ab.set_written (true);
|
ab.set_written (true);
|
||||||
(*di)->write (port_buffer, samples);
|
(*di)->write (port_buffer, samples);
|
||||||
// TODO optimze, get_read_vector()
|
|
||||||
for (uint32_t i = 0; i < samples; ++i) {
|
PBD::RingBuffer<Sample>::rw_vector vec;
|
||||||
Sample spl;
|
(*di)->get_read_vector (&vec);
|
||||||
(*di)->read (&spl, 1);
|
assert (vec.len[0] + vec.len[1] >= samples);
|
||||||
_buffer[i] += spl;
|
|
||||||
|
samplecnt_t to_write = std::min (samples, (samplecnt_t) vec.len[0]);
|
||||||
|
mix_buffers_no_gain (&_buffer[0], vec.buf[0], to_write);
|
||||||
|
to_write = std::min (to_write - samples, (samplecnt_t) vec.len[1]);
|
||||||
|
if (to_write > 0) {
|
||||||
|
mix_buffers_no_gain (&_buffer[vec.len[0]], vec.buf[1], to_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
++di;
|
++di;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user