summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-11 14:33:21 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-11 14:33:21 +0000
commit100d7c0f82602f6225537342f6df7dee12479e9d (patch)
tree9596c3e04e1ea8a0b73a579107dd9e6945267929 /libs/ardour
parentada93428b45e9adfe5ffc799b1f3017ab5ea0a35 (diff)
monitor section: make sip/afl/pfl buttons work, add rude solo, mono function, rearrange
git-svn-id: svn://localhost/ardour2/branches/3.0@6747 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/monitor_processor.h5
-rw-r--r--libs/ardour/monitor_processor.cc48
2 files changed, 53 insertions, 0 deletions
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index a66338c75b..eb7ab87aa1 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -55,6 +55,7 @@ class MonitorProcessor : public Processor
void set_cut (uint32_t, bool cut);
void set_dim (uint32_t, bool dim);
void set_solo (uint32_t, bool);
+ void set_mono (bool);
void set_dim_level (gain_t);
void set_solo_boost_level (gain_t);
@@ -66,6 +67,9 @@ class MonitorProcessor : public Processor
bool soloed (uint32_t chn) const;
bool inverted (uint32_t chn) const;
bool cut (uint32_t chn) const;
+ bool cut_all () const;
+ bool dim_all () const;
+ bool mono () const;
PBD::Signal0<void> Changed;
@@ -78,6 +82,7 @@ class MonitorProcessor : public Processor
uint32_t solo_cnt;
bool _dim_all;
bool _cut_all;
+ bool _mono;
volatile gain_t _dim_level;
volatile gain_t _solo_boost_level;
};
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index b0de25f92b..b7ce225f75 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -2,6 +2,7 @@
#include "ardour/amp.h"
#include "ardour/dB.h"
+#include "ardour/audio_buffer.h"
#include "ardour/monitor_processor.h"
#include "ardour/session.h"
@@ -84,6 +85,42 @@ MonitorProcessor::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*e
++chn;
}
+
+ if (_mono) {
+ /* chn is now the number of channels, use as a scaling factor when mixing
+ */
+ gain_t scale = 1.0/chn;
+ BufferSet::audio_iterator b = bufs.audio_begin();
+ AudioBuffer& ab (*b);
+ Sample* buf = ab.data();
+
+ /* scale the first channel */
+
+ for (nframes_t n = 0; n < nframes; ++n) {
+ buf[n] *= scale;
+ }
+
+ /* add every other channel into the first channel's buffer */
+
+ ++b;
+ for (; b != bufs.audio_end(); ++b) {
+ AudioBuffer& ob (*b);
+ Sample* obuf = ob.data ();
+ for (nframes_t n = 0; n < nframes; ++n) {
+ buf[n] += obuf[n] * scale;
+ }
+ }
+
+ /* copy the first channel to every other channel's buffer */
+
+ b = bufs.audio_begin();
+ ++b;
+ for (; b != bufs.audio_end(); ++b) {
+ AudioBuffer& ob (*b);
+ Sample* obuf = ob.data ();
+ memcpy (obuf, buf, sizeof (Sample) * nframes);
+ }
+ }
}
bool
@@ -164,6 +201,12 @@ MonitorProcessor::set_solo (uint32_t chn, bool solo)
}
void
+MonitorProcessor::set_mono (bool yn)
+{
+ _mono = yn;
+}
+
+void
MonitorProcessor::set_cut_all (bool yn)
{
_cut_all = yn;
@@ -219,3 +262,8 @@ MonitorProcessor::dimmed (uint32_t chn) const
return _dim[chn];
}
+bool
+MonitorProcessor::mono () const
+{
+ return _mono;
+}