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
This commit is contained in:
Sakari Bergen 2009-12-31 14:03:30 +00:00
parent b194253b1e
commit 78b6543ba9
3 changed files with 19 additions and 10 deletions

View File

@ -76,6 +76,8 @@
#include "ardour/source_factory.h" #include "ardour/source_factory.h"
#include "ardour/utils.h" #include "ardour/utils.h"
#include "audiographer/routines.h"
#if defined (__APPLE__) #if defined (__APPLE__)
#include <Carbon/Carbon.h> // For Gestalt #include <Carbon/Carbon.h> // For Gestalt
#endif #endif
@ -254,6 +256,9 @@ setup_hardware_optimization (bool try_optimization)
info << "No H/W specific optimizations in use" << endmsg; 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 static void

View File

@ -5,41 +5,43 @@
#include <cmath> #include <cmath>
#define routines_nframes_t uint32_t
namespace AudioGrapher namespace AudioGrapher
{ {
class Routines class Routines
{ {
public: public:
typedef float (*compute_peak_t) (float const *, nframes_t, float); typedef float (*compute_peak_t) (float const *, routines_nframes_t, float);
typedef void (*apply_gain_to_buffer_t) (float *, 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_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 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); 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); (*_apply_gain_to_buffer) (data, frames, gain);
} }
private: 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]); float abs = std::fabs(data[i]);
if (abs > current_peak) { current_peak = abs; } if (abs > current_peak) { current_peak = abs; }
} }
return current_peak; 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; data[i] *= gain;
} }
} }
@ -50,4 +52,6 @@ class Routines
} // namespace } // namespace
#undef routines_nframes_t
#endif // AUDIOGRAPHER_ROUTINES_H #endif // AUDIOGRAPHER_ROUTINES_H

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import autowaf import autowaf
import os
# Version of this package (even if built as a child) # Version of this package (even if built as a child)
AUDIOGRAPHER_VERSION = '0.0.0' AUDIOGRAPHER_VERSION = '0.0.0'
@ -74,8 +75,7 @@ def build(bld):
audiographer.includes = ['.', './src'] audiographer.includes = ['.', './src']
audiographer.uselib = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE' audiographer.uselib = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE'
audiographer.vnum = AUDIOGRAPHER_LIB_VERSION 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']: if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
# Unit tests # Unit tests