Optimize plugin-processing for non-automated params
[ardour.git] / libs / ardour / ardour / dsp_filter.h
index eb9ba4aa0d7fe3f91d9f95b09807c92a94ac307f..f3100efac55ac168682d4d4e519cfb1ff44cab2e 100644 (file)
@@ -151,7 +151,7 @@ namespace ARDOUR { namespace DSP {
         * @param max result, max value found in range
         * @param n_samples number of samples to analyze
         */
-       void peaks (float *data, float &min, float &max, uint32_t n_samples);
+       void peaks (const float *data, float &min, float &max, uint32_t n_samples);
 
        /** non-linear power-scale meter deflection
         *
@@ -169,7 +169,7 @@ namespace ARDOUR { namespace DSP {
        void process_map (BufferSet* bufs,
                          const ChanMapping& in,
                          const ChanMapping& out,
-                         pframes_t nframes, framecnt_t offset,
+                         pframes_t nframes, samplecnt_t offset,
                          const DataType&);
 
        /** 1st order Low Pass filter */
@@ -310,5 +310,33 @@ namespace ARDOUR { namespace DSP {
                        fftwf_plan _fftplan;
        };
 
+       class LIBARDOUR_API Generator {
+               public:
+                       Generator ();
+
+                       enum Type {
+                               UniformWhiteNoise,
+                               GaussianWhiteNoise,
+                               PinkNoise,
+                       };
+
+                       void run (float *data, const uint32_t n_samples);
+                       void set_type (Type t);
+
+               private:
+                       uint32_t randi ();
+                       float    randf () { return (randi () / 1073741824.f) - 1.f; }
+                       float    grandf ();
+
+                       Type     _type;
+                       uint32_t _rseed;
+                       /* pink-noise */
+                       float _b0, _b1, _b2, _b3, _b4, _b5, _b6;
+                       /* gaussian white */
+                       bool _pass;
+                       float _rn;
+
+       };
+
 } } /* namespace */
 #endif