diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-11 14:33:21 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-11 14:33:21 +0000 |
commit | 100d7c0f82602f6225537342f6df7dee12479e9d (patch) | |
tree | 9596c3e04e1ea8a0b73a579107dd9e6945267929 /libs/ardour/monitor_processor.cc | |
parent | ada93428b45e9adfe5ffc799b1f3017ab5ea0a35 (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/monitor_processor.cc')
-rw-r--r-- | libs/ardour/monitor_processor.cc | 48 |
1 files changed, 48 insertions, 0 deletions
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; +} |