Mercurial > hg > flattendynamics
diff 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 |
line wrap: on
line diff
--- a/flattendynamics-ladspa.h Tue Jul 22 15:40:45 2014 +0100 +++ b/flattendynamics-ladspa.h Tue Jul 22 16:11:02 2014 +0100 @@ -10,38 +10,44 @@ public: static const LADSPA_Descriptor *getDescriptor(unsigned long index); -private: - FlattenDynamics(int sampleRate); - ~FlattenDynamics(); - - enum { + enum Port { AudioInputPort = 0, AudioOutputPort = 1, GainOutputPort = 2, PortCount = 3, }; + // Rest of the public interface is for use when constructing the + // class directly, rather than through LADSPA + + FlattenDynamics(int sampleRate); + ~FlattenDynamics(); + + void connectInputPort(Port p, const float *addr); + void connectOutputPort(Port p, float *addr); + void reset(); + void process(int nsamples); + +private: static const char *const portNames[PortCount]; static const LADSPA_PortDescriptor ports[PortCount]; static const LADSPA_PortRangeHint hints[PortCount]; static const LADSPA_Properties properties; static const LADSPA_Descriptor ladspaDescriptor; - static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long); - static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *); - static void activate(LADSPA_Handle); - static void run(LADSPA_Handle, unsigned long); - static void deactivate(LADSPA_Handle); - static void cleanup(LADSPA_Handle); + static LADSPA_Handle ladspaInstantiate(const LADSPA_Descriptor *, unsigned long); + static void ladspaConnectPort(LADSPA_Handle, unsigned long, LADSPA_Data *); + static void ladspaActivate(LADSPA_Handle); + static void ladspaRun(LADSPA_Handle, unsigned long); + static void ladspaDeactivate(LADSPA_Handle); + static void ladspaCleanup(LADSPA_Handle); - void reset(); - void runImpl(unsigned long); - float process(float); + float processSingle(float sample); void updateRMS(float); void updateParameters(); int m_sampleRate; - float *m_input; + const float *m_input; float *m_output; float *m_pgain;