2 Copyright (C) 1999-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 <boost/bind.hpp>
21 #include "pbd/error.h"
22 #include "pbd/compose.h"
24 #include "ardour/session.h"
25 #include "ardour/route.h"
26 #include "ardour/track.h"
32 using namespace ARDOUR;
36 Session::set_monitoring (boost::shared_ptr<RouteList> rl, MonitorChoice mc, SessionEvent::RTeventCallback after, bool group_override)
38 queue_event (get_rt_event (rl, mc, after, group_override, &Session::rt_set_monitoring));
42 Session::rt_set_monitoring (boost::shared_ptr<RouteList> rl, MonitorChoice mc, bool /* group_override */)
44 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
45 if (!(*i)->is_hidden()) {
46 boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (*i);
48 t->set_monitoring (mc);
57 Session::set_solo (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
59 queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo));
63 Session::rt_set_solo (boost::shared_ptr<RouteList> rl, bool yn, bool /* group_override */)
65 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
66 if (!(*i)->is_hidden()) {
67 (*i)->set_solo (yn, this);
75 Session::set_just_one_solo (boost::shared_ptr<Route> r, bool yn, SessionEvent::RTeventCallback after)
77 /* its a bit silly to have to do this, but it keeps the API for this public method sane (we're
78 only going to solo one route) and keeps our ability to use get_rt_event() for the internal
82 boost::shared_ptr<RouteList> rl (new RouteList);
85 queue_event (get_rt_event (rl, yn, after, false, &Session::rt_set_just_one_solo));
89 Session::rt_set_just_one_solo (boost::shared_ptr<RouteList> just_one, bool yn, bool /*ignored*/)
91 boost::shared_ptr<RouteList> rl = routes.reader ();
92 boost::shared_ptr<Route> r = just_one->front();
94 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
95 if (!(*i)->is_hidden() && r != *i) {
96 (*i)->set_solo (!yn, (*i)->route_group());
100 r->set_solo (yn, r->route_group());
106 Session::set_listen (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
108 queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_listen));
112 Session::rt_set_listen (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_override*/ )
114 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
115 if (!(*i)->is_hidden()) {
116 (*i)->set_listen (yn, this);
124 Session::set_mute (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
126 queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_mute));
130 Session::rt_set_mute (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_override*/)
132 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
133 if (!(*i)->is_hidden()) {
134 (*i)->set_mute (yn, this);
142 Session::set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
144 queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo_isolated));
148 Session::rt_set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_override*/)
150 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
151 if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden()) {
152 (*i)->set_solo_isolated (yn, this);
160 Session::set_record_enabled (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
166 queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_enabled));
170 Session::rt_set_record_enabled (boost::shared_ptr<RouteList> rl, bool yn, bool group_override)
172 for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
173 if ((*i)->is_hidden()) {
177 boost::shared_ptr<Track> t;
179 if ((t = boost::dynamic_pointer_cast<Track>(*i)) != 0) {
180 t->set_record_enabled (yn, (group_override ? (void*) t->route_group() : (void *) this));
188 Session::process_rtop (SessionEvent* ev)
192 if (ev->event_loop) {
193 ev->event_loop->call_slot (MISSING_INVALIDATOR, boost::bind (ev->rt_return, ev));
195 warning << string_compose ("programming error: %1", X_("Session RT event queued from thread without a UI - cleanup in RT thread!")) << endmsg;