summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-01-08 14:20:58 +0100
committerRobin Gareus <robin@gareus.org>2016-01-08 14:20:58 +0100
commit24344d5d1189f395833e227a0205734ca800dd34 (patch)
treef98922af7e49e23576bfc91f17dc18531bb5856b /libs/ardour
parent559649c338733ce098f13a4a1669f0ba8e141eb3 (diff)
Expose overall monitor-processor state
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/monitor_processor.h5
-rw-r--r--libs/ardour/ardour/session.h6
-rw-r--r--libs/ardour/monitor_processor.cc84
3 files changed, 68 insertions, 27 deletions
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index ffee1fbbd2..e971d0a018 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -154,6 +154,8 @@ public:
bool dim_all () const;
bool mono () const;
+ bool monitor_active () const { return _monitor_active; }
+
PBD::Signal0<void> Changed;
boost::shared_ptr<PBD::Controllable> channel_cut_control (uint32_t) const;
@@ -198,6 +200,8 @@ private:
std::vector<ChannelRecord*> _channels;
uint32_t solo_cnt;
+ bool _monitor_active;
+
/* pointers - created first, but managed by boost::shared_ptr<> */
@@ -224,6 +228,7 @@ private:
MPControl<volatile gain_t>& _solo_boost_level;
void allocate_channels (uint32_t);
+ void update_monitor_state ();
};
} /* namespace */
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index a5b93af041..385eadbadf 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -57,11 +57,13 @@
#include "ardour/chan_count.h"
#include "ardour/delivery.h"
#include "ardour/interthread_info.h"
+#include "ardour/location.h"
+#include "ardour/monitor_processor.h"
#include "ardour/rc_configuration.h"
#include "ardour/session_configuration.h"
#include "ardour/session_event.h"
-#include "ardour/location.h"
#include "ardour/interpolation.h"
+#include "ardour/route.h"
#include "ardour/route_graph.h"
@@ -749,6 +751,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
PBD::Signal1<void,bool> SoloActive;
PBD::Signal0<void> SoloChanged;
PBD::Signal0<void> IsolatedChanged;
+ PBD::Signal0<void> MonitorChanged;
PBD::Signal0<void> session_routes_reconnected;
@@ -757,6 +760,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void add_monitor_section ();
void reset_monitor_section ();
void remove_monitor_section ();
+ bool monitor_active() const { return (_monitor_out && _monitor_out->monitor_control () && _monitor_out->monitor_control ()->monitor_active()); }
boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
boost::shared_ptr<Route> master_out() const { return _master_out; }
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index 4264ee7793..6b73af6e31 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -49,6 +49,7 @@ namespace ARDOUR {
MonitorProcessor::MonitorProcessor (Session& s)
: Processor (s, X_("MonitorOut"))
, solo_cnt (0)
+ , _monitor_active (false)
, _dim_all_ptr (new MPControl<bool> (false, _("monitor dim"), Controllable::Toggle))
, _cut_all_ptr (new MPControl<bool> (false, _("monitor cut"), Controllable::Toggle))
@@ -218,7 +219,8 @@ MonitorProcessor::set_state (const XMLNode& node, int version)
}
}
- return 0;
+ update_monitor_state ();
+ return 0;
}
XMLNode&
@@ -363,61 +365,68 @@ MonitorProcessor::can_support_io_configuration (const ChanCount& in, ChanCount&
void
MonitorProcessor::set_polarity (uint32_t chn, bool invert)
{
- if (invert) {
- _channels[chn]->polarity = -1.0f;
- } else {
- _channels[chn]->polarity = 1.0f;
- }
+ if (invert) {
+ _channels[chn]->polarity = -1.0f;
+ } else {
+ _channels[chn]->polarity = 1.0f;
+ }
+ update_monitor_state ();
}
void
MonitorProcessor::set_dim (uint32_t chn, bool yn)
{
- _channels[chn]->dim = yn;
+ _channels[chn]->dim = yn;
+ update_monitor_state ();
}
void
MonitorProcessor::set_cut (uint32_t chn, bool yn)
{
- if (yn) {
- _channels[chn]->cut = GAIN_COEFF_ZERO;
- } else {
- _channels[chn]->cut = GAIN_COEFF_UNITY;
- }
+ if (yn) {
+ _channels[chn]->cut = GAIN_COEFF_ZERO;
+ } else {
+ _channels[chn]->cut = GAIN_COEFF_UNITY;
+ }
+ update_monitor_state ();
}
void
MonitorProcessor::set_solo (uint32_t chn, bool solo)
{
- if (solo != _channels[chn]->soloed) {
- _channels[chn]->soloed = solo;
-
- if (solo) {
- solo_cnt++;
- } else {
- if (solo_cnt > 0) {
- solo_cnt--;
- }
- }
- }
+ if (solo != _channels[chn]->soloed) {
+ _channels[chn]->soloed = solo;
+
+ if (solo) {
+ solo_cnt++;
+ } else {
+ if (solo_cnt > 0) {
+ solo_cnt--;
+ }
+ }
+ }
+ update_monitor_state ();
}
void
MonitorProcessor::set_mono (bool yn)
{
- _mono = yn;
+ _mono = yn;
+ update_monitor_state ();
}
void
MonitorProcessor::set_cut_all (bool yn)
{
- _cut_all = yn;
+ _cut_all = yn;
+ update_monitor_state ();
}
void
MonitorProcessor::set_dim_all (bool yn)
{
- _dim_all = yn;
+ _dim_all = yn;
+ update_monitor_state ();
}
bool
@@ -470,6 +479,29 @@ MonitorProcessor::cut_all () const
return _cut_all;
}
+void
+MonitorProcessor::update_monitor_state ()
+{
+ bool en = false;
+
+ if (_cut_all || _dim_all || _mono) {
+ en = true;
+ }
+
+ const uint32_t nchans = _channels.size();
+ for (uint32_t i = 0; i < nchans && !en; ++i) {
+ if (cut (i) || dimmed (i) || soloed (i) || inverted (i)) {
+ en = true;
+ break;
+ }
+ }
+
+ if (_monitor_active != en) {
+ _monitor_active = en;
+ _session.MonitorChanged();
+ }
+}
+
boost::shared_ptr<Controllable>
MonitorProcessor::channel_cut_control (uint32_t chn) const
{