2c8abe7cf44c0479388502faf56f51856291f3eb
[ardour.git] / libs / ardour / ardour / peak.h
1 #ifndef __ardour_peak_h__
2 #define __ardour_peak_h__
3
4 #include <cmath>
5 #include <ardour/types.h>
6 #include <ardour/utils.h>
7
8 static inline float
9 compute_peak (ARDOUR::Sample *buf, nframes_t nsamples, float current) 
10 {
11         for (nframes_t i = 0; i < nsamples; ++i) {
12                 current = f_max (current, fabsf (buf[i]));
13         }
14         return current;
15 }       
16
17 #endif /* __ardour_peak_h__ */