diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2008-02-06 23:44:43 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2008-02-06 23:44:43 +0000 |
commit | 22bea9fec39c98e58a3eec4e02b6df0b74936a0b (patch) | |
tree | 1e53048c543615729085db261f8670f41af49fef /tests | |
parent | 8921eb2cd92059191b2b16aafbdfae04276935b4 (diff) |
Rename audiochebyshevfreqband -> audiochebband and audiochebyshevfreqlimit -> audiocheblimit and do the requisite CVS...
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/inspect/plugin-audiofx.xml:
* gst/audiofx/Makefile.am:
* gst/audiofx/audiochebband.c:
* gst/audiofx/audiochebband.h:
* gst/audiofx/audiocheblimit.c:
* gst/audiofx/audiocheblimit.h:
* gst/audiofx/audiochebyshevfreqband.c:
* gst/audiofx/audiochebyshevfreqband.h:
* gst/audiofx/audiochebyshevfreqlimit.c:
* gst/audiofx/audiochebyshevfreqlimit.h:
* gst/audiofx/audiofx.c:
* tests/check/Makefile.am:
* tests/check/elements/.cvsignore:
* tests/check/elements/audiochebband.c:
* tests/check/elements/audiocheblimit.c:
* tests/check/elements/audiochebyshevfreqband.c:
* tests/check/elements/audiochebyshevfreqlimit.c:
Rename audiochebyshevfreqband -> audiochebband and
audiochebyshevfreqlimit -> audiocheblimit and do the requisite CVS
surgery.
Closes: #491811
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/Makefile.am | 4 | ||||
-rw-r--r-- | tests/check/elements/.gitignore | 4 | ||||
-rw-r--r-- | tests/check/elements/audiochebband.c | 516 | ||||
-rw-r--r-- | tests/check/elements/audiocheblimit.c | 340 | ||||
-rw-r--r-- | tests/check/elements/audiochebyshevfreqband.c | 1540 | ||||
-rw-r--r-- | tests/check/elements/audiochebyshevfreqlimit.c | 1020 |
6 files changed, 422 insertions, 3002 deletions
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 9c663355..dac5d16c 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -55,8 +55,8 @@ check_PROGRAMS = \ elements/alphacolor \ elements/audiopanorama \ elements/audioinvert \ - elements/audiochebyshevfreqband \ - elements/audiochebyshevfreqlimit \ + elements/audiochebband \ + elements/audiocheblimit \ elements/audioamplify \ elements/audiodynamic \ elements/avimux \ diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index a9d5dc1d..33fe1701 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -2,8 +2,8 @@ alphacolor apev2mux audioamplify -audiochebyshevfreqband -audiochebyshevfreqlimit +audiochebband +audiocheblimit audiodynamic audioinvert audiopanorama diff --git a/tests/check/elements/audiochebband.c b/tests/check/elements/audiochebband.c index f4602e2c..13ffa5fe 100644 --- a/tests/check/elements/audiochebband.c +++ b/tests/check/elements/audiochebband.c @@ -2,7 +2,7 @@ * * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org> * - * audiochebyshevfreqband.c: Unit test for the audiochebyshevfreqband element + * audiochebband.c: Unit test for the audiochebband element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -63,26 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", ); GstElement * -setup_audiochebyshevfreqband () +setup_audiochebband () { - GstElement *audiochebyshevfreqband; - - GST_DEBUG ("setup_audiochebyshevfreqband"); - audiochebyshevfreqband = gst_check_setup_element ("audiochebyshevfreqband"); - mysrcpad = - gst_check_setup_src_pad (audiochebyshevfreqband, &srctemplate, NULL); - mysinkpad = - gst_check_setup_sink_pad (audiochebyshevfreqband, &sinktemplate, NULL); + GstElement *audiochebband; + + GST_DEBUG ("setup_audiochebband"); + audiochebband = gst_check_setup_element ("audiochebband"); + mysrcpad = gst_check_setup_src_pad (audiochebband, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (audiochebband, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); - return audiochebyshevfreqband; + return audiochebband; } void -cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband) +cleanup_audiochebband (GstElement * audiochebband) { - GST_DEBUG ("cleanup_audiochebyshevfreqband"); + GST_DEBUG ("cleanup_audiochebband"); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); @@ -90,9 +88,9 @@ cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband) gst_pad_set_active (mysrcpad, FALSE); gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (audiochebyshevfreqband); - gst_check_teardown_sink_pad (audiochebyshevfreqband); - gst_check_teardown_element (audiochebyshevfreqband); + gst_check_teardown_src_pad (audiochebband); + gst_check_teardown_sink_pad (audiochebband); + gst_check_teardown_element (audiochebband); } /* Test if data containing only one frequency component @@ -100,26 +98,26 @@ cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband) * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_bp_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -146,7 +144,7 @@ GST_START_TEST (test_type1_32_bp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -156,26 +154,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_bp_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -206,7 +204,7 @@ GST_START_TEST (test_type1_32_bp_11025hz) fail_unless (rms >= 0.6); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -216,26 +214,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_bp_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -264,7 +262,7 @@ GST_START_TEST (test_type1_32_bp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -274,26 +272,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_br_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -320,7 +318,7 @@ GST_START_TEST (test_type1_32_br_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -330,26 +328,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_br_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -380,7 +378,7 @@ GST_START_TEST (test_type1_32_br_11025hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -390,26 +388,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_32_br_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -438,7 +436,7 @@ GST_START_TEST (test_type1_32_br_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -448,26 +446,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_bp_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -494,7 +492,7 @@ GST_START_TEST (test_type1_64_bp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -504,26 +502,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_bp_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -554,7 +552,7 @@ GST_START_TEST (test_type1_64_bp_11025hz) fail_unless (rms >= 0.6); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -564,26 +562,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_bp_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -612,7 +610,7 @@ GST_START_TEST (test_type1_64_bp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -622,26 +620,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_br_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -668,7 +666,7 @@ GST_START_TEST (test_type1_64_br_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -678,26 +676,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_br_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -728,7 +726,7 @@ GST_START_TEST (test_type1_64_br_11025hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -738,26 +736,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type1_64_br_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -786,7 +784,7 @@ GST_START_TEST (test_type1_64_br_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -796,26 +794,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_bp_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -842,7 +840,7 @@ GST_START_TEST (test_type2_32_bp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -852,26 +850,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_bp_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -902,7 +900,7 @@ GST_START_TEST (test_type2_32_bp_11025hz) fail_unless (rms >= 0.6); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -912,26 +910,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_bp_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -960,7 +958,7 @@ GST_START_TEST (test_type2_32_bp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -970,26 +968,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_br_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -1016,7 +1014,7 @@ GST_START_TEST (test_type2_32_br_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1026,26 +1024,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_br_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -1076,7 +1074,7 @@ GST_START_TEST (test_type2_32_br_11025hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1086,26 +1084,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_32_br_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); @@ -1134,7 +1132,7 @@ GST_START_TEST (test_type2_32_br_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1144,26 +1142,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_bp_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1190,7 +1188,7 @@ GST_START_TEST (test_type2_64_bp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1200,26 +1198,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_bp_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1250,7 +1248,7 @@ GST_START_TEST (test_type2_64_bp_11025hz) fail_unless (rms >= 0.6); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1260,26 +1258,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_bp_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 0, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1308,7 +1306,7 @@ GST_START_TEST (test_type2_64_bp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1318,26 +1316,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_br_0hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1364,7 +1362,7 @@ GST_START_TEST (test_type2_64_br_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1374,26 +1372,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_br_11025hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1424,7 +1422,7 @@ GST_START_TEST (test_type2_64_br_11025hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; @@ -1434,26 +1432,26 @@ GST_END_TEST; * 2000Hz frequency band around rate/4 */ GST_START_TEST (test_type2_64_br_22050hz) { - GstElement *audiochebyshevfreqband; + GstElement *audiochebband; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqband = setup_audiochebyshevfreqband (); + audiochebband = setup_audiochebband (); /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiochebband), "mode", 1, NULL); + g_object_set (G_OBJECT (audiochebband), "poles", 8, NULL); + g_object_set (G_OBJECT (audiochebband), "type", 2, NULL); + g_object_set (G_OBJECT (audiochebband), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqband, + fail_unless (gst_element_set_state (audiochebband, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", + g_object_set (G_OBJECT (audiochebband), "lower-frequency", 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", + g_object_set (G_OBJECT (audiochebband), "upper-frequency", 44100 / 4.0 + 1000, NULL); inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); @@ -1482,15 +1480,15 @@ GST_START_TEST (test_type2_64_br_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); + cleanup_audiochebband (audiochebband); } GST_END_TEST; Suite * -audiochebyshevfreqband_suite (void) +audiochebband_suite (void) { - Suite *s = suite_create ("audiochebyshevfreqband"); + Suite *s = suite_create ("audiochebband"); TCase *tc_chain = tcase_create ("general"); suite_add_tcase (s, tc_chain); @@ -1527,7 +1525,7 @@ main (int argc, char **argv) { int nf; - Suite *s = audiochebyshevfreqband_suite (); + Suite *s = audiochebband_suite (); SRunner *sr = srunner_create (s); gst_check_init (&argc, &argv); diff --git a/tests/check/elements/audiocheblimit.c b/tests/check/elements/audiocheblimit.c index bf7ad09e..70645b98 100644 --- a/tests/check/elements/audiocheblimit.c +++ b/tests/check/elements/audiocheblimit.c @@ -2,7 +2,7 @@ * * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org> * - * audiochebyshevfreqlimit.c: Unit test for the audiochebyshevfreqlimit element + * audiocheblimit.c: Unit test for the audiocheblimit element * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -63,26 +63,24 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", ); GstElement * -setup_audiochebyshevfreqlimit () +setup_audiocheblimit () { - GstElement *audiochebyshevfreqlimit; - - GST_DEBUG ("setup_audiochebyshevfreqlimit"); - audiochebyshevfreqlimit = gst_check_setup_element ("audiochebyshevfreqlimit"); - mysrcpad = - gst_check_setup_src_pad (audiochebyshevfreqlimit, &srctemplate, NULL); - mysinkpad = - gst_check_setup_sink_pad (audiochebyshevfreqlimit, &sinktemplate, NULL); + GstElement *audiocheblimit; + + GST_DEBUG ("setup_audiocheblimit"); + audiocheblimit = gst_check_setup_element ("audiocheblimit"); + mysrcpad = gst_check_setup_src_pad (audiocheblimit, &srctemplate, NULL); + mysinkpad = gst_check_setup_sink_pad (audiocheblimit, &sinktemplate, NULL); gst_pad_set_active (mysrcpad, TRUE); gst_pad_set_active (mysinkpad, TRUE); - return audiochebyshevfreqlimit; + return audiocheblimit; } void -cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit) +cleanup_audiocheblimit (GstElement * audiocheblimit) { - GST_DEBUG ("cleanup_audiochebyshevfreqlimit"); + GST_DEBUG ("cleanup_audiocheblimit"); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); @@ -90,9 +88,9 @@ cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit) gst_pad_set_active (mysrcpad, FALSE); gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (audiochebyshevfreqlimit); - gst_check_teardown_sink_pad (audiochebyshevfreqlimit); - gst_check_teardown_element (audiochebyshevfreqlimit); + gst_check_teardown_src_pad (audiocheblimit); + gst_check_teardown_sink_pad (audiocheblimit); + gst_check_teardown_element (audiocheblimit); } /* Test if data containing only one frequency component @@ -100,25 +98,24 @@ cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit) * at rate/4 */ GST_START_TEST (test_type1_32_lp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -144,7 +141,7 @@ GST_START_TEST (test_type1_32_lp_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -154,25 +151,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_32_lp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -200,7 +196,7 @@ GST_START_TEST (test_type1_32_lp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -210,25 +206,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_32_hp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -254,7 +249,7 @@ GST_START_TEST (test_type1_32_hp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -264,25 +259,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_32_hp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -310,7 +304,7 @@ GST_START_TEST (test_type1_32_hp_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -320,25 +314,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_64_lp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -364,7 +357,7 @@ GST_START_TEST (test_type1_64_lp_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -374,25 +367,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_64_lp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -420,7 +412,7 @@ GST_START_TEST (test_type1_64_lp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -430,25 +422,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_64_hp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -474,7 +465,7 @@ GST_START_TEST (test_type1_64_hp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -484,25 +475,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type1_64_hp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -530,7 +520,7 @@ GST_START_TEST (test_type1_64_hp_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -540,25 +530,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_32_lp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -584,7 +573,7 @@ GST_START_TEST (test_type2_32_lp_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -594,25 +583,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_32_lp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -640,7 +628,7 @@ GST_START_TEST (test_type2_32_lp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -650,25 +638,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_32_hp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -694,7 +681,7 @@ GST_START_TEST (test_type2_32_hp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -704,25 +691,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_32_hp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gfloat *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); in = (gfloat *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -750,7 +736,7 @@ GST_START_TEST (test_type2_32_hp_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -760,25 +746,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_64_lp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -804,7 +789,7 @@ GST_START_TEST (test_type2_64_lp_0hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -814,25 +799,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_64_lp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -860,7 +844,7 @@ GST_START_TEST (test_type2_64_lp_22050hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -870,25 +854,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_64_hp_0hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i++) @@ -914,7 +897,7 @@ GST_START_TEST (test_type2_64_hp_0hz) fail_unless (rms <= 0.1); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; @@ -924,25 +907,24 @@ GST_END_TEST; * at rate/4 */ GST_START_TEST (test_type2_64_hp_22050hz) { - GstElement *audiochebyshevfreqlimit; + GstElement *audiocheblimit; GstBuffer *inbuffer, *outbuffer; GstCaps *caps; gdouble *in, *res, rms; gint i; - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); + audiocheblimit = setup_audiocheblimit (); /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); + g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL); + g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL); + g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL); + g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL); - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, + fail_unless (gst_element_set_state (audiocheblimit, GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, "could not set to playing"); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); + g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL); inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); in = (gdouble *) GST_BUFFER_DATA (inbuffer); for (i = 0; i < 128; i += 2) { @@ -970,16 +952,16 @@ GST_START_TEST (test_type2_64_hp_22050hz) fail_unless (rms >= 0.9); /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); + cleanup_audiocheblimit (audiocheblimit); } GST_END_TEST; Suite * -audiochebyshevfreqlimit_suite (void) +audiocheblimit_suite (void) { - Suite *s = suite_create ("audiochebyshevfreqlimit"); + Suite *s = suite_create ("audiocheblimit"); TCase *tc_chain = tcase_create ("general"); suite_add_tcase (s, tc_chain); @@ -1007,7 +989,7 @@ main (int argc, char **argv) { int nf; - Suite *s = audiochebyshevfreqlimit_suite (); + Suite *s = audiocheblimit_suite (); SRunner *sr = srunner_create (s); gst_check_init (&argc, &argv); diff --git a/tests/check/elements/audiochebyshevfreqband.c b/tests/check/elements/audiochebyshevfreqband.c deleted file mode 100644 index f4602e2c..00000000 --- a/tests/check/elements/audiochebyshevfreqband.c +++ /dev/null @@ -1,1540 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org> - * - * audiochebyshevfreqband.c: Unit test for the audiochebyshevfreqband element - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include <gst/gst.h> -#include <gst/base/gstbasetransform.h> -#include <gst/check/gstcheck.h> - -#include <math.h> - -/* For ease of programming we use globals to keep refs for our floating - * src and sink pads we create; otherwise we always have to do get_pad, - * get_peer, and then remove references in every test function */ -GstPad *mysrcpad, *mysinkpad; - -#define BUFFER_CAPS_STRING_32 \ - "audio/x-raw-float, " \ - "channels = (int) 1, " \ - "rate = (int) 44100, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 32" \ - -#define BUFFER_CAPS_STRING_64 \ - "audio/x-raw-float, " \ - "channels = (int) 1, " \ - "rate = (int) 44100, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 64" \ - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-float, " - "channels = (int) 1, " - "rate = (int) 44100, " - "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }") - ); -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-float, " - "channels = (int) 1, " - "rate = (int) 44100, " - "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }") - ); - -GstElement * -setup_audiochebyshevfreqband () -{ - GstElement *audiochebyshevfreqband; - - GST_DEBUG ("setup_audiochebyshevfreqband"); - audiochebyshevfreqband = gst_check_setup_element ("audiochebyshevfreqband"); - mysrcpad = - gst_check_setup_src_pad (audiochebyshevfreqband, &srctemplate, NULL); - mysinkpad = - gst_check_setup_sink_pad (audiochebyshevfreqband, &sinktemplate, NULL); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - return audiochebyshevfreqband; -} - -void -cleanup_audiochebyshevfreqband (GstElement * audiochebyshevfreqband) -{ - GST_DEBUG ("cleanup_audiochebyshevfreqband"); - - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - buffers = NULL; - - gst_pad_set_active (mysrcpad, FALSE); - gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (audiochebyshevfreqband); - gst_check_teardown_sink_pad (audiochebyshevfreqband); - gst_check_teardown_element (audiochebyshevfreqband); -} - -/* Test if data containing only one frequency component - * at 0 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_bp_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is preserved with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_bp_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.6); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_bp_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_br_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is erased with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_br_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_32_br_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_bp_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is preserved with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_bp_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.6); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_bp_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_br_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is erased with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_br_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type1_64_br_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_bp_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is preserved with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_bp_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.6); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_bp_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_br_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is erased with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_br_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_32_br_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_bp_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is preserved with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_bp_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.6); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with bandpass mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_bp_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandpass */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_br_0hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at band center is erased with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_br_11025hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 4) { - in[i] = 0.0; - in[i + 1] = 1.0; - in[i + 2] = 0.0; - in[i + 3] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with bandreject mode and a - * 2000Hz frequency band around rate/4 */ -GST_START_TEST (test_type2_64_br_22050hz) -{ - GstElement *audiochebyshevfreqband; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqband = setup_audiochebyshevfreqband (); - /* Set to bandreject */ - g_object_set (G_OBJECT (audiochebyshevfreqband), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqband, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqband), "lower-frequency", - 44100 / 4.0 - 1000, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqband), "upper-frequency", - 44100 / 4.0 + 1000, NULL); - inbuffer = gst_buffer_new_and_alloc (1024 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 1024; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 1024; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 1024.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqband (audiochebyshevfreqband); -} - -GST_END_TEST; - -Suite * -audiochebyshevfreqband_suite (void) -{ - Suite *s = suite_create ("audiochebyshevfreqband"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_type1_32_bp_0hz); - tcase_add_test (tc_chain, test_type1_32_bp_11025hz); - tcase_add_test (tc_chain, test_type1_32_bp_22050hz); - tcase_add_test (tc_chain, test_type1_32_br_0hz); - tcase_add_test (tc_chain, test_type1_32_br_11025hz); - tcase_add_test (tc_chain, test_type1_32_br_22050hz); - tcase_add_test (tc_chain, test_type1_64_bp_0hz); - tcase_add_test (tc_chain, test_type1_64_bp_11025hz); - tcase_add_test (tc_chain, test_type1_64_bp_22050hz); - tcase_add_test (tc_chain, test_type1_64_br_0hz); - tcase_add_test (tc_chain, test_type1_64_br_11025hz); - tcase_add_test (tc_chain, test_type1_64_br_22050hz); - tcase_add_test (tc_chain, test_type2_32_bp_0hz); - tcase_add_test (tc_chain, test_type2_32_bp_11025hz); - tcase_add_test (tc_chain, test_type2_32_bp_22050hz); - tcase_add_test (tc_chain, test_type2_32_br_0hz); - tcase_add_test (tc_chain, test_type2_32_br_11025hz); - tcase_add_test (tc_chain, test_type2_32_br_22050hz); - tcase_add_test (tc_chain, test_type2_64_bp_0hz); - tcase_add_test (tc_chain, test_type2_64_bp_11025hz); - tcase_add_test (tc_chain, test_type2_64_bp_22050hz); - tcase_add_test (tc_chain, test_type2_64_br_0hz); - tcase_add_test (tc_chain, test_type2_64_br_11025hz); - tcase_add_test (tc_chain, test_type2_64_br_22050hz); - - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = audiochebyshevfreqband_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} diff --git a/tests/check/elements/audiochebyshevfreqlimit.c b/tests/check/elements/audiochebyshevfreqlimit.c deleted file mode 100644 index bf7ad09e..00000000 --- a/tests/check/elements/audiochebyshevfreqlimit.c +++ /dev/null @@ -1,1020 +0,0 @@ -/* GStreamer - * - * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org> - * - * audiochebyshevfreqlimit.c: Unit test for the audiochebyshevfreqlimit element - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#include <gst/gst.h> -#include <gst/base/gstbasetransform.h> -#include <gst/check/gstcheck.h> - -#include <math.h> - -/* For ease of programming we use globals to keep refs for our floating - * src and sink pads we create; otherwise we always have to do get_pad, - * get_peer, and then remove references in every test function */ -GstPad *mysrcpad, *mysinkpad; - -#define BUFFER_CAPS_STRING_32 \ - "audio/x-raw-float, " \ - "channels = (int) 1, " \ - "rate = (int) 44100, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 32" \ - -#define BUFFER_CAPS_STRING_64 \ - "audio/x-raw-float, " \ - "channels = (int) 1, " \ - "rate = (int) 44100, " \ - "endianness = (int) BYTE_ORDER, " \ - "width = (int) 64" \ - -static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-float, " - "channels = (int) 1, " - "rate = (int) 44100, " - "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }") - ); -static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS ("audio/x-raw-float, " - "channels = (int) 1, " - "rate = (int) 44100, " - "endianness = (int) BYTE_ORDER, " "width = (int) { 32, 64 }") - ); - -GstElement * -setup_audiochebyshevfreqlimit () -{ - GstElement *audiochebyshevfreqlimit; - - GST_DEBUG ("setup_audiochebyshevfreqlimit"); - audiochebyshevfreqlimit = gst_check_setup_element ("audiochebyshevfreqlimit"); - mysrcpad = - gst_check_setup_src_pad (audiochebyshevfreqlimit, &srctemplate, NULL); - mysinkpad = - gst_check_setup_sink_pad (audiochebyshevfreqlimit, &sinktemplate, NULL); - gst_pad_set_active (mysrcpad, TRUE); - gst_pad_set_active (mysinkpad, TRUE); - - return audiochebyshevfreqlimit; -} - -void -cleanup_audiochebyshevfreqlimit (GstElement * audiochebyshevfreqlimit) -{ - GST_DEBUG ("cleanup_audiochebyshevfreqlimit"); - - g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); - g_list_free (buffers); - buffers = NULL; - - gst_pad_set_active (mysrcpad, FALSE); - gst_pad_set_active (mysinkpad, FALSE); - gst_check_teardown_src_pad (audiochebyshevfreqlimit); - gst_check_teardown_sink_pad (audiochebyshevfreqlimit); - gst_check_teardown_element (audiochebyshevfreqlimit); -} - -/* Test if data containing only one frequency component - * at 0 is preserved with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_32_lp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_32_lp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_32_hp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_32_hp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_64_lp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_64_lp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_64_hp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type1_64_hp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 0.25, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_32_lp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_32_lp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_32_hp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_32_hp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gfloat *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gfloat)); - in = (gfloat *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_32); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gfloat *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is preserved with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_64_lp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is erased with lowpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_64_lp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to lowpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 0, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at 0 is erased with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_64_hp_0hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i++) - in[i] = 1.0; - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms <= 0.1); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - -/* Test if data containing only one frequency component - * at rate/2 is preserved with highpass mode and a cutoff - * at rate/4 */ -GST_START_TEST (test_type2_64_hp_22050hz) -{ - GstElement *audiochebyshevfreqlimit; - GstBuffer *inbuffer, *outbuffer; - GstCaps *caps; - gdouble *in, *res, rms; - gint i; - - audiochebyshevfreqlimit = setup_audiochebyshevfreqlimit (); - /* Set to highpass */ - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "mode", 1, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "poles", 8, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "type", 2, NULL); - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "ripple", 40.0, NULL); - - fail_unless (gst_element_set_state (audiochebyshevfreqlimit, - GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS, - "could not set to playing"); - - g_object_set (G_OBJECT (audiochebyshevfreqlimit), "cutoff", 44100 / 4.0, - NULL); - inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble)); - in = (gdouble *) GST_BUFFER_DATA (inbuffer); - for (i = 0; i < 128; i += 2) { - in[i] = 1.0; - in[i + 1] = -1.0; - } - - caps = gst_caps_from_string (BUFFER_CAPS_STRING_64); - gst_buffer_set_caps (inbuffer, caps); - gst_caps_unref (caps); - ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); - - /* pushing gives away my reference ... */ - fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); - /* ... and puts a new buffer on the global list */ - fail_unless_equals_int (g_list_length (buffers), 1); - fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL); - - res = (gdouble *) GST_BUFFER_DATA (outbuffer); - - rms = 0.0; - for (i = 0; i < 128; i++) - rms += res[i] * res[i]; - rms = sqrt (rms / 128.0); - fail_unless (rms >= 0.9); - - /* cleanup */ - cleanup_audiochebyshevfreqlimit (audiochebyshevfreqlimit); -} - -GST_END_TEST; - - -Suite * -audiochebyshevfreqlimit_suite (void) -{ - Suite *s = suite_create ("audiochebyshevfreqlimit"); - TCase *tc_chain = tcase_create ("general"); - - suite_add_tcase (s, tc_chain); - tcase_add_test (tc_chain, test_type1_32_lp_0hz); - tcase_add_test (tc_chain, test_type1_32_lp_22050hz); - tcase_add_test (tc_chain, test_type1_32_hp_0hz); - tcase_add_test (tc_chain, test_type1_32_hp_22050hz); - tcase_add_test (tc_chain, test_type1_64_lp_0hz); - tcase_add_test (tc_chain, test_type1_64_lp_22050hz); - tcase_add_test (tc_chain, test_type1_64_hp_0hz); - tcase_add_test (tc_chain, test_type1_64_hp_22050hz); - tcase_add_test (tc_chain, test_type2_32_lp_0hz); - tcase_add_test (tc_chain, test_type2_32_lp_22050hz); - tcase_add_test (tc_chain, test_type2_32_hp_0hz); - tcase_add_test (tc_chain, test_type2_32_hp_22050hz); - tcase_add_test (tc_chain, test_type2_64_lp_0hz); - tcase_add_test (tc_chain, test_type2_64_lp_22050hz); - tcase_add_test (tc_chain, test_type2_64_hp_0hz); - tcase_add_test (tc_chain, test_type2_64_hp_22050hz); - return s; -} - -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = audiochebyshevfreqlimit_suite (); - SRunner *sr = srunner_create (s); - - gst_check_init (&argc, &argv); - - srunner_run_all (sr, CK_NORMAL); - nf = srunner_ntests_failed (sr); - srunner_free (sr); - - return nf; -} |