diff devuvuzelator-ladspa.h @ 9:a1539d4e3b08

* Tidy code, start doc
author Chris Cannam
date Sat, 12 Jun 2010 13:08:33 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/devuvuzelator-ladspa.h	Sat Jun 12 13:08:33 2010 +0100
@@ -0,0 +1,82 @@
+/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
+
+#ifndef _DEVUVUZELATOR_LADSPA_H_
+#define _DEVUVUZELATOR_LADSPA_H_
+
+#include <ladspa.h>
+
+#include "median.h"
+
+class Devuvuzelator
+{
+public:
+    static const LADSPA_Descriptor *getDescriptor(unsigned long index);
+
+private:
+    Devuvuzelator(int sampleRate);
+    ~Devuvuzelator();
+
+    enum {
+        InputPort     = 0,
+	OutputPort    = 1,
+        LatencyPort   = 2,
+        FundamentalPort = 3,
+        BandwidthPort = 4,
+        HarmonicsPort = 5,
+        ReductionPort = 6,
+	PortCount     = 7,
+    };
+
+    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);
+
+    void reset();
+    void window(float *);
+    void runImpl(unsigned long);
+    void processFrame();
+    void processSpectralFrame();
+    void updateParameters();
+
+    static void fft(unsigned int n, bool inverse,
+                    double *ri, double *ii, double *ro, double *io);
+
+    int m_sampleRate;
+    float *m_input;
+    float *m_output;
+
+    float m_fundamental;
+    float m_bandwidth;
+    float m_harmonics;
+    float m_reduction;
+
+    float *m_platency;
+    float *m_pfundamental;
+    float *m_pbandwidth;
+    float *m_pharmonics;
+    float *m_preduction;
+
+    const int m_fftsize;
+    const int m_winsize;
+    const int m_increment;
+    const float m_filtersecs;
+    int m_fill;
+    int m_read;
+    float *m_buffer;
+    float *m_outacc;
+    double *m_real;
+    double *m_imag;
+    double *m_window;
+    MedianFilter<double> **m_medians;
+};
+
+#endif