2 Copyright (C) 2006 Paul Davis
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2 of the License, or (at your option)
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __ardour_meter_h__
20 #define __ardour_meter_h__
23 #include <sigc++/slot.h>
24 #include "ardour/types.h"
25 #include "ardour/processor.h"
26 #include "pbd/fastlog.h"
36 static void update_meters ();
37 static sigc::signal<void> Meter;
39 static sigc::connection connect (sigc::slot<void> the_slot);
40 static void disconnect (sigc::connection& c);
43 /* this object is not meant to be instantiated */
46 static Glib::StaticMutex m_meter_signal_lock;
49 /** Meters peaks on the input and stores them for access.
51 class PeakMeter : public Processor {
53 PeakMeter(Session& s) : Processor(s, "Meter") {}
54 PeakMeter(Session&s, const XMLNode& node);
60 bool can_support_io_configuration (const ChanCount& in, ChanCount& out) const;
61 bool configure_io (ChanCount in, ChanCount out);
63 /* special method for meter, to ensure that it can always handle the maximum
64 number of streams in the route, no matter where we put it.
67 void reset_max_channels (const ChanCount&);
69 /* tell the meter than no matter how many channels it can handle,
70 `in' is the number it is actually going be handling from
74 void reflect_inputs (const ChanCount& in);
77 void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool);
79 float peak_power (uint32_t n) {
80 if (n < _visible_peak_power.size()) {
81 return _visible_peak_power[n];
83 return minus_infinity();
87 float max_peak_power (uint32_t n) {
88 if (n < _max_peak_power.size()) {
89 return _max_peak_power[n];
91 return minus_infinity();
95 XMLNode& state (bool full);
100 uint32_t current_meters;
102 std::vector<float> _peak_power;
103 std::vector<float> _visible_peak_power;
104 std::vector<float> _max_peak_power;
108 } // namespace ARDOUR
110 #endif // __ardour_meter_h__