Fix AudioGrapher library installation path and enable H/W optimizations in AudioGrapher
authorSakari Bergen <sakari.bergen@beatwaves.net>
Thu, 31 Dec 2009 14:03:30 +0000 (14:03 +0000)
committerSakari Bergen <sakari.bergen@beatwaves.net>
Thu, 31 Dec 2009 14:03:30 +0000 (14:03 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6418 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/globals.cc
libs/audiographer/audiographer/routines.h
libs/audiographer/wscript

index b2f71ca6e6865a48fca6829c43b7da82d8c19cd4..125c0a8322919c43996e71767266a72467087eba 100644 (file)
@@ -76,6 +76,8 @@
 #include "ardour/source_factory.h"
 #include "ardour/utils.h"
 
+#include "audiographer/routines.h"
+
 #if defined (__APPLE__)
        #include <Carbon/Carbon.h> // 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
index 9ae6b7a2559015b5b0c97865a91e816781f35817..fd077e1b3f261b4db0cd6d006ce2d1a33afcf9d6 100644 (file)
@@ -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
index ed8388f580aa5b26c512c6431c7662314ea0119a..bb60a4c5e153d5db5508f8bab168c2a24812c1d8 100644 (file)
@@ -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