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
56 #define gst_iir_equalizer_3bands_parent_class parent_class
57 G_DEFINE_TYPE_WITH_CODE (GstIirEqualizer3Bands, gst_iir_equalizer_3bands,
58 GST_TYPE_IIR_EQUALIZER, G_IMPLEMENT_INTERFACE (GST_TYPE_PRESET, NULL));
60 /* equalizer implementation */
63 gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
65 GObjectClass *gobject_class = (GObjectClass *) klass;
66 GstElementClass *gstelement_class = (GstElementClass *) klass;
68 gobject_class->set_property = gst_iir_equalizer_3bands_set_property;
69 gobject_class->get_property = gst_iir_equalizer_3bands_get_property;
71 g_object_class_install_property (gobject_class, PROP_BAND0,
72 g_param_spec_double ("band0", "110 Hz",
73 "gain for the frequency band 100 Hz, ranging from -24.0 to +12.0",
75 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
76 g_object_class_install_property (gobject_class, PROP_BAND1,
77 g_param_spec_double ("band1", "1100 Hz",
78 "gain for the frequency band 1100 Hz, ranging from -24.0 to +12.0",
80 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
81 g_object_class_install_property (gobject_class, PROP_BAND2,
82 g_param_spec_double ("band2", "11 kHz",
83 "gain for the frequency band 11 kHz, ranging from -24.0 to +12.0",
85 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
87 gst_element_class_set_details_simple (gstelement_class, "3 Band Equalizer",
88 "Filter/Effect/Audio",
89 "Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
93 gst_iir_equalizer_3bands_init (GstIirEqualizer3Bands * equ_n)
95 GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
97 gst_iir_equalizer_compute_frequencies (equ, 3);
101 gst_iir_equalizer_3bands_set_property (GObject * object, guint prop_id,
102 const GValue * value, GParamSpec * pspec)
104 GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
108 gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
111 gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
114 gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
117 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
123 gst_iir_equalizer_3bands_get_property (GObject * object, guint prop_id,
124 GValue * value, GParamSpec * pspec)
126 GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
130 gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
133 gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
136 gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
139 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);