diff options
author | John Emmas <johne53@tiscali.co.uk> | 2014-01-13 15:05:30 +0000 |
---|---|---|
committer | John Emmas <johne53@tiscali.co.uk> | 2014-01-13 15:05:30 +0000 |
commit | a1a3f6c8265264227ce19f731bf1863aff229a94 (patch) | |
tree | 27e2ef1a73303be594f591af9837442efc50e4d1 /libs/audiographer/audiographer/general | |
parent | 38ff5bb7caeae088283825e17c70e20800400868 (diff) | |
parent | 5f0492deae518dea0a28fe8582209d80e23049fb (diff) |
Merge branch 'windows+cc' into cairocanvas
Diffstat (limited to 'libs/audiographer/audiographer/general')
8 files changed, 17 insertions, 62 deletions
diff --git a/libs/audiographer/audiographer/general/chunker.h b/libs/audiographer/audiographer/general/chunker.h index 2ff766fef3..0ee0c20b20 100644 --- a/libs/audiographer/audiographer/general/chunker.h +++ b/libs/audiographer/audiographer/general/chunker.h @@ -12,7 +12,7 @@ namespace AudioGrapher /// A class that chunks process cycles into equal sized frames template<typename T = DefaultSampleType> -class LIBAUDIOGRAPHER_API Chunker +class /*LIBAUDIOGRAPHER_API*/ Chunker : public ListedSource<T> , public Sink<T> , public FlagDebuggable<> diff --git a/libs/audiographer/audiographer/general/deinterleaver.h b/libs/audiographer/audiographer/general/deinterleaver.h index f9374b67ad..fac38912d7 100644 --- a/libs/audiographer/audiographer/general/deinterleaver.h +++ b/libs/audiographer/audiographer/general/deinterleaver.h @@ -15,7 +15,7 @@ namespace AudioGrapher /// Converts on stream of interleaved data to many streams of uninterleaved data. template<typename T = DefaultSampleType> -class LIBAUDIOGRAPHER_API DeInterleaver +class /*LIBAUDIOGRAPHER_API*/ DeInterleaver : public Sink<T> , public Throwing<> { diff --git a/libs/audiographer/audiographer/general/interleaver.h b/libs/audiographer/audiographer/general/interleaver.h index b0f0efdc66..fe174c9fcb 100644 --- a/libs/audiographer/audiographer/general/interleaver.h +++ b/libs/audiographer/audiographer/general/interleaver.h @@ -16,7 +16,7 @@ namespace AudioGrapher /// Interleaves many streams of non-interleaved data into one interleaved stream template<typename T = DefaultSampleType> -class LIBAUDIOGRAPHER_API Interleaver +class /*LIBAUDIOGRAPHER_API*/ Interleaver : public ListedSource<T> , public Throwing<> { diff --git a/libs/audiographer/audiographer/general/normalizer.h b/libs/audiographer/audiographer/general/normalizer.h index 86fe26b790..e95f0e3852 100644 --- a/libs/audiographer/audiographer/general/normalizer.h +++ b/libs/audiographer/audiographer/general/normalizer.h @@ -6,8 +6,6 @@ #include "audiographer/routines.h" #include "audiographer/utils/listed_source.h" -#include <cstring> - namespace AudioGrapher { @@ -17,71 +15,28 @@ class LIBAUDIOGRAPHER_API Normalizer , public Sink<float> , public Throwing<> { - public: +public: /// Constructs a normalizer with a specific target in dB \n RT safe - Normalizer (float target_dB) - : enabled (false) - , buffer (0) - , buffer_size (0) - { - target = pow (10.0f, target_dB * 0.05f); - } - - ~Normalizer() - { - delete [] buffer; - } + Normalizer (float target_dB); + ~Normalizer(); /// Sets the peak found in the material to be normalized \see PeakReader \n RT safe - void set_peak (float peak) - { - if (peak == 0.0f || peak == target) { - /* don't even try */ - enabled = false; - } else { - enabled = true; - gain = target / peak; - } - } + void set_peak (float peak); /** Allocates a buffer for using with const ProcessContexts * This function does not need to be called if * non-const ProcessContexts are given to \a process() . * \n Not RT safe */ - void alloc_buffer(framecnt_t frames) - { - delete [] buffer; - buffer = new float[frames]; - buffer_size = frames; - } + void alloc_buffer(framecnt_t frames); /// Process a const ProcessContext \see alloc_buffer() \n RT safe - void process (ProcessContext<float> const & c) - { - if (throw_level (ThrowProcess) && c.frames() > buffer_size) { - throw Exception (*this, "Too many frames given to process()"); - } - - if (enabled) { - memcpy (buffer, c.data(), c.frames() * sizeof(float)); - Routines::apply_gain_to_buffer (buffer, c.frames(), gain); - } - - ProcessContext<float> c_out (c, buffer); - ListedSource<float>::output (c_out); - } + void process (ProcessContext<float> const & c); /// Process a non-const ProcsesContext in-place \n RT safe - void process (ProcessContext<float> & c) - { - if (enabled) { - Routines::apply_gain_to_buffer (c.data(), c.frames(), gain); - } - ListedSource<float>::output(c); - } - - private: + void process (ProcessContext<float> & c); + +private: bool enabled; float target; float gain; diff --git a/libs/audiographer/audiographer/general/peak_reader.h b/libs/audiographer/audiographer/general/peak_reader.h index 208a8989df..dd5d65491c 100644 --- a/libs/audiographer/audiographer/general/peak_reader.h +++ b/libs/audiographer/audiographer/general/peak_reader.h @@ -10,7 +10,7 @@ namespace AudioGrapher { /// A class that reads the maximum value from a stream -class LIBAUDIOGRAPHER_API PeakReader : public ListedSource<float>, public Sink<float> +class /*LIBAUDIOGRAPHER_API*/ PeakReader : public ListedSource<float>, public Sink<float> { public: /// Constructor \n RT safe diff --git a/libs/audiographer/audiographer/general/sample_format_converter.h b/libs/audiographer/audiographer/general/sample_format_converter.h index 62500d42dc..b2efc69cab 100644 --- a/libs/audiographer/audiographer/general/sample_format_converter.h +++ b/libs/audiographer/audiographer/general/sample_format_converter.h @@ -10,7 +10,7 @@ namespace AudioGrapher { /// Dither types from the gdither library -enum LIBAUDIOGRAPHER_API DitherType +enum /*LIBAUDIOGRAPHER_API*/ DitherType { D_None = GDitherNone, ///< No didtering D_Rect = GDitherRect, ///< Rectangular dithering, i.e. white noise diff --git a/libs/audiographer/audiographer/general/silence_trimmer.h b/libs/audiographer/audiographer/general/silence_trimmer.h index 4cb9f9a5d9..c0d6d73c4b 100644 --- a/libs/audiographer/audiographer/general/silence_trimmer.h +++ b/libs/audiographer/audiographer/general/silence_trimmer.h @@ -14,7 +14,7 @@ namespace AudioGrapher { /// Removes and adds silent frames to beginning and/or end of stream template<typename T = DefaultSampleType> -class LIBAUDIOGRAPHER_API SilenceTrimmer +class /*LIBAUDIOGRAPHER_API*/ SilenceTrimmer : public ListedSource<T> , public Sink<T> , public FlagDebuggable<> diff --git a/libs/audiographer/audiographer/general/threader.h b/libs/audiographer/audiographer/general/threader.h index 98c6145ee9..e9a953ce44 100644 --- a/libs/audiographer/audiographer/general/threader.h +++ b/libs/audiographer/audiographer/general/threader.h @@ -19,7 +19,7 @@ namespace AudioGrapher { /// Class that stores exceptions thrown from different threads -class LIBAUDIOGRAPHER_API ThreaderException : public Exception +class /*LIBAUDIOGRAPHER_API*/ ThreaderException : public Exception { public: template<typename T> @@ -33,7 +33,7 @@ class LIBAUDIOGRAPHER_API ThreaderException : public Exception /// Class for distributing processing across several threads template <typename T = DefaultSampleType> -class LIBAUDIOGRAPHER_API Threader : public Source<T>, public Sink<T> +class /*LIBAUDIOGRAPHER_API*/ Threader : public Source<T>, public Sink<T> { private: typedef std::vector<typename Source<T>::SinkPtr> OutputVec; |