summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/routines.h
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2009-12-31 14:03:30 +0000
committerSakari Bergen <sakari.bergen@beatwaves.net>2009-12-31 14:03:30 +0000
commit78b6543ba9bc7028c5cfcdd9695d2e9992660924 (patch)
treeb77d01706fdfeb10f268ba003ef67b742979ba9e /libs/audiographer/audiographer/routines.h
parentb194253b1eb850b37b430b90cc83224cf8b94ed1 (diff)
Fix AudioGrapher library installation path and enable H/W optimizations in AudioGrapher
git-svn-id: svn://localhost/ardour2/branches/3.0@6418 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/audiographer/audiographer/routines.h')
-rw-r--r--libs/audiographer/audiographer/routines.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/libs/audiographer/audiographer/routines.h b/libs/audiographer/audiographer/routines.h
index 9ae6b7a255..fd077e1b3f 100644
--- a/libs/audiographer/audiographer/routines.h
+++ b/libs/audiographer/audiographer/routines.h
@@ -5,41 +5,43 @@
#include <cmath>
+#define routines_nframes_t uint32_t
+
namespace AudioGrapher
{
class Routines
{
public:
- typedef float (*compute_peak_t) (float const *, nframes_t, float);
- typedef void (*apply_gain_to_buffer_t) (float *, nframes_t, float);
+ typedef float (*compute_peak_t) (float const *, routines_nframes_t, float);
+ typedef void (*apply_gain_to_buffer_t) (float *, routines_nframes_t, float);
static void override_compute_peak (compute_peak_t func) { _compute_peak = func; }
static void override_apply_gain_to_buffer (apply_gain_to_buffer_t func) { _apply_gain_to_buffer = func; }
- static inline float compute_peak (float const * data, nframes_t frames, float current_peak)
+ static inline float compute_peak (float const * data, routines_nframes_t frames, float current_peak)
{
return (*_compute_peak) (data, frames, current_peak);
}
- static inline void apply_gain_to_buffer (float * data, nframes_t frames, float gain)
+ static inline void apply_gain_to_buffer (float * data, routines_nframes_t frames, float gain)
{
(*_apply_gain_to_buffer) (data, frames, gain);
}
private:
- static inline float default_compute_peak (float const * data, nframes_t frames, float current_peak)
+ static inline float default_compute_peak (float const * data, routines_nframes_t frames, float current_peak)
{
- for (nframes_t i = 0; i < frames; ++i) {
+ for (routines_nframes_t i = 0; i < frames; ++i) {
float abs = std::fabs(data[i]);
if (abs > current_peak) { current_peak = abs; }
}
return current_peak;
}
- static inline void default_apply_gain_to_buffer (float * data, nframes_t frames, float gain)
+ static inline void default_apply_gain_to_buffer (float * data, routines_nframes_t frames, float gain)
{
- for (nframes_t i = 0; i < frames; ++i) {
+ for (routines_nframes_t i = 0; i < frames; ++i) {
data[i] *= gain;
}
}
@@ -50,4 +52,6 @@ class Routines
} // namespace
+#undef routines_nframes_t
+
#endif // AUDIOGRAPHER_ROUTINES_H