Allow listening to channels being exported (w/ realtime export)
authorRobin Gareus <robin@gareus.org>
Wed, 19 Jul 2017 20:05:32 +0000 (22:05 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 19 Jul 2017 20:15:22 +0000 (22:15 +0200)
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.

libs/ardour/export_channel.cc

index 77fa80a9f6c8404f1028fd62853fcfd5f48fc675..5435d63c5294e18d8cd1f0b9f340f098be2ab8f9 100644 (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];