Ardour  8.7-14-g57a6773833
mute_control.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2016-2017 Robin Gareus <robin@gareus.org>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __ardour_mute_control_h__
21 #define __ardour_mute_control_h__
22 
23 #include <memory>
24 #include <string>
25 
27 
28 #include "ardour/mute_master.h"
30 
31 namespace ARDOUR {
32 
33 class Session;
34 class Muteable;
35 
37 {
38 public:
40 
41  double get_value () const;
42  double get_save_value() const { return muted_by_self(); }
43 
44  /* Export additional API so that objects that only get access
45  * to a Controllable/AutomationControl can do more fine-grained
46  * operations with respect to mute. Obviously, they would need
47  * to dynamic_cast<MuteControl> first.
48  *
49  * Mute state is not representable by a single scalar value,
50  * so set_value() and get_value() is not enough.
51  *
52  * This means that the Controllable is technically
53  * asymmetric. It is possible to call ::set_value (0.0) to
54  * turn off mute, and then call ::get_value() and get a
55  * return of 1.0 because the control is affected by
56  * upstream/downstream or a master.
57  */
58 
59  bool muted () const;
60  bool muted_by_self () const;
61  bool muted_by_masters () const;
62  bool muted_by_self_or_masters () const {
63  return muted_by_self() || muted_by_masters ();
64  }
65 
66  bool muted_by_others_soloing () const;
67 
70 
72 
73 protected:
74  bool handle_master_change (std::shared_ptr<AutomationControl>);
76 
77  void pre_remove_master (std::shared_ptr<AutomationControl>);
78  void post_add_master (std::shared_ptr<AutomationControl>);
79 
80 private:
82 };
83 
84 } /* namespace */
85 
86 #endif /* __libardour_mute_control_h__ */
void post_add_master(std::shared_ptr< AutomationControl >)
Muteable & _muteable
Definition: mute_control.h:81
bool muted_by_others_soloing() const
MuteMaster::MutePoint mute_points() const
double get_save_value() const
Definition: mute_control.h:42
double get_value() const
bool muted_by_masters() const
void actually_set_value(double, PBD::Controllable::GroupControlDisposition group_override)
bool handle_master_change(std::shared_ptr< AutomationControl >)
void set_mute_points(MuteMaster::MutePoint)
MuteControl(Session &session, std::string const &name, Muteable &, Temporal::TimeDomainProvider const &)
bool muted_by_self() const
void pre_remove_master(std::shared_ptr< AutomationControl >)
bool muted() const
void automation_run(samplepos_t start, pframes_t nframes)
bool muted_by_self_or_masters() const
Definition: mute_control.h:62
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBARDOUR_API
void session(lua_State *L)
PBD::PropertyDescriptor< timepos_t > start
uint32_t pframes_t
Temporal::samplepos_t samplepos_t