2 * Copyright (C) <2007> Stefan Kost <ensonic@users.sf.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * SECTION:element-equalizer-3bands
23 * The 3-band equalizer element allows to change the gain of a low frequency,
24 * medium frequency and high frequency band.
27 * <title>Example launch line</title>
29 * gst-launch filesrc location=song.ogg ! oggdemux ! vorbisdec ! audioconvert ! equalizer-3bands band1=6.0 ! alsasink
30 * ]| This raises the volume of the 2nd band, which is at 1110 Hz, by 6 db.
38 #include "gstiirequalizer.h"
39 #include "gstiirequalizer3bands.h"
48 static void gst_iir_equalizer_3bands_set_property (GObject * object,
49 guint prop_id, const GValue * value, GParamSpec * pspec);
50 static void gst_iir_equalizer_3bands_get_property (GObject * object,
51 guint prop_id, GValue * value, GParamSpec * pspec);
53 GST_DEBUG_CATEGORY_EXTERN (equalizer_debug);
54 #define GST_CAT_DEFAULT equalizer_debug
58 _do_init (GType object_type)
60 const GInterfaceInfo preset_interface_info = {
61 NULL, /* interface_init */
62 NULL, /* interface_finalize */
63 NULL /* interface_data */
66 g_type_add_interface_static (object_type, GST_TYPE_PRESET,
67 &preset_interface_info);
70 GST_BOILERPLATE_FULL (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
71 GstIirEqualizer, GST_TYPE_IIR_EQUALIZER, _do_init);
73 /* equalizer implementation */
76 gst_iir_equalizer_3bands_base_init (gpointer g_class)
78 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
80 gst_element_class_set_details_simple (element_class, "3 Band Equalizer",
81 "Filter/Effect/Audio",
82 "Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
86 gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
88 GObjectClass *gobject_class = (GObjectClass *) klass;
90 gobject_class->set_property = gst_iir_equalizer_3bands_set_property;
91 gobject_class->get_property = gst_iir_equalizer_3bands_get_property;
93 g_object_class_install_property (gobject_class, PROP_BAND0,
94 g_param_spec_double ("band0", "110 Hz",
95 "gain for the frequency band 100 Hz, ranging from -24.0 to +12.0",
97 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
98 g_object_class_install_property (gobject_class, PROP_BAND1,
99 g_param_spec_double ("band1", "1100 Hz",
100 "gain for the frequency band 1100 Hz, ranging from -24.0 to +12.0",
102 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
103 g_object_class_install_property (gobject_class, PROP_BAND2,
104 g_param_spec_double ("band2", "11 kHz",
105 "gain for the frequency band 11 kHz, ranging from -24.0 to +12.0",
107 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
111 gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n,
112 GstIirEqualizer3BandsClass * g_class)
114 GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
116 gst_iir_equalizer_compute_frequencies (equ, 3);
120 gst_iir_equalizer_3bands_set_property (GObject * object, guint prop_id,
121 const GValue * value, GParamSpec * pspec)
123 GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
127 gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
130 gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
133 gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
136 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
142 gst_iir_equalizer_3bands_get_property (GObject * object, guint prop_id,
143 GValue * value, GParamSpec * pspec)
145 GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
149 gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
152 gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
155 gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
158 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);