Refactor Solo/Mute release
This is in preparation to move RoueUI::SoloMuteRelease to libardour to reuse the implementation in various places. This also prepares the solo logic for exclusive port-monitoring.
This commit is contained in:
parent
ecdaf7136d
commit
f2d2ea4baa
59
libs/ardour/ardour/solo_mute_release.h
Normal file
59
libs/ardour/ardour/solo_mute_release.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2000-2019 Paul Davis <paul@linuxaudiosystems.com>
|
||||||
|
* Copyright (C) 2012-2021 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ardour_solo_mute_release_h_
|
||||||
|
#define _ardour_solo_mute_release_h_
|
||||||
|
|
||||||
|
#ifdef WAF_BUILD
|
||||||
|
#include "libardour-config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ardour/libardour_visibility.h"
|
||||||
|
#include "ardour/types.h"
|
||||||
|
|
||||||
|
namespace ARDOUR {
|
||||||
|
|
||||||
|
class Session;
|
||||||
|
|
||||||
|
class LIBARDOUR_API SoloMuteRelease
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SoloMuteRelease (bool was_active);
|
||||||
|
|
||||||
|
void set_exclusive (bool exclusive = true);
|
||||||
|
|
||||||
|
void set (boost::shared_ptr<Route>);
|
||||||
|
void set (boost::shared_ptr<RouteList>);
|
||||||
|
void set (boost::shared_ptr<RouteList>, boost::shared_ptr<RouteList>);
|
||||||
|
void set (boost::shared_ptr<std::list<std::string> >);
|
||||||
|
|
||||||
|
void release (Session*, bool mute) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool active;
|
||||||
|
bool exclusive;
|
||||||
|
|
||||||
|
boost::shared_ptr<RouteList> routes_on;
|
||||||
|
boost::shared_ptr<RouteList> routes_off;
|
||||||
|
|
||||||
|
boost::shared_ptr<std::list<std::string> > port_monitors;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ARDOUR
|
||||||
|
#endif
|
87
libs/ardour/solo_mute_release.cc
Normal file
87
libs/ardour/solo_mute_release.cc
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2000-2019 Paul Davis <paul@linuxaudiosystems.com>
|
||||||
|
* Copyright (C) 2012-2021 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pbd/controllable.h"
|
||||||
|
|
||||||
|
#include "ardour/audioengine.h"
|
||||||
|
#include "ardour/session.h"
|
||||||
|
#include "ardour/solo_mute_release.h"
|
||||||
|
#include "ardour/utils.h"
|
||||||
|
|
||||||
|
using namespace PBD;
|
||||||
|
using namespace ARDOUR;
|
||||||
|
|
||||||
|
SoloMuteRelease::SoloMuteRelease (bool was_active)
|
||||||
|
: active (was_active)
|
||||||
|
, exclusive (false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::set_exclusive (bool e)
|
||||||
|
{
|
||||||
|
exclusive = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::set (boost::shared_ptr<Route> r)
|
||||||
|
{
|
||||||
|
if (active) {
|
||||||
|
routes_on.reset (new RouteList);
|
||||||
|
routes_on->push_back (r);
|
||||||
|
} else {
|
||||||
|
routes_off.reset (new RouteList);
|
||||||
|
routes_off->push_back (r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::set (boost::shared_ptr<RouteList> rl)
|
||||||
|
{
|
||||||
|
if (active) {
|
||||||
|
routes_on = rl;
|
||||||
|
} else {
|
||||||
|
routes_off = rl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::set (boost::shared_ptr<RouteList> on, boost::shared_ptr<RouteList> off)
|
||||||
|
{
|
||||||
|
routes_on = on;
|
||||||
|
routes_off = off;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::set (boost::shared_ptr<std::list<std::string> > pml)
|
||||||
|
{
|
||||||
|
port_monitors = pml;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SoloMuteRelease::release (Session* s, bool mute) const
|
||||||
|
{
|
||||||
|
if (mute) {
|
||||||
|
s->set_controls (route_list_to_control_list (routes_off, &Stripable::mute_control), 0.0, exclusive ? Controllable::NoGroup : Controllable::UseGroup);
|
||||||
|
s->set_controls (route_list_to_control_list (routes_on, &Stripable::mute_control), 1.0, exclusive ? Controllable::NoGroup : Controllable::UseGroup);
|
||||||
|
} else {
|
||||||
|
s->set_controls (route_list_to_control_list (routes_off, &Stripable::solo_control), 0.0, exclusive ? Controllable::NoGroup : Controllable::UseGroup);
|
||||||
|
s->set_controls (route_list_to_control_list (routes_on, &Stripable::solo_control), 1.0, exclusive ? Controllable::NoGroup : Controllable::UseGroup);
|
||||||
|
}
|
||||||
|
}
|
@ -236,6 +236,7 @@ libardour_sources = [
|
|||||||
'sndfilesource.cc',
|
'sndfilesource.cc',
|
||||||
'solo_control.cc',
|
'solo_control.cc',
|
||||||
'solo_isolate_control.cc',
|
'solo_isolate_control.cc',
|
||||||
|
'solo_mute_release.cc',
|
||||||
'solo_safe_control.cc',
|
'solo_safe_control.cc',
|
||||||
'soundcloud_upload.cc',
|
'soundcloud_upload.cc',
|
||||||
'source.cc',
|
'source.cc',
|
||||||
|
Loading…
Reference in New Issue
Block a user