2009-06-16 10:58:33 -04:00
|
|
|
/*
|
2019-08-02 22:01:25 -04:00
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2013-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2009-06-16 10:58:33 -04:00
|
|
|
|
2012-07-25 13:48:55 -04:00
|
|
|
#include <glibmm/threads.h>
|
2009-06-16 10:58:33 -04:00
|
|
|
|
|
|
|
#include "ardour/internal_return.h"
|
2011-02-19 19:55:52 -05:00
|
|
|
#include "ardour/internal_send.h"
|
2014-06-22 18:48:47 -04:00
|
|
|
#include "ardour/route.h"
|
2009-06-16 10:58:33 -04:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2023-07-21 11:56:42 -04:00
|
|
|
InternalReturn::InternalReturn (Session& s, Temporal::TimeDomainProvider const & tdp, std::string const& name)
|
|
|
|
: Processor (s, name, tdp)
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
2019-09-21 22:15:01 -04:00
|
|
|
_display_to_user = false;
|
2009-06-16 10:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
InternalReturn::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
2021-11-24 12:28:16 -05:00
|
|
|
if (!check_active()) {
|
2009-07-21 10:39:21 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-07-25 13:48:55 -04:00
|
|
|
Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK);
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2019-09-21 22:15:01 -04:00
|
|
|
if (!lm.locked ()) {
|
|
|
|
return;
|
2009-06-16 10:58:33 -04:00
|
|
|
}
|
|
|
|
|
2024-04-02 20:08:11 -04:00
|
|
|
for (auto & send : _sends) {
|
|
|
|
if (send->active () && (!send->source_route() || send->source_route()->active())) {
|
|
|
|
bufs.merge_from (send->get_buffers(), nframes);
|
2019-09-21 22:15:01 -04:00
|
|
|
}
|
|
|
|
}
|
2009-06-16 10:58:33 -04:00
|
|
|
}
|
|
|
|
|
2011-02-19 19:55:52 -05:00
|
|
|
void
|
|
|
|
InternalReturn::add_send (InternalSend* send)
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
2012-07-25 13:48:55 -04:00
|
|
|
Glib::Threads::Mutex::Lock lm (_sends_mutex);
|
2011-02-19 19:55:52 -05:00
|
|
|
_sends.push_back (send);
|
2009-06-16 10:58:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-02-19 19:55:52 -05:00
|
|
|
InternalReturn::remove_send (InternalSend* send)
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
2012-07-25 13:48:55 -04:00
|
|
|
Glib::Threads::Mutex::Lock lm (_sends_mutex);
|
2011-02-19 19:55:52 -05:00
|
|
|
_sends.remove (send);
|
2009-06-16 10:58:33 -04:00
|
|
|
}
|
|
|
|
|
2017-09-28 10:06:57 -04:00
|
|
|
void
|
|
|
|
InternalReturn::set_playback_offset (samplecnt_t cnt)
|
|
|
|
{
|
|
|
|
Processor::set_playback_offset (cnt);
|
|
|
|
|
|
|
|
Glib::Threads::Mutex::Lock lm (_sends_mutex); // TODO reader lock
|
|
|
|
for (list<InternalSend*>::iterator i = _sends.begin(); i != _sends.end(); ++i) {
|
|
|
|
(*i)->set_delay_out (cnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-16 10:58:33 -04:00
|
|
|
XMLNode&
|
2022-04-06 23:56:32 -04:00
|
|
|
InternalReturn::state () const
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
2021-01-31 21:17:30 -05:00
|
|
|
XMLNode& node (Processor::state ());
|
2009-06-16 10:58:33 -04:00
|
|
|
/* override type */
|
2016-08-27 20:44:56 -04:00
|
|
|
node.set_property("type", "intreturn");
|
2009-06-16 10:58:33 -04:00
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
bool
|
2013-08-01 21:39:00 -04:00
|
|
|
InternalReturn::can_support_io_configuration (const ChanCount& in, ChanCount& out)
|
2009-06-16 10:58:33 -04:00
|
|
|
{
|
|
|
|
out = in;
|
|
|
|
return true;
|
|
|
|
}
|
2011-12-09 09:10:33 -05:00
|
|
|
|
|
|
|
bool
|
|
|
|
InternalReturn::configure_io (ChanCount in, ChanCount out)
|
|
|
|
{
|
2021-01-31 21:17:30 -05:00
|
|
|
Processor::configure_io (in, out);
|
2011-12-09 09:10:33 -05:00
|
|
|
return true;
|
|
|
|
}
|