annotate flattendynamics-ladspa.h @ 1:f21753c504e1

Add gain output port, update rms values
author Chris Cannam
date Thu, 17 Jul 2014 13:27:07 +0100
parents 7632b9bf0cff
children 6b732542a34c
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 #ifndef FLATTENDYNAMICS_LADSPA_H
Chris@0 4 #define FLATTENDYNAMICS_LADSPA_H
Chris@0 5
Chris@0 6 #include <ladspa.h>
Chris@0 7
Chris@0 8 class FlattenDynamics
Chris@0 9 {
Chris@0 10 public:
Chris@0 11 static const LADSPA_Descriptor *getDescriptor(unsigned long index);
Chris@0 12
Chris@0 13 private:
Chris@0 14 FlattenDynamics(int sampleRate);
Chris@0 15 ~FlattenDynamics();
Chris@0 16
Chris@0 17 enum {
Chris@1 18 AudioInputPort = 0,
Chris@1 19 AudioOutputPort = 1,
Chris@1 20 GainOutputPort = 2,
Chris@1 21 PortCount = 3,
Chris@0 22 };
Chris@0 23
Chris@0 24 static const char *const portNames[PortCount];
Chris@0 25 static const LADSPA_PortDescriptor ports[PortCount];
Chris@0 26 static const LADSPA_PortRangeHint hints[PortCount];
Chris@0 27 static const LADSPA_Properties properties;
Chris@0 28 static const LADSPA_Descriptor ladspaDescriptor;
Chris@0 29
Chris@0 30 static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long);
Chris@0 31 static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *);
Chris@0 32 static void activate(LADSPA_Handle);
Chris@0 33 static void run(LADSPA_Handle, unsigned long);
Chris@0 34 static void deactivate(LADSPA_Handle);
Chris@0 35 static void cleanup(LADSPA_Handle);
Chris@0 36
Chris@0 37 void reset();
Chris@0 38 void runImpl(unsigned long);
Chris@1 39 float process(float);
Chris@1 40 void updateRMS(float);
Chris@0 41 void updateParameters();
Chris@0 42
Chris@0 43 int m_sampleRate;
Chris@0 44 float *m_input;
Chris@0 45 float *m_output;
Chris@1 46 float *m_pgain;
Chris@1 47
Chris@1 48 float *m_history;
Chris@1 49 int m_histlen;
Chris@1 50 int m_histwrite;
Chris@1 51 int m_histread;
Chris@1 52
Chris@1 53 double m_sumOfSquares;
Chris@1 54 float m_rms;
Chris@1 55 float m_gain;
Chris@0 56 };
Chris@0 57
Chris@0 58 #endif