Ardour  9.0-pre0-582-g084a23a80d
peak_reader.h
Go to the documentation of this file.
1 #ifndef AUDIOGRAPHER_PEAK_READER_H
2 #define AUDIOGRAPHER_PEAK_READER_H
3 
5 #include "audiographer/sink.h"
8 
9 namespace AudioGrapher
10 {
11 
13 class /*LIBAUDIOGRAPHER_API*/ PeakReader : public ListedSource<float>, public Sink<float>
14 {
15  public:
17  PeakReader() : peak (0.0) {}
18 
20  float get_peak() { return peak; }
21 
23  void reset() { peak = 0.0; }
24 
26  void process (ProcessContext<float> const & c)
27  {
30  }
31 
33 
34  private:
35  float peak;
36 };
37 
38 
39 } // namespace
40 
41 #endif // AUDIOGRAPHER_PEAK_READER_H
An generic Source that uses a std::list for managing outputs.
Definition: listed_source.h:17
void output(ProcessContext< T > const &c)
Helper for derived classes.
Definition: listed_source.h:28
A class that reads the maximum value from a stream.
Definition: peak_reader.h:14
void reset()
Resets the peak to 0 RT safe.
Definition: peak_reader.h:23
PeakReader()
Constructor RT safe.
Definition: peak_reader.h:17
float get_peak()
Returns the highest absolute of the values found so far. RT safe.
Definition: peak_reader.h:20
void process(ProcessContext< float > const &c)
Finds peaks from the data RT safe.
Definition: peak_reader.h:26
T const * data() const
data points to the array of data to process
samplecnt_t const & samples() const
samples tells how many samples the array pointed by data contains
static float compute_peak(float const *data, uint_type samples, float current_peak)
Definition: routines.h:32