summaryrefslogtreecommitdiff
path: root/libs/ardour/internal_send.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-02-20 00:55:52 +0000
committerCarl Hetherington <carl@carlh.net>2011-02-20 00:55:52 +0000
commit8f0750cc7e2a9c9d7c7a8c75a6df332c465a5292 (patch)
tree965efe70a7adc6378a7920586c6a1502daec57be /libs/ardour/internal_send.cc
parent13232d03f3e5f8a5d7d19392c26c27ce0327250c (diff)
Make InternalReturns collect their sends' data on the return's ::run(), rather than sends merging data with the InternalReturn on their ::run(). This makes internal send/return thread-safe so that N routes can send to 1 whilst they are being run in parallel process threads.
git-svn-id: svn://localhost/ardour2/branches/3.0@8904 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/internal_send.cc')
-rw-r--r--libs/ardour/internal_send.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 4c3b385304..bdfcf6d249 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -34,7 +34,6 @@ using namespace std;
InternalSend::InternalSend (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> mm, boost::shared_ptr<Route> sendto, Delivery::Role role)
: Send (s, p, mm, role)
- , target (0)
{
if (sendto) {
if (use_target (sendto)) {
@@ -46,18 +45,20 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<Pannable> p, boost::sh
InternalSend::~InternalSend ()
{
if (_send_to) {
- _send_to->release_return_buffer ();
+ _send_to->remove_send_from_internal_return (this);
}
}
int
InternalSend::use_target (boost::shared_ptr<Route> sendto)
{
+ if (_send_to) {
+ _send_to->remove_send_from_internal_return (this);
+ }
+
_send_to = sendto;
- if ((target = _send_to->get_return_buffer ()) == 0) {
- return -1;
- }
+ _send_to->add_send_to_internal_return (this);
set_name (sendto->name());
_send_to_id = _send_to->id();
@@ -74,7 +75,6 @@ InternalSend::use_target (boost::shared_ptr<Route> sendto)
void
InternalSend::send_to_going_away ()
{
- target = 0;
target_connections.drop_connections ();
_send_to.reset ();
_send_to_id = "0";
@@ -83,7 +83,7 @@ InternalSend::send_to_going_away ()
void
InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
{
- if ((!_active && !_pending_active) || !target || !_send_to) {
+ if ((!_active && !_pending_active) || !_send_to) {
_meter->reset ();
return;
}
@@ -138,9 +138,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
}
}
- /* deliver to target */
-
- target->merge_from (mixbufs, nframes);
+ /* target will pick up our output when it is ready */
out:
_active = _pending_active;
@@ -150,11 +148,6 @@ int
InternalSend::set_block_size (pframes_t nframes)
{
mixbufs.ensure_buffers (_configured_input, nframes);
-
- /* ensure that our target can cope with us merging this many frames to it */
- if (target) {
- target->ensure_buffers (_configured_input, nframes);
- }
return 0;
}