summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/peak.h
blob: d08357024bd9f4dd9232f58b5e9886b672dce823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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__ */