comparison flattendynamics-ladspa.h @ 15:7bb35203a7bd

Make object accessible as a standalone class as well as through LADSPA
author Chris Cannam
date Tue, 22 Jul 2014 16:11:02 +0100
parents 355fb9ea3888
children ca4e31d86436
comparison
equal deleted inserted replaced
14:0e28664bc4fc 15:7bb35203a7bd
8 class FlattenDynamics 8 class FlattenDynamics
9 { 9 {
10 public: 10 public:
11 static const LADSPA_Descriptor *getDescriptor(unsigned long index); 11 static const LADSPA_Descriptor *getDescriptor(unsigned long index);
12 12
13 private: 13 enum Port {
14 FlattenDynamics(int sampleRate);
15 ~FlattenDynamics();
16
17 enum {
18 AudioInputPort = 0, 14 AudioInputPort = 0,
19 AudioOutputPort = 1, 15 AudioOutputPort = 1,
20 GainOutputPort = 2, 16 GainOutputPort = 2,
21 PortCount = 3, 17 PortCount = 3,
22 }; 18 };
23 19
20 // Rest of the public interface is for use when constructing the
21 // class directly, rather than through LADSPA
22
23 FlattenDynamics(int sampleRate);
24 ~FlattenDynamics();
25
26 void connectInputPort(Port p, const float *addr);
27 void connectOutputPort(Port p, float *addr);
28 void reset();
29 void process(int nsamples);
30
31 private:
24 static const char *const portNames[PortCount]; 32 static const char *const portNames[PortCount];
25 static const LADSPA_PortDescriptor ports[PortCount]; 33 static const LADSPA_PortDescriptor ports[PortCount];
26 static const LADSPA_PortRangeHint hints[PortCount]; 34 static const LADSPA_PortRangeHint hints[PortCount];
27 static const LADSPA_Properties properties; 35 static const LADSPA_Properties properties;
28 static const LADSPA_Descriptor ladspaDescriptor; 36 static const LADSPA_Descriptor ladspaDescriptor;
29 37
30 static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long); 38 static LADSPA_Handle ladspaInstantiate(const LADSPA_Descriptor *, unsigned long);
31 static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *); 39 static void ladspaConnectPort(LADSPA_Handle, unsigned long, LADSPA_Data *);
32 static void activate(LADSPA_Handle); 40 static void ladspaActivate(LADSPA_Handle);
33 static void run(LADSPA_Handle, unsigned long); 41 static void ladspaRun(LADSPA_Handle, unsigned long);
34 static void deactivate(LADSPA_Handle); 42 static void ladspaDeactivate(LADSPA_Handle);
35 static void cleanup(LADSPA_Handle); 43 static void ladspaCleanup(LADSPA_Handle);
36 44
37 void reset(); 45 float processSingle(float sample);
38 void runImpl(unsigned long);
39 float process(float);
40 void updateRMS(float); 46 void updateRMS(float);
41 void updateParameters(); 47 void updateParameters();
42 48
43 int m_sampleRate; 49 int m_sampleRate;
44 float *m_input; 50 const float *m_input;
45 float *m_output; 51 float *m_output;
46 float *m_pgain; 52 float *m_pgain;
47 53
48 float *m_history; 54 float *m_history;
49 int m_histlen; 55 int m_histlen;