ardour
internal_return.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Paul Davis
3 
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.
8 
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.
13 
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.
17 */
18 
19 #include <glibmm/threads.h>
20 
21 #include "ardour/internal_return.h"
22 #include "ardour/internal_send.h"
23 #include "ardour/route.h"
24 
25 using namespace std;
26 using namespace ARDOUR;
27 
28 InternalReturn::InternalReturn (Session& s)
29  : Return (s, true)
30 {
31  _display_to_user = false;
32 }
33 
34 void
35 InternalReturn::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
36 {
37  if (!_active && !_pending_active) {
38  return;
39  }
40 
41  Glib::Threads::Mutex::Lock lm (_sends_mutex, Glib::Threads::TRY_LOCK);
42 
43  if (lm.locked ()) {
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);
47  }
48  }
49  }
50 
52 }
53 
54 void
56 {
58  _sends.push_back (send);
59 }
60 
61 void
63 {
65  _sends.remove (send);
66 }
67 
68 XMLNode&
70 {
71  XMLNode& node (Return::state (full));
72  /* override type */
73  node.add_property("type", "intreturn");
74  return node;
75 }
76 
77 XMLNode&
79 {
80  return state (true);
81 }
82 
83 bool
85 {
86  out = in;
87  return true;
88 }
89 
90 bool
92 {
93  IOProcessor::configure_io (in, out);
94  return true;
95 }
void add_send(InternalSend *)
Glib::Threads::Mutex _sends_mutex
uint32_t pframes_t
Definition: types.h:61
Definition: Beats.hpp:239
XMLNode & state(bool full)
bool configure_io(ChanCount, ChanCount)
bool can_support_io_configuration(const ChanCount &in, ChanCount &out)
Definition: amp.h:29
std::list< InternalSend * > _sends
virtual bool configure_io(ChanCount in, ChanCount out)
Definition: processor.cc:246
void remove_send(InternalSend *)
int64_t framepos_t
Definition: types.h:66
XMLProperty * add_property(const char *name, const std::string &value)
void merge_from(const BufferSet &in, framecnt_t nframes)
Definition: buffer_set.cc:445
Definition: xml++.h:95
XMLNode & state(bool full)
Definition: return.cc:68
void run(BufferSet &bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)