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., 51 Franklin St, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef __GST_IIR_EQUALIZER__ 22 #define __GST_IIR_EQUALIZER__ 23 24 #include <gst/audio/gstaudiofilter.h> 25 26 void equalizer_element_init (GstPlugin * plugin); 27 28 GST_ELEMENT_REGISTER_DECLARE (equalizer_nbands); 29 GST_ELEMENT_REGISTER_DECLARE (equalizer_3bands); 30 GST_ELEMENT_REGISTER_DECLARE (equalizer_10bands); 31 32 typedef struct _GstIirEqualizer GstIirEqualizer; 33 typedef struct _GstIirEqualizerClass GstIirEqualizerClass; 34 typedef struct _GstIirEqualizerBand GstIirEqualizerBand; 35 36 #define GST_TYPE_IIR_EQUALIZER \ 37 (gst_iir_equalizer_get_type()) 38 #define GST_IIR_EQUALIZER(obj) \ 39 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_IIR_EQUALIZER,GstIirEqualizer)) 40 #define GST_IIR_EQUALIZER_CLASS(klass) \ 41 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_IIR_EQUALIZER,GstIirEqualizerClass)) 42 #define GST_IS_IIR_EQUALIZER(obj) \ 43 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_IIR_EQUALIZER)) 44 #define GST_IS_IIR_EQUALIZER_CLASS(klass) \ 45 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_IIR_EQUALIZER)) 46 47 #define LOWEST_FREQ (20.0) 48 #define HIGHEST_FREQ (20000.0) 49 50 typedef void (*ProcessFunc) (GstIirEqualizer * eq, guint8 * data, guint size, 51 guint channels); 52 53 struct _GstIirEqualizer 54 { 55 GstAudioFilter audiofilter; 56 57 /*< private >*/ 58 59 GMutex bands_lock; 60 GstIirEqualizerBand **bands; 61 62 /* properties */ 63 guint freq_band_count; 64 /* for each band and channel */ 65 gpointer history; 66 guint history_size; 67 68 gboolean need_new_coefficients; 69 70 ProcessFunc process; 71 }; 72 73 struct _GstIirEqualizerClass 74 { 75 GstAudioFilterClass audiofilter_class; 76 }; 77 78 extern void gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count); 79 80 extern GType gst_iir_equalizer_get_type(void); 81 82 #endif /* __GST_IIR_EQUALIZER__ */ 83