Chris@0: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: #ifndef FLATTENDYNAMICS_LADSPA_H Chris@0: #define FLATTENDYNAMICS_LADSPA_H Chris@0: Chris@0: #include Chris@0: Chris@0: class FlattenDynamics Chris@0: { Chris@0: public: Chris@0: static const LADSPA_Descriptor *getDescriptor(unsigned long index); Chris@0: Chris@0: private: Chris@0: FlattenDynamics(int sampleRate); Chris@0: ~FlattenDynamics(); Chris@0: Chris@0: enum { Chris@1: AudioInputPort = 0, Chris@1: AudioOutputPort = 1, Chris@1: GainOutputPort = 2, Chris@1: PortCount = 3, Chris@0: }; Chris@0: Chris@0: static const char *const portNames[PortCount]; Chris@0: static const LADSPA_PortDescriptor ports[PortCount]; Chris@0: static const LADSPA_PortRangeHint hints[PortCount]; Chris@0: static const LADSPA_Properties properties; Chris@0: static const LADSPA_Descriptor ladspaDescriptor; Chris@0: Chris@0: static LADSPA_Handle instantiate(const LADSPA_Descriptor *, unsigned long); Chris@0: static void connectPort(LADSPA_Handle, unsigned long, LADSPA_Data *); Chris@0: static void activate(LADSPA_Handle); Chris@0: static void run(LADSPA_Handle, unsigned long); Chris@0: static void deactivate(LADSPA_Handle); Chris@0: static void cleanup(LADSPA_Handle); Chris@0: Chris@0: void reset(); Chris@0: void runImpl(unsigned long); Chris@1: float process(float); Chris@1: void updateRMS(float); Chris@0: void updateParameters(); Chris@0: Chris@0: int m_sampleRate; Chris@0: float *m_input; Chris@0: float *m_output; Chris@1: float *m_pgain; Chris@1: Chris@1: float *m_history; Chris@1: int m_histlen; Chris@1: int m_histwrite; Chris@1: int m_histread; Chris@1: Chris@7: double m_sumOfSquaresLongTerm; Chris@7: double m_sumOfSquaresShortTerm; Chris@7: Chris@7: float m_rmsLongTerm; Chris@7: float m_rmsShortTerm; Chris@7: Chris@7: float m_maxRmsLongTerm; Chris@7: Chris@1: float m_gain; Chris@0: }; Chris@0: Chris@0: #endif