13
0

Allow listening to channels being exported (w/ realtime export)

It would be nice to change get_audio_buffer() to not set
AudioBuffer::_written to false (all but one other user of this API also
only get read-only data), but that requires chaning the rationale of the
underlying ::set_data() API.
This commit is contained in:
Robin Gareus 2017-07-19 22:05:32 +02:00
parent 1438086c6c
commit 9992ea10b3

View File

@ -63,7 +63,9 @@ PortExportChannel::read (Sample const *& data, framecnt_t frames) const
if (ports.size() == 1) {
boost::shared_ptr<AudioPort> p = ports.begin()->lock ();
data = p->get_audio_buffer(frames).data();
AudioBuffer& ab (p->get_audio_buffer(frames)); // unsets AudioBuffer::_written
data = ab.data();
ab.set_written (true);
return;
}
@ -72,7 +74,9 @@ PortExportChannel::read (Sample const *& data, framecnt_t frames) const
for (PortSet::const_iterator it = ports.begin(); it != ports.end(); ++it) {
boost::shared_ptr<AudioPort> p = it->lock ();
if (p) {
Sample* port_buffer = p->get_audio_buffer(frames).data();
AudioBuffer& ab (p->get_audio_buffer(frames)); // unsets AudioBuffer::_written
Sample* port_buffer = ab.data();
ab.set_written (true);
for (uint32_t i = 0; i < frames; ++i) {
buffer[i] += (float) port_buffer[i];