From 78b6543ba9bc7028c5cfcdd9695d2e9992660924 Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Thu, 31 Dec 2009 14:03:30 +0000 Subject: [PATCH] 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 --- libs/ardour/globals.cc | 5 +++++ libs/audiographer/audiographer/routines.h | 20 ++++++++++++-------- libs/audiographer/wscript | 4 ++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index b2f71ca6e6..125c0a8322 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -76,6 +76,8 @@ #include "ardour/source_factory.h" #include "ardour/utils.h" +#include "audiographer/routines.h" + #if defined (__APPLE__) #include // For Gestalt #endif @@ -254,6 +256,9 @@ setup_hardware_optimization (bool try_optimization) info << "No H/W specific optimizations in use" << endmsg; } + + AudioGrapher::Routines::override_compute_peak (compute_peak); + AudioGrapher::Routines::override_apply_gain_to_buffer (apply_gain_to_buffer); } static void 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 +#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 diff --git a/libs/audiographer/wscript b/libs/audiographer/wscript index ed8388f580..bb60a4c5e1 100644 --- a/libs/audiographer/wscript +++ b/libs/audiographer/wscript @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- import autowaf +import os # Version of this package (even if built as a child) AUDIOGRAPHER_VERSION = '0.0.0' @@ -74,8 +75,7 @@ def build(bld): audiographer.includes = ['.', './src'] audiographer.uselib = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE' audiographer.vnum = AUDIOGRAPHER_LIB_VERSION - audiographer.install_path = '${LIBDIR}' - + audiographer.install_path = os.path.join(bld.env['LIBDIR'], 'ardour3') if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']: # Unit tests