2 Copyright (C) 2009 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <glibmm/threads.h>
21 #include "ardour/internal_return.h"
22 #include "ardour/internal_send.h"
23 #include "ardour/route.h"
26 using namespace ARDOUR;
28 InternalReturn::InternalReturn (Session& s)
31 _display_to_user = false;
35 InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
37 if (!_active && !_pending_active) {
41 Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK);
44 for (list<InternalSend*>::iterator i = _sends.begin(); i != _sends.end(); ++i) {
45 if ((*i)->active () && (!(*i)->source_route() || (*i)->source_route()->active())) {
46 bufs.merge_from ((*i)->get_buffers(), nframes);
51 _active = _pending_active;
55 InternalReturn::add_send (InternalSend* send)
57 Glib::Threads::Mutex::Lock lm (_sends_mutex);
58 _sends.push_back (send);
62 InternalReturn::remove_send (InternalSend* send)
64 Glib::Threads::Mutex::Lock lm (_sends_mutex);
69 InternalReturn::state (bool full)
71 XMLNode& node (Return::state (full));
73 node.add_property("type", "intreturn");
78 InternalReturn::get_state()
84 InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out)
91 InternalReturn::configure_io (ChanCount in, ChanCount out)
93 IOProcessor::configure_io (in, out);