diff options
Diffstat (limited to 'libs/ardour/ardour/peak.h')
-rw-r--r-- | libs/ardour/ardour/peak.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/ardour/ardour/peak.h b/libs/ardour/ardour/peak.h new file mode 100644 index 0000000000..d08357024b --- /dev/null +++ b/libs/ardour/ardour/peak.h @@ -0,0 +1,17 @@ +#ifndef __ardour_peak_h__ +#define __ardour_peak_h__ + +#include <cmath> +#include <ardour/types.h> +#include <ardour/utils.h> + +static inline float +compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current) +{ + for (jack_nframes_t i = 0; i < nsamples; ++i) { + current = f_max (current, fabsf (buf[i])); + } + return current; +} + +#endif /* __ardour_peak_h__ */ |