equalizer: Some cleanup

This commit is contained in:
Sebastian Dröge 2009-11-05 08:03:13 +01:00
parent 773f142483
commit e1acc8f4da
4 changed files with 108 additions and 99 deletions

View file

@ -81,9 +81,9 @@ GST_BOILERPLATE_FULL (GstIirEqualizer, gst_iir_equalizer,
enum
{
ARG_GAIN = 1,
ARG_FREQ,
ARG_BANDWIDTH
PROP_GAIN = 1,
PROP_FREQ,
PROP_BANDWIDTH
};
typedef struct _GstIirEqualizerBandClass GstIirEqualizerBandClass;
@ -128,7 +128,7 @@ gst_iir_equalizer_band_set_property (GObject * object, guint prop_id,
GstIirEqualizerBand *band = GST_IIR_EQUALIZER_BAND (object);
switch (prop_id) {
case ARG_GAIN:{
case PROP_GAIN:{
gdouble gain;
gain = g_value_get_double (value);
@ -145,7 +145,7 @@ gst_iir_equalizer_band_set_property (GObject * object, guint prop_id,
}
break;
}
case ARG_FREQ:{
case PROP_FREQ:{
gdouble freq;
freq = g_value_get_double (value);
@ -161,7 +161,7 @@ gst_iir_equalizer_band_set_property (GObject * object, guint prop_id,
}
break;
}
case ARG_BANDWIDTH:{
case PROP_BANDWIDTH:{
gdouble width;
width = g_value_get_double (value);
@ -190,13 +190,13 @@ gst_iir_equalizer_band_get_property (GObject * object, guint prop_id,
GstIirEqualizerBand *band = GST_IIR_EQUALIZER_BAND (object);
switch (prop_id) {
case ARG_GAIN:
case PROP_GAIN:
g_value_set_double (value, band->gain);
break;
case ARG_FREQ:
case PROP_FREQ:
g_value_set_double (value, band->freq);
break;
case ARG_BANDWIDTH:
case PROP_BANDWIDTH:
g_value_set_double (value, band->width);
break;
default:
@ -213,20 +213,23 @@ gst_iir_equalizer_band_class_init (GstIirEqualizerBandClass * klass)
gobject_class->set_property = gst_iir_equalizer_band_set_property;
gobject_class->get_property = gst_iir_equalizer_band_get_property;
g_object_class_install_property (gobject_class, ARG_GAIN,
g_object_class_install_property (gobject_class, PROP_GAIN,
g_param_spec_double ("gain", "gain",
"gain for the frequency band ranging from -24.0 dB to +12.0 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_FREQ,
g_object_class_install_property (gobject_class, PROP_FREQ,
g_param_spec_double ("freq", "freq",
"center frequency of the band",
0.0, 100000.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
0.0, 100000.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BANDWIDTH,
g_object_class_install_property (gobject_class, PROP_BANDWIDTH,
g_param_spec_double ("bandwidth", "bandwidth",
"difference between bandedges in Hz",
0.0, 100000.0, 1.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
0.0, 100000.0, 1.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
}
static void

View file

@ -41,16 +41,16 @@
enum
{
ARG_BAND0 = 1,
ARG_BAND1,
ARG_BAND2,
ARG_BAND3,
ARG_BAND4,
ARG_BAND5,
ARG_BAND6,
ARG_BAND7,
ARG_BAND8,
ARG_BAND9,
PROP_BAND0 = 1,
PROP_BAND1,
PROP_BAND2,
PROP_BAND3,
PROP_BAND4,
PROP_BAND5,
PROP_BAND6,
PROP_BAND7,
PROP_BAND8,
PROP_BAND9,
};
static void gst_iir_equalizer_10bands_set_property (GObject * object,
@ -84,13 +84,11 @@ static void
gst_iir_equalizer_10bands_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
const GstElementDetails iir_equalizer_details =
GST_ELEMENT_DETAILS ("10 Band Equalizer",
gst_element_class_set_details_simple (element_class, "10 Band Equalizer",
"Filter/Effect/Audio",
"Direct Form 10 band IIR equalizer",
"Stefan Kost <ensonic@users.sf.net>");
gst_element_class_set_details (element_class, &iir_equalizer_details);
}
static void
@ -101,46 +99,56 @@ gst_iir_equalizer_10bands_class_init (GstIirEqualizer10BandsClass * klass)
gobject_class->set_property = gst_iir_equalizer_10bands_set_property;
gobject_class->get_property = gst_iir_equalizer_10bands_get_property;
g_object_class_install_property (gobject_class, ARG_BAND0,
g_object_class_install_property (gobject_class, PROP_BAND0,
g_param_spec_double ("band0", "29 Hz",
"gain for the frequency band 29 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND1,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND1,
g_param_spec_double ("band1", "59 Hz",
"gain for the frequency band 59 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND2,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND2,
g_param_spec_double ("band2", "119 Hz",
"gain for the frequency band 119 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND3,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND3,
g_param_spec_double ("band3", "227 Hz",
"gain for the frequency band 227 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND4,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND4,
g_param_spec_double ("band4", "474 Hz",
"gain for the frequency band 474 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND5,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND5,
g_param_spec_double ("band5", "947 Hz",
"gain for the frequency band 947 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND6,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND6,
g_param_spec_double ("band6", "1889 Hz",
"gain for the frequency band 1889 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND7,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND7,
g_param_spec_double ("band7", "3770 Hz",
"gain for the frequency band 3770 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND8,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND8,
g_param_spec_double ("band8", "7523 Hz",
"gain for the frequency band 7523 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND9,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND9,
g_param_spec_double ("band9", "15011 Hz",
"gain for the frequency band 15011 Hz, ranging from -24 dB to +12 dB",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
}
static void
@ -159,34 +167,34 @@ gst_iir_equalizer_10bands_set_property (GObject * object, guint prop_id,
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
switch (prop_id) {
case ARG_BAND0:
case PROP_BAND0:
gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
break;
case ARG_BAND1:
case PROP_BAND1:
gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
break;
case ARG_BAND2:
case PROP_BAND2:
gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
break;
case ARG_BAND3:
case PROP_BAND3:
gst_child_proxy_set_property (GST_OBJECT (equ), "band3::gain", value);
break;
case ARG_BAND4:
case PROP_BAND4:
gst_child_proxy_set_property (GST_OBJECT (equ), "band4::gain", value);
break;
case ARG_BAND5:
case PROP_BAND5:
gst_child_proxy_set_property (GST_OBJECT (equ), "band5::gain", value);
break;
case ARG_BAND6:
case PROP_BAND6:
gst_child_proxy_set_property (GST_OBJECT (equ), "band6::gain", value);
break;
case ARG_BAND7:
case PROP_BAND7:
gst_child_proxy_set_property (GST_OBJECT (equ), "band7::gain", value);
break;
case ARG_BAND8:
case PROP_BAND8:
gst_child_proxy_set_property (GST_OBJECT (equ), "band8::gain", value);
break;
case ARG_BAND9:
case PROP_BAND9:
gst_child_proxy_set_property (GST_OBJECT (equ), "band9::gain", value);
break;
default:
@ -202,34 +210,34 @@ gst_iir_equalizer_10bands_get_property (GObject * object, guint prop_id,
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
switch (prop_id) {
case ARG_BAND0:
case PROP_BAND0:
gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
break;
case ARG_BAND1:
case PROP_BAND1:
gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
break;
case ARG_BAND2:
case PROP_BAND2:
gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
break;
case ARG_BAND3:
case PROP_BAND3:
gst_child_proxy_get_property (GST_OBJECT (equ), "band3::gain", value);
break;
case ARG_BAND4:
case PROP_BAND4:
gst_child_proxy_get_property (GST_OBJECT (equ), "band4::gain", value);
break;
case ARG_BAND5:
case PROP_BAND5:
gst_child_proxy_get_property (GST_OBJECT (equ), "band5::gain", value);
break;
case ARG_BAND6:
case PROP_BAND6:
gst_child_proxy_get_property (GST_OBJECT (equ), "band6::gain", value);
break;
case ARG_BAND7:
case PROP_BAND7:
gst_child_proxy_get_property (GST_OBJECT (equ), "band7::gain", value);
break;
case ARG_BAND8:
case PROP_BAND8:
gst_child_proxy_get_property (GST_OBJECT (equ), "band8::gain", value);
break;
case ARG_BAND9:
case PROP_BAND9:
gst_child_proxy_get_property (GST_OBJECT (equ), "band9::gain", value);
break;
default:

View file

@ -40,9 +40,9 @@
enum
{
ARG_BAND0 = 1,
ARG_BAND1,
ARG_BAND2,
PROP_BAND0 = 1,
PROP_BAND1,
PROP_BAND2,
};
static void gst_iir_equalizer_3bands_set_property (GObject * object,
@ -76,13 +76,10 @@ static void
gst_iir_equalizer_3bands_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
const GstElementDetails iir_equalizer_details =
GST_ELEMENT_DETAILS ("3 Band Equalizer",
"Filter/Effect/Audio",
"Direct Form 3 band IIR equalizer",
"Stefan Kost <ensonic@users.sf.net>");
gst_element_class_set_details (element_class, &iir_equalizer_details);
gst_element_class_set_details_simple (element_class, "3 Band Equalizer",
"Filter/Effect/Audio",
"Direct Form 3 band IIR equalizer", "Stefan Kost <ensonic@users.sf.net>");
}
static void
@ -93,18 +90,21 @@ gst_iir_equalizer_3bands_class_init (GstIirEqualizer3BandsClass * klass)
gobject_class->set_property = gst_iir_equalizer_3bands_set_property;
gobject_class->get_property = gst_iir_equalizer_3bands_get_property;
g_object_class_install_property (gobject_class, ARG_BAND0,
g_object_class_install_property (gobject_class, PROP_BAND0,
g_param_spec_double ("band0", "110 Hz",
"gain for the frequency band 100 Hz, ranging from -24.0 to +12.0",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND1,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND1,
g_param_spec_double ("band1", "1100 Hz",
"gain for the frequency band 1100 Hz, ranging from -24.0 to +12.0",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, ARG_BAND2,
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
g_object_class_install_property (gobject_class, PROP_BAND2,
g_param_spec_double ("band2", "11 kHz",
"gain for the frequency band 11 kHz, ranging from -24.0 to +12.0",
-24.0, 12.0, 0.0, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
-24.0, 12.0, 0.0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | GST_PARAM_CONTROLLABLE));
}
static void
@ -123,13 +123,13 @@ gst_iir_equalizer_3bands_set_property (GObject * object, guint prop_id,
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
switch (prop_id) {
case ARG_BAND0:
case PROP_BAND0:
gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value);
break;
case ARG_BAND1:
case PROP_BAND1:
gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value);
break;
case ARG_BAND2:
case PROP_BAND2:
gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value);
break;
default:
@ -145,13 +145,13 @@ gst_iir_equalizer_3bands_get_property (GObject * object, guint prop_id,
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
switch (prop_id) {
case ARG_BAND0:
case PROP_BAND0:
gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value);
break;
case ARG_BAND1:
case PROP_BAND1:
gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value);
break;
case ARG_BAND2:
case PROP_BAND2:
gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value);
break;
default:

View file

@ -86,7 +86,7 @@
enum
{
ARG_NUM_BANDS = 1
PROP_NUM_BANDS = 1
};
static void gst_iir_equalizer_nbands_set_property (GObject * object,
@ -106,13 +106,11 @@ static void
gst_iir_equalizer_nbands_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
const GstElementDetails iir_equalizer_details =
GST_ELEMENT_DETAILS ("N Band Equalizer",
gst_element_class_set_details_simple (element_class, "N Band Equalizer",
"Filter/Effect/Audio",
"Direct Form IIR equalizer",
"Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
gst_element_class_set_details (element_class, &iir_equalizer_details);
}
static void
@ -123,10 +121,10 @@ gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
gobject_class->set_property = gst_iir_equalizer_nbands_set_property;
gobject_class->get_property = gst_iir_equalizer_nbands_get_property;
g_object_class_install_property (gobject_class, ARG_NUM_BANDS,
g_object_class_install_property (gobject_class, PROP_NUM_BANDS,
g_param_spec_uint ("num-bands", "num-bands",
"number of different bands to use", 1, 64, 10,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT));
}
static void
@ -147,7 +145,7 @@ gst_iir_equalizer_nbands_set_property (GObject * object, guint prop_id,
GST_BASE_TRANSFORM_LOCK (equ);
GST_OBJECT_LOCK (equ);
switch (prop_id) {
case ARG_NUM_BANDS:
case PROP_NUM_BANDS:
gst_iir_equalizer_compute_frequencies (equ, g_value_get_uint (value));
break;
default:
@ -165,7 +163,7 @@ gst_iir_equalizer_nbands_get_property (GObject * object, guint prop_id,
GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
switch (prop_id) {
case ARG_NUM_BANDS:
case PROP_NUM_BANDS:
g_value_set_uint (value, equ->freq_band_count);
break;
default: