2
* Copyright (C) <2004> Benjamin Otte <otte@gnome.org>
3
* <2007> Stefan Kost <ensonic@users.sf.net>
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.
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.
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.
22
* SECTION:element-equalizer-nbands
25
* <title>Example launch line</title>
27
* The n-band equalizer element changes the frequency spectrum of the audio data.
31
* gst-launch filesrc location=song.ogg ! oggdemux ! vorbisdec ! audioconvert ! equalizer-nbands num-bands=15 band5::gain=-1.0 ! alsasink
33
* This make the equalizer use 15 bands and lowers the volume of the 5th band by FIXME db.
42
#include "gstiirequalizer.h"
43
#include "gstiirequalizernbands.h"
51
static void gst_iir_equalizer_nbands_set_property (GObject * object,
52
guint prop_id, const GValue * value, GParamSpec * pspec);
53
static void gst_iir_equalizer_nbands_get_property (GObject * object,
54
guint prop_id, GValue * value, GParamSpec * pspec);
56
GST_DEBUG_CATEGORY_EXTERN ()(equalizer_debug);
57
#define GST_CAT_DEFAULT equalizer_debug
59
GST_BOILERPLATE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
60
GstIirEqualizer, GST_TYPE_IIR_EQUALIZER);
62
/* equalizer implementation */
65
gst_iir_equalizer_nbands_base_init (gpointer g_class)
67
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
68
const GstElementDetails iir_equalizer_details =
69
GST_ELEMENT_DETAILS ("N Band Equalizer",
70
"Filter/Effect/Audio",
71
"Direct Form IIR equalizer",
72
"Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
74
gst_element_class_set_details (element_class, &iir_equalizer_details);
78
gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
80
GObjectClass *gobject_class = (GObjectClass *) klass;
82
gobject_class->set_property = gst_iir_equalizer_nbands_set_property;
83
gobject_class->get_property = gst_iir_equalizer_nbands_get_property;
85
g_object_class_install_property (gobject_class, ARG_NUM_BANDS,
86
g_param_spec_uint ("num-bands", "num-bands",
87
"number of different bands to use", 2, 64, 10,
88
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
92
gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n,
93
GstIirEqualizerNBandsClass * g_class)
95
GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
97
gst_iir_equalizer_compute_frequencies (equ, 10);
101
gst_iir_equalizer_nbands_set_property (GObject * object, guint prop_id,
102
const GValue * value, GParamSpec * pspec)
104
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
106
GST_EQUALIZER_TRANSFORM_LOCK (equ);
107
GST_OBJECT_LOCK (equ);
110
gst_iir_equalizer_compute_frequencies (equ, g_value_get_uint (value));
113
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
116
GST_OBJECT_UNLOCK (equ);
117
GST_EQUALIZER_TRANSFORM_UNLOCK (equ);
121
gst_iir_equalizer_nbands_get_property (GObject * object, guint prop_id,
122
GValue * value, GParamSpec * pspec)
124
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
128
g_value_set_uint (value, equ->freq_band_count);
131
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);