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 "ardour/libardour_visibility.h"
24 #include "ardour/types.h"
25 #include "ardour/processor.h"
26 #include "pbd/fastlog.h"
28 #include "ardour/kmeterdsp.h"
29 #include "ardour/iec1ppmdsp.h"
30 #include "ardour/iec2ppmdsp.h"
31 #include "ardour/vumeterdsp.h"
39 /** Meters peaks on the input and stores them for access.
41 class LIBARDOUR_API PeakMeter : public Processor {
43 PeakMeter(Session& s, const std::string& name);
49 bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
50 bool configure_io (ChanCount in, ChanCount out);
52 /* special method for meter, to ensure that it can always handle the maximum
53 number of streams in the route, no matter where we put it.
56 void set_max_channels (const ChanCount&);
58 /* tell the meter than no matter how many channels it can handle,
59 `in' is the number it is actually going be handling from
63 void reflect_inputs (const ChanCount& in);
64 void emit_configuration_changed ();
67 void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool);
70 void deactivate () { }
72 ChanCount input_streams () const { return current_meters; }
73 ChanCount output_streams () const { return current_meters; }
75 float meter_level (uint32_t n, MeterType type);
77 void set_type(MeterType t);
78 MeterType get_type() { return _meter_type; }
81 PBD::Signal1<void, MeterType> TypeChanged;
89 /** The number of meters that we are currently handling;
90 * may be different to _configured_input and _configured_output
91 * as it can be altered outside a ::configure_io by ::reflect_inputs.
93 ChanCount current_meters;
99 std::vector<float> _peak_buffer; // internal, integrate
100 std::vector<float> _peak_power; // includes accurate falloff, hence dB
101 std::vector<float> _max_peak_signal; // dB calculation is done on demand
102 float _combined_peak; // Mackie surfaces expect the highest peak of all track channels
104 std::vector<Kmeterdsp *> _kmeter;
105 std::vector<Iec1ppmdsp *> _iec1meter;
106 std::vector<Iec2ppmdsp *> _iec2meter;
107 std::vector<Vumeterdsp *> _vumeter;
109 MeterType _meter_type;
112 } // namespace ARDOUR
114 #endif // __ardour_meter_h__