2008-06-02 21:41:35 +00:00
|
|
|
/*
|
2009-10-14 16:10:01 +00:00
|
|
|
Copyright (C) 2006 Paul Davis
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
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.
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
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.
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
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.,
|
|
|
|
|
675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <cmath>
|
2012-05-24 06:09:29 +00:00
|
|
|
|
|
|
|
|
#include "ardour/audio_buffer.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/buffer_set.h"
|
|
|
|
|
#include "ardour/dB.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/meter.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/midi_buffer.h"
|
2012-05-24 06:09:29 +00:00
|
|
|
#include "ardour/rc_configuration.h"
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/runtime_functions.h"
|
2008-06-02 21:41:35 +00:00
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
using namespace std;
|
|
|
|
|
|
2009-06-09 20:21:19 +00:00
|
|
|
using namespace ARDOUR;
|
2008-06-02 21:41:35 +00:00
|
|
|
|
2009-12-19 20:26:31 +00:00
|
|
|
PBD::Signal0<void> Metering::Meter;
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
/** Get peaks from @a bufs
|
|
|
|
|
* Input acceptance is lenient - the first n buffers from @a bufs will
|
|
|
|
|
* be metered, where n was set by the last call to setup(), excess meters will
|
|
|
|
|
* be set to 0.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2010-12-03 22:26:29 +00:00
|
|
|
PeakMeter::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
|
2008-06-02 21:41:35 +00:00
|
|
|
{
|
2009-07-21 14:39:21 +00:00
|
|
|
if (!_active && !_pending_active) {
|
2009-07-14 00:11:04 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-04 22:46:48 +00:00
|
|
|
// cerr << "meter " << name() << " runs with " << bufs.available() << " inputs\n";
|
2011-02-22 17:04:06 +00:00
|
|
|
|
2011-01-09 15:10:59 +00:00
|
|
|
const uint32_t n_audio = min (current_meters.n_audio(), bufs.count().n_audio());
|
|
|
|
|
const uint32_t n_midi = min (current_meters.n_midi(), bufs.count().n_midi());
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-09-27 18:07:37 +00:00
|
|
|
uint32_t n = 0;
|
2009-10-14 16:10:01 +00:00
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
// Meter MIDI in to the first n_midi peaks
|
|
|
|
|
for (uint32_t i = 0; i < n_midi; ++i, ++n) {
|
|
|
|
|
float val = 0.0f;
|
|
|
|
|
for (MidiBuffer::iterator e = bufs.get_midi(i).begin(); e != bufs.get_midi(i).end(); ++e) {
|
2010-12-03 22:26:29 +00:00
|
|
|
const Evoral::MIDIEvent<framepos_t> ev(*e, false);
|
2008-06-02 21:41:35 +00:00
|
|
|
if (ev.is_note_on()) {
|
|
|
|
|
const float this_vel = log(ev.buffer()[2] / 127.0 * (M_E*M_E-M_E) + M_E) - 1.0;
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
if (this_vel > val) {
|
2008-06-02 21:41:35 +00:00
|
|
|
val = this_vel;
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
} else {
|
|
|
|
|
val += 1.0 / bufs.get_midi(n).capacity();
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
if (val > 1.0) {
|
2008-06-02 21:41:35 +00:00
|
|
|
val = 1.0;
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
}
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-06-30 15:08:18 +00:00
|
|
|
_peak_power[n] = max (val, _peak_power[n]);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2008-09-27 06:52:27 +00:00
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
// Meter audio in to the rest of the peaks
|
|
|
|
|
for (uint32_t i = 0; i < n_audio; ++i, ++n) {
|
2009-10-14 16:10:01 +00:00
|
|
|
_peak_power[n] = compute_peak (bufs.get_audio(i).data(), nframes, _peak_power[n]);
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Zero any excess peaks
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
for (uint32_t i = n; i < _peak_power.size(); ++i) {
|
|
|
|
|
_peak_power[i] = 0.0f;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
2009-07-21 14:39:21 +00:00
|
|
|
|
|
|
|
|
_active = _pending_active;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PeakMeter::reset ()
|
|
|
|
|
{
|
|
|
|
|
for (size_t i = 0; i < _peak_power.size(); ++i) {
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
_peak_power[i] = 0.0f;
|
2008-06-02 21:41:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PeakMeter::reset_max ()
|
|
|
|
|
{
|
|
|
|
|
for (size_t i = 0; i < _max_peak_power.size(); ++i) {
|
|
|
|
|
_max_peak_power[i] = -INFINITY;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
bool
|
|
|
|
|
PeakMeter::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
|
|
|
|
|
{
|
|
|
|
|
out = in;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
bool
|
|
|
|
|
PeakMeter::configure_io (ChanCount in, ChanCount out)
|
|
|
|
|
{
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
if (out != in) { // always 1:1
|
2008-06-02 21:41:35 +00:00
|
|
|
return false;
|
2008-09-10 15:03:30 +00:00
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2009-12-23 00:51:26 +00:00
|
|
|
current_meters = in;
|
2009-12-07 14:18:06 +00:00
|
|
|
|
2011-04-04 22:46:48 +00:00
|
|
|
reset_max_channels (in);
|
2010-04-16 19:31:10 +00:00
|
|
|
|
2009-12-07 14:18:06 +00:00
|
|
|
return Processor::configure_io (in, out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PeakMeter::reflect_inputs (const ChanCount& in)
|
|
|
|
|
{
|
2009-12-23 00:51:26 +00:00
|
|
|
current_meters = in;
|
2011-08-19 19:21:05 +00:00
|
|
|
|
|
|
|
|
ConfigurationChanged (in, in); /* EMIT SIGNAL */
|
2009-12-07 14:18:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
PeakMeter::reset_max_channels (const ChanCount& chn)
|
|
|
|
|
{
|
2011-01-09 15:10:59 +00:00
|
|
|
uint32_t const limit = chn.n_total();
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
while (_peak_power.size() > limit) {
|
|
|
|
|
_peak_power.pop_back();
|
|
|
|
|
_visible_peak_power.pop_back();
|
|
|
|
|
_max_peak_power.pop_back();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (_peak_power.size() < limit) {
|
|
|
|
|
_peak_power.push_back(0);
|
|
|
|
|
_visible_peak_power.push_back(minus_infinity());
|
|
|
|
|
_max_peak_power.push_back(minus_infinity());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(_peak_power.size() == limit);
|
|
|
|
|
assert(_visible_peak_power.size() == limit);
|
|
|
|
|
assert(_max_peak_power.size() == limit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** To be driven by the Meter signal from IO.
|
2009-06-09 20:21:19 +00:00
|
|
|
* Caller MUST hold its own processor_lock to prevent reconfiguration
|
|
|
|
|
* of meter size during this call.
|
2008-06-02 21:41:35 +00:00
|
|
|
*/
|
2009-06-09 20:21:19 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
void
|
|
|
|
|
PeakMeter::meter ()
|
|
|
|
|
{
|
2009-07-21 03:23:57 +00:00
|
|
|
if (!_active) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
assert(_visible_peak_power.size() == _peak_power.size());
|
|
|
|
|
|
2009-12-23 00:51:26 +00:00
|
|
|
const size_t limit = min (_peak_power.size(), (size_t) current_meters.n_total ());
|
2008-06-02 21:41:35 +00:00
|
|
|
|
|
|
|
|
for (size_t n = 0; n < limit; ++n) {
|
|
|
|
|
|
|
|
|
|
/* grab peak since last read */
|
|
|
|
|
|
2009-10-14 16:10:01 +00:00
|
|
|
float new_peak = _peak_power[n]; /* XXX we should use atomic exchange from here ... */
|
2009-06-09 20:21:19 +00:00
|
|
|
_peak_power[n] = 0; /* ... to here */
|
2009-07-21 03:23:57 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
/* compute new visible value using falloff */
|
|
|
|
|
|
|
|
|
|
if (new_peak > 0.0) {
|
2009-08-22 10:21:39 +00:00
|
|
|
new_peak = fast_coefficient_to_dB (new_peak);
|
2008-06-02 21:41:35 +00:00
|
|
|
} else {
|
|
|
|
|
new_peak = minus_infinity();
|
|
|
|
|
}
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
/* update max peak */
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
_max_peak_power[n] = std::max (new_peak, _max_peak_power[n]);
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2008-06-02 21:41:35 +00:00
|
|
|
if (Config->get_meter_falloff() == 0.0f || new_peak > _visible_peak_power[n]) {
|
|
|
|
|
_visible_peak_power[n] = new_peak;
|
|
|
|
|
} else {
|
|
|
|
|
// do falloff
|
|
|
|
|
new_peak = _visible_peak_power[n] - (Config->get_meter_falloff() * 0.01f);
|
|
|
|
|
_visible_peak_power[n] = std::max (new_peak, -INFINITY);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
XMLNode&
|
|
|
|
|
PeakMeter::state (bool full_state)
|
|
|
|
|
{
|
2009-05-13 21:34:09 +00:00
|
|
|
XMLNode& node (Processor::state (full_state));
|
|
|
|
|
node.add_property("type", "meter");
|
|
|
|
|
return node;
|
The great audio processing overhaul.
The vast majority of Route signal processing is now simply in the list of
processors. There are definitely regressions here, but there's also
a lot of things fixed. It's far too much work to let diverge anymore
regardless, so here it is.
The basic model is: A route has a fixed set of input channels (matching
its JACK input ports and diskstream). The first processor takes this
as input. The next processor is configured using the first processor's
output as input, and is allowed to choose whatever output it wants
given that input... and so on, and so on. Finally, the last processor's
requested output is used to set up the panner and create whatever Jack
ports are needed to output the data.
All 'special' internal processors (meter, fader, amp, insert, send) are
currently transparent: they read any input, and return the same set
of channels back (unmodified, except for amp).
User visible changes:
* LV2 Instrument support (tracks with both MIDI and audio channels)
* MIDI in/out plugin support
* Generic plugin replication (for MIDI plugins, MIDI/audio plugins)
* Movable meter point
Known Bugs:
* Things seem to get weird on loaded sessions
* Output delivery is sketchy
* 2.0 session loading was probably already broken...
but it's definitely broken now :)
Please test this and file bugs if you have any time...
git-svn-id: svn://localhost/ardour2/branches/3.0@5055 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-07 06:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-15 00:47:34 +00:00
|
|
|
|