controller: port to new controller location and api
[platform/upstream/gstreamer.git] / gst / equalizer / gstiirequalizer.h
1 /* GStreamer IIR equalizer
2  * Copyright (C) <2004> Benjamin Otte <otte@gnome.org>
3  *               <2007> Stefan Kost <ensonic@users.sf.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GST_IIR_EQUALIZER__
22 #define __GST_IIR_EQUALIZER__
23
24 #include <gst/audio/gstaudiofilter.h>
25 #include <gst/audio/gstringbuffer.h>
26
27 typedef struct _GstIirEqualizer GstIirEqualizer;
28 typedef struct _GstIirEqualizerClass GstIirEqualizerClass;
29 typedef struct _GstIirEqualizerBand GstIirEqualizerBand;
30
31 #define GST_TYPE_IIR_EQUALIZER \
32   (gst_iir_equalizer_get_type())
33 #define GST_IIR_EQUALIZER(obj) \
34   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR_EQUALIZER,GstIirEqualizer))
35 #define GST_IIR_EQUALIZER_CLASS(klass) \
36   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR_EQUALIZER,GstIirEqualizerClass))
37 #define GST_IS_IIR_EQUALIZER(obj) \
38   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR_EQUALIZER))
39 #define GST_IS_IIR_EQUALIZER_CLASS(klass) \
40   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR_EQUALIZER))
41
42 #define LOWEST_FREQ (20.0)
43 #define HIGHEST_FREQ (20000.0)
44
45 typedef void (*ProcessFunc) (GstIirEqualizer * eq, guint8 * data, guint size,
46     guint channels);
47
48 struct _GstIirEqualizer
49 {
50   GstAudioFilter audiofilter;
51
52   /*< private >*/
53
54   GMutex *bands_lock;
55   GstIirEqualizerBand **bands;
56
57   /* properties */
58   guint freq_band_count;
59   /* for each band and channel */
60   gpointer history;
61   guint history_size;
62
63   gboolean need_new_coefficients;
64
65   ProcessFunc process;
66 };
67
68 struct _GstIirEqualizerClass
69 {
70   GstAudioFilterClass audiofilter_class;
71 };
72
73 extern void gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count);
74
75 extern GType gst_iir_equalizer_get_type(void);
76
77 #endif /* __GST_IIR_EQUALIZER__ */