summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/peak.h
blob: 2c8abe7cf44c0479388502faf56f51856291f3eb (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, nframes_t nsamples, float current) 
{
	for (nframes_t i = 0; i < nsamples; ++i) {
		current = f_max (current, fabsf (buf[i]));
	}
	return current;
}	

#endif /* __ardour_peak_h__ */