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();
|
||||
ab.set_written (true);
|
||||
(*di)->write (port_buffer, samples);
|
||||
// TODO optimze, get_read_vector()
|
||||
for (uint32_t i = 0; i < samples; ++i) {
|
||||
Sample spl;
|
||||
(*di)->read (&spl, 1);
|
||||
_buffer[i] += spl;
|
||||
|
||||
PBD::RingBuffer<Sample>::rw_vector vec;
|
||||
(*di)->get_read_vector (&vec);
|
||||
assert (vec.len[0] + vec.len[1] >= samples);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user