"Fossies" - the Fresh Open Source Software Archive

Member "gst-plugins-good-1.20.3/tests/check/elements/audiocheblimit.c" (15 Jun 2022, 34911 Bytes) of package /linux/misc/gst-plugins-good-1.20.3.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "audiocheblimit.c" see the Fossies "Dox" file reference documentation.

    1 /* GStreamer
    2  *
    3  * Copyright (C) 2007 Sebastian Dröge <slomo@circular-chaos.org>
    4  *
    5  * audiocheblimit.c: Unit test for the audiocheblimit element
    6  *
    7  * This library is free software; you can redistribute it and/or
    8  * modify it under the terms of the GNU Lesser General Public License
    9  * as published by the Free Software Foundation; either version 2.1 of
   10  * the License, or (at your option) any later version.
   11  * 
   12  * This library is distributed in the hope that it will be useful, but
   13  * WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15  * Lesser General Public License for more details.
   16  * 
   17  * You should have received a copy of the GNU Lesser General Public
   18  * License along with this library; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   20  * 02110-1301 USA
   21  */
   22 
   23 #include <gst/gst.h>
   24 #include <gst/audio/audio.h>
   25 #include <gst/base/gstbasetransform.h>
   26 #include <gst/check/gstcheck.h>
   27 
   28 #include <math.h>
   29 
   30 /* For ease of programming we use globals to keep refs for our floating
   31  * src and sink pads we create; otherwise we always have to do get_pad,
   32  * get_peer, and then remove references in every test function */
   33 GstPad *mysrcpad, *mysinkpad;
   34 
   35 #define BUFFER_CAPS_STRING_32           \
   36     "audio/x-raw, "                     \
   37     "channels = (int) 1, "              \
   38     "rate = (int) 44100, "              \
   39     "layout = (string) interleaved, "   \
   40     "format = (string) " GST_AUDIO_NE(F32)
   41 
   42 #define BUFFER_CAPS_STRING_64           \
   43     "audio/x-raw, "                     \
   44     "channels = (int) 1, "              \
   45     "rate = (int) 44100, "              \
   46     "layout = (string) interleaved, "   \
   47     "format = (string) " GST_AUDIO_NE(F64)
   48 
   49 static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
   50     GST_PAD_SINK,
   51     GST_PAD_ALWAYS,
   52     GST_STATIC_CAPS ("audio/x-raw, "
   53         "channels = (int) 1, "
   54         "rate = (int) 44100, "
   55         "layout = (string) interleaved, "
   56         "format = (string) { "
   57         GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }"));
   58 static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
   59     GST_PAD_SRC,
   60     GST_PAD_ALWAYS,
   61     GST_STATIC_CAPS ("audio/x-raw, "
   62         "channels = (int) 1, "
   63         "rate = (int) 44100, "
   64         "layout = (string) interleaved, "
   65         "format = (string) { "
   66         GST_AUDIO_NE (F32) ", " GST_AUDIO_NE (F64) " }"));
   67 
   68 static GstElement *
   69 setup_audiocheblimit (void)
   70 {
   71   GstElement *audiocheblimit;
   72 
   73   GST_DEBUG ("setup_audiocheblimit");
   74   audiocheblimit = gst_check_setup_element ("audiocheblimit");
   75   mysrcpad = gst_check_setup_src_pad (audiocheblimit, &srctemplate);
   76   mysinkpad = gst_check_setup_sink_pad (audiocheblimit, &sinktemplate);
   77   gst_pad_set_active (mysrcpad, TRUE);
   78   gst_pad_set_active (mysinkpad, TRUE);
   79 
   80   return audiocheblimit;
   81 }
   82 
   83 static void
   84 cleanup_audiocheblimit (GstElement * audiocheblimit)
   85 {
   86   GST_DEBUG ("cleanup_audiocheblimit");
   87 
   88   g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL);
   89   g_list_free (buffers);
   90   buffers = NULL;
   91 
   92   gst_pad_set_active (mysrcpad, FALSE);
   93   gst_pad_set_active (mysinkpad, FALSE);
   94   gst_check_teardown_src_pad (audiocheblimit);
   95   gst_check_teardown_sink_pad (audiocheblimit);
   96   gst_check_teardown_element (audiocheblimit);
   97 }
   98 
   99 /* Test if data containing only one frequency component
  100  * at 0 is preserved with lowpass mode and a cutoff
  101  * at rate/4 */
  102 GST_START_TEST (test_type1_32_lp_0hz)
  103 {
  104   GstElement *audiocheblimit;
  105   GstBuffer *inbuffer, *outbuffer;
  106   GstCaps *caps;
  107   gfloat *in, *res, rms;
  108   gint i;
  109   GstMapInfo map;
  110 
  111   audiocheblimit = setup_audiocheblimit ();
  112   /* Set to lowpass */
  113   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  114   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  115   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  116   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  117 
  118   fail_unless (gst_element_set_state (audiocheblimit,
  119           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  120       "could not set to playing");
  121 
  122   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  123   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  124   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  125   in = (gfloat *) map.data;
  126   for (i = 0; i < 128; i++)
  127     in[i] = 1.0;
  128   gst_buffer_unmap (inbuffer, &map);
  129 
  130   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  131   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  132   gst_caps_unref (caps);
  133   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  134 
  135   /* pushing gives away my reference ... */
  136   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  137   /* ... and puts a new buffer on the global list */
  138   fail_unless_equals_int (g_list_length (buffers), 1);
  139   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  140 
  141   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  142   res = (gfloat *) map.data;
  143 
  144   rms = 0.0;
  145   for (i = 0; i < 128; i++)
  146     rms += res[i] * res[i];
  147   rms = sqrt (rms / 128.0);
  148   fail_unless (rms >= 0.9);
  149 
  150   gst_buffer_unmap (outbuffer, &map);
  151 
  152   /* cleanup */
  153   cleanup_audiocheblimit (audiocheblimit);
  154 }
  155 
  156 GST_END_TEST;
  157 
  158 /* Test if data containing only one frequency component
  159  * at rate/2 is erased with lowpass mode and a cutoff
  160  * at rate/4 */
  161 GST_START_TEST (test_type1_32_lp_22050hz)
  162 {
  163   GstElement *audiocheblimit;
  164   GstBuffer *inbuffer, *outbuffer;
  165   GstCaps *caps;
  166   gfloat *in, *res, rms;
  167   gint i;
  168   GstMapInfo map;
  169 
  170   audiocheblimit = setup_audiocheblimit ();
  171   /* Set to lowpass */
  172   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  173   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  174   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  175   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  176 
  177   fail_unless (gst_element_set_state (audiocheblimit,
  178           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  179       "could not set to playing");
  180 
  181   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  182   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  183   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  184   in = (gfloat *) map.data;
  185   for (i = 0; i < 128; i += 2) {
  186     in[i] = 1.0;
  187     in[i + 1] = -1.0;
  188   }
  189   gst_buffer_unmap (inbuffer, &map);
  190 
  191   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  192   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  193   gst_caps_unref (caps);
  194   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  195 
  196   /* pushing gives away my reference ... */
  197   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  198   /* ... and puts a new buffer on the global list */
  199   fail_unless_equals_int (g_list_length (buffers), 1);
  200   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  201 
  202   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  203   res = (gfloat *) map.data;
  204 
  205   rms = 0.0;
  206   for (i = 0; i < 128; i++)
  207     rms += res[i] * res[i];
  208   rms = sqrt (rms / 128.0);
  209   fail_unless (rms <= 0.1);
  210 
  211   gst_buffer_unmap (outbuffer, &map);
  212 
  213   /* cleanup */
  214   cleanup_audiocheblimit (audiocheblimit);
  215 }
  216 
  217 GST_END_TEST;
  218 
  219 /* Test if data containing only one frequency component
  220  * at 0 is erased with highpass mode and a cutoff
  221  * at rate/4 */
  222 GST_START_TEST (test_type1_32_hp_0hz)
  223 {
  224   GstElement *audiocheblimit;
  225   GstBuffer *inbuffer, *outbuffer;
  226   GstCaps *caps;
  227   gfloat *in, *res, rms;
  228   gint i;
  229   GstMapInfo map;
  230 
  231   audiocheblimit = setup_audiocheblimit ();
  232   /* Set to highpass */
  233   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  234   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  235   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  236   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  237 
  238   fail_unless (gst_element_set_state (audiocheblimit,
  239           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  240       "could not set to playing");
  241 
  242   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  243   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  244   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  245   in = (gfloat *) map.data;
  246   for (i = 0; i < 128; i++)
  247     in[i] = 1.0;
  248   gst_buffer_unmap (inbuffer, &map);
  249 
  250   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  251   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  252   gst_caps_unref (caps);
  253   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  254 
  255   /* pushing gives away my reference ... */
  256   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  257   /* ... and puts a new buffer on the global list */
  258   fail_unless_equals_int (g_list_length (buffers), 1);
  259   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  260 
  261   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  262   res = (gfloat *) map.data;
  263 
  264   rms = 0.0;
  265   for (i = 0; i < 128; i++)
  266     rms += res[i] * res[i];
  267   rms = sqrt (rms / 128.0);
  268   fail_unless (rms <= 0.1);
  269 
  270   gst_buffer_unmap (outbuffer, &map);
  271 
  272   /* cleanup */
  273   cleanup_audiocheblimit (audiocheblimit);
  274 }
  275 
  276 GST_END_TEST;
  277 
  278 /* Test if data containing only one frequency component
  279  * at rate/2 is preserved with highpass mode and a cutoff
  280  * at rate/4 */
  281 GST_START_TEST (test_type1_32_hp_22050hz)
  282 {
  283   GstElement *audiocheblimit;
  284   GstBuffer *inbuffer, *outbuffer;
  285   GstCaps *caps;
  286   gfloat *in, *res, rms;
  287   gint i;
  288   GstMapInfo map;
  289 
  290   audiocheblimit = setup_audiocheblimit ();
  291   /* Set to highpass */
  292   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  293   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  294   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  295   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  296 
  297   fail_unless (gst_element_set_state (audiocheblimit,
  298           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  299       "could not set to playing");
  300 
  301   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  302   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  303   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  304   in = (gfloat *) map.data;
  305   for (i = 0; i < 128; i += 2) {
  306     in[i] = 1.0;
  307     in[i + 1] = -1.0;
  308   }
  309   gst_buffer_unmap (inbuffer, &map);
  310 
  311   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  312   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  313   gst_caps_unref (caps);
  314   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  315 
  316   /* pushing gives away my reference ... */
  317   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  318   /* ... and puts a new buffer on the global list */
  319   fail_unless_equals_int (g_list_length (buffers), 1);
  320   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  321 
  322   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  323   res = (gfloat *) map.data;
  324 
  325   rms = 0.0;
  326   for (i = 0; i < 128; i++)
  327     rms += res[i] * res[i];
  328   rms = sqrt (rms / 128.0);
  329   fail_unless (rms >= 0.9);
  330 
  331   gst_buffer_unmap (outbuffer, &map);
  332 
  333   /* cleanup */
  334   cleanup_audiocheblimit (audiocheblimit);
  335 }
  336 
  337 GST_END_TEST;
  338 
  339 /* Test if data containing only one frequency component
  340  * at 0 is preserved with lowpass mode and a cutoff
  341  * at rate/4 */
  342 GST_START_TEST (test_type1_64_lp_0hz)
  343 {
  344   GstElement *audiocheblimit;
  345   GstBuffer *inbuffer, *outbuffer;
  346   GstCaps *caps;
  347   gdouble *in, *res, rms;
  348   gint i;
  349   GstMapInfo map;
  350 
  351   audiocheblimit = setup_audiocheblimit ();
  352   /* Set to lowpass */
  353   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  354   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  355   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  356   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  357 
  358   fail_unless (gst_element_set_state (audiocheblimit,
  359           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  360       "could not set to playing");
  361 
  362   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  363   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), NULL);
  364   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  365   in = (gdouble *) map.data;
  366   for (i = 0; i < 128; i++)
  367     in[i] = 1.0;
  368   gst_buffer_unmap (inbuffer, &map);
  369 
  370   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  371   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  372   gst_caps_unref (caps);
  373   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  374 
  375   /* pushing gives away my reference ... */
  376   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  377   /* ... and puts a new buffer on the global list */
  378   fail_unless_equals_int (g_list_length (buffers), 1);
  379   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  380 
  381   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  382   res = (gdouble *) map.data;
  383 
  384   rms = 0.0;
  385   for (i = 0; i < 128; i++)
  386     rms += res[i] * res[i];
  387   rms = sqrt (rms / 128.0);
  388   fail_unless (rms >= 0.9);
  389 
  390   gst_buffer_unmap (outbuffer, &map);
  391 
  392   /* cleanup */
  393   cleanup_audiocheblimit (audiocheblimit);
  394 }
  395 
  396 GST_END_TEST;
  397 
  398 /* Test if data containing only one frequency component
  399  * at rate/2 is erased with lowpass mode and a cutoff
  400  * at rate/4 */
  401 GST_START_TEST (test_type1_64_lp_22050hz)
  402 {
  403   GstElement *audiocheblimit;
  404   GstBuffer *inbuffer, *outbuffer;
  405   GstCaps *caps;
  406   gdouble *in, *res, rms;
  407   gint i;
  408   GstMapInfo map;
  409 
  410   audiocheblimit = setup_audiocheblimit ();
  411   /* Set to lowpass */
  412   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  413   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  414   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  415   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  416 
  417   fail_unless (gst_element_set_state (audiocheblimit,
  418           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  419       "could not set to playing");
  420 
  421   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  422   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), NULL);
  423   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  424   in = (gdouble *) map.data;
  425   for (i = 0; i < 128; i += 2) {
  426     in[i] = 1.0;
  427     in[i + 1] = -1.0;
  428   }
  429   gst_buffer_unmap (inbuffer, &map);
  430 
  431   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  432   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  433   gst_caps_unref (caps);
  434   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  435 
  436   /* pushing gives away my reference ... */
  437   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  438   /* ... and puts a new buffer on the global list */
  439   fail_unless_equals_int (g_list_length (buffers), 1);
  440   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  441 
  442   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  443   res = (gdouble *) map.data;
  444 
  445   rms = 0.0;
  446   for (i = 0; i < 128; i++)
  447     rms += res[i] * res[i];
  448   rms = sqrt (rms / 128.0);
  449   fail_unless (rms <= 0.1);
  450 
  451   gst_buffer_unmap (outbuffer, &map);
  452 
  453   /* cleanup */
  454   cleanup_audiocheblimit (audiocheblimit);
  455 }
  456 
  457 GST_END_TEST;
  458 
  459 /* Test if data containing only one frequency component
  460  * at 0 is erased with highpass mode and a cutoff
  461  * at rate/4 */
  462 GST_START_TEST (test_type1_64_hp_0hz)
  463 {
  464   GstElement *audiocheblimit;
  465   GstBuffer *inbuffer, *outbuffer;
  466   GstCaps *caps;
  467   gdouble *in, *res, rms;
  468   gint i;
  469   GstMapInfo map;
  470 
  471   audiocheblimit = setup_audiocheblimit ();
  472   /* Set to highpass */
  473   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  474   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  475   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  476   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  477 
  478   fail_unless (gst_element_set_state (audiocheblimit,
  479           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  480       "could not set to playing");
  481 
  482   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  483   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), NULL);
  484   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  485   in = (gdouble *) map.data;
  486   for (i = 0; i < 128; i++)
  487     in[i] = 1.0;
  488   gst_buffer_unmap (inbuffer, &map);
  489 
  490   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  491   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  492   gst_caps_unref (caps);
  493   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  494 
  495   /* pushing gives away my reference ... */
  496   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  497   /* ... and puts a new buffer on the global list */
  498   fail_unless_equals_int (g_list_length (buffers), 1);
  499   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  500 
  501   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  502   res = (gdouble *) map.data;
  503 
  504   rms = 0.0;
  505   for (i = 0; i < 128; i++)
  506     rms += res[i] * res[i];
  507   rms = sqrt (rms / 128.0);
  508   fail_unless (rms <= 0.1);
  509 
  510   gst_buffer_unmap (outbuffer, &map);
  511 
  512   /* cleanup */
  513   cleanup_audiocheblimit (audiocheblimit);
  514 }
  515 
  516 GST_END_TEST;
  517 
  518 /* Test if data containing only one frequency component
  519  * at rate/2 is preserved with highpass mode and a cutoff
  520  * at rate/4 */
  521 GST_START_TEST (test_type1_64_hp_22050hz)
  522 {
  523   GstElement *audiocheblimit;
  524   GstBuffer *inbuffer, *outbuffer;
  525   GstCaps *caps;
  526   gdouble *in, *res, rms;
  527   gint i;
  528   GstMapInfo map;
  529 
  530   audiocheblimit = setup_audiocheblimit ();
  531   /* Set to highpass */
  532   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  533   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  534   g_object_set (G_OBJECT (audiocheblimit), "type", 1, NULL);
  535   g_object_set (G_OBJECT (audiocheblimit), "ripple", 0.25, NULL);
  536 
  537   fail_unless (gst_element_set_state (audiocheblimit,
  538           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  539       "could not set to playing");
  540 
  541   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  542   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gdouble), NULL);
  543   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  544   in = (gdouble *) map.data;
  545   for (i = 0; i < 128; i += 2) {
  546     in[i] = 1.0;
  547     in[i + 1] = -1.0;
  548   }
  549   gst_buffer_unmap (inbuffer, &map);
  550 
  551   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  552   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  553   gst_caps_unref (caps);
  554   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  555 
  556   /* pushing gives away my reference ... */
  557   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  558   /* ... and puts a new buffer on the global list */
  559   fail_unless_equals_int (g_list_length (buffers), 1);
  560   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  561 
  562   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  563   res = (gdouble *) map.data;
  564 
  565   rms = 0.0;
  566   for (i = 0; i < 128; i++)
  567     rms += res[i] * res[i];
  568   rms = sqrt (rms / 128.0);
  569   fail_unless (rms >= 0.9);
  570 
  571   gst_buffer_unmap (outbuffer, &map);
  572 
  573   /* cleanup */
  574   cleanup_audiocheblimit (audiocheblimit);
  575 }
  576 
  577 GST_END_TEST;
  578 
  579 /* Test if data containing only one frequency component
  580  * at 0 is preserved with lowpass mode and a cutoff
  581  * at rate/4 */
  582 GST_START_TEST (test_type2_32_lp_0hz)
  583 {
  584   GstElement *audiocheblimit;
  585   GstBuffer *inbuffer, *outbuffer;
  586   GstCaps *caps;
  587   gfloat *in, *res, rms;
  588   gint i;
  589   GstMapInfo map;
  590 
  591   audiocheblimit = setup_audiocheblimit ();
  592   /* Set to lowpass */
  593   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  594   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  595   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  596   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  597 
  598   fail_unless (gst_element_set_state (audiocheblimit,
  599           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  600       "could not set to playing");
  601 
  602   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  603   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  604   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  605   in = (gfloat *) map.data;
  606   for (i = 0; i < 128; i++)
  607     in[i] = 1.0;
  608   gst_buffer_unmap (inbuffer, &map);
  609 
  610   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  611   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  612   gst_caps_unref (caps);
  613   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  614 
  615   /* pushing gives away my reference ... */
  616   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  617   /* ... and puts a new buffer on the global list */
  618   fail_unless_equals_int (g_list_length (buffers), 1);
  619   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  620 
  621   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  622   res = (gfloat *) map.data;
  623 
  624   rms = 0.0;
  625   for (i = 0; i < 128; i++)
  626     rms += res[i] * res[i];
  627   rms = sqrt (rms / 128.0);
  628   fail_unless (rms >= 0.9);
  629 
  630   gst_buffer_unmap (outbuffer, &map);
  631 
  632   /* cleanup */
  633   cleanup_audiocheblimit (audiocheblimit);
  634 }
  635 
  636 GST_END_TEST;
  637 
  638 /* Test if data containing only one frequency component
  639  * at rate/2 is erased with lowpass mode and a cutoff
  640  * at rate/4 */
  641 GST_START_TEST (test_type2_32_lp_22050hz)
  642 {
  643   GstElement *audiocheblimit;
  644   GstBuffer *inbuffer, *outbuffer;
  645   GstCaps *caps;
  646   gfloat *in, *res, rms;
  647   gint i;
  648   GstMapInfo map;
  649 
  650   audiocheblimit = setup_audiocheblimit ();
  651   /* Set to lowpass */
  652   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  653   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  654   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  655   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  656 
  657   fail_unless (gst_element_set_state (audiocheblimit,
  658           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  659       "could not set to playing");
  660 
  661   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  662   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  663   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  664   in = (gfloat *) map.data;
  665   for (i = 0; i < 128; i += 2) {
  666     in[i] = 1.0;
  667     in[i + 1] = -1.0;
  668   }
  669   gst_buffer_unmap (inbuffer, &map);
  670 
  671   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  672   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  673   gst_caps_unref (caps);
  674   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  675 
  676   /* pushing gives away my reference ... */
  677   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  678   /* ... and puts a new buffer on the global list */
  679   fail_unless_equals_int (g_list_length (buffers), 1);
  680   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  681 
  682   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  683   res = (gfloat *) map.data;
  684 
  685   rms = 0.0;
  686   for (i = 0; i < 128; i++)
  687     rms += res[i] * res[i];
  688   rms = sqrt (rms / 128.0);
  689   fail_unless (rms <= 0.1);
  690 
  691   gst_buffer_unmap (outbuffer, &map);
  692 
  693   /* cleanup */
  694   cleanup_audiocheblimit (audiocheblimit);
  695 }
  696 
  697 GST_END_TEST;
  698 
  699 /* Test if data containing only one frequency component
  700  * at 0 is erased with highpass mode and a cutoff
  701  * at rate/4 */
  702 GST_START_TEST (test_type2_32_hp_0hz)
  703 {
  704   GstElement *audiocheblimit;
  705   GstBuffer *inbuffer, *outbuffer;
  706   GstCaps *caps;
  707   gfloat *in, *res, rms;
  708   gint i;
  709   GstMapInfo map;
  710 
  711   audiocheblimit = setup_audiocheblimit ();
  712   /* Set to highpass */
  713   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  714   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  715   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  716   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  717 
  718   fail_unless (gst_element_set_state (audiocheblimit,
  719           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  720       "could not set to playing");
  721 
  722   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  723   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  724   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  725   in = (gfloat *) map.data;
  726   for (i = 0; i < 128; i++)
  727     in[i] = 1.0;
  728   gst_buffer_unmap (inbuffer, &map);
  729 
  730   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  731   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  732   gst_caps_unref (caps);
  733   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  734 
  735   /* pushing gives away my reference ... */
  736   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  737   /* ... and puts a new buffer on the global list */
  738   fail_unless_equals_int (g_list_length (buffers), 1);
  739   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  740 
  741   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  742   res = (gfloat *) map.data;
  743 
  744   rms = 0.0;
  745   for (i = 0; i < 128; i++)
  746     rms += res[i] * res[i];
  747   rms = sqrt (rms / 128.0);
  748   fail_unless (rms <= 0.1);
  749 
  750   gst_buffer_unmap (outbuffer, &map);
  751 
  752   /* cleanup */
  753   cleanup_audiocheblimit (audiocheblimit);
  754 }
  755 
  756 GST_END_TEST;
  757 
  758 /* Test if data containing only one frequency component
  759  * at rate/2 is preserved with highpass mode and a cutoff
  760  * at rate/4 */
  761 GST_START_TEST (test_type2_32_hp_22050hz)
  762 {
  763   GstElement *audiocheblimit;
  764   GstBuffer *inbuffer, *outbuffer;
  765   GstCaps *caps;
  766   gfloat *in, *res, rms;
  767   gint i;
  768   GstMapInfo map;
  769 
  770   audiocheblimit = setup_audiocheblimit ();
  771   /* Set to highpass */
  772   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  773   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  774   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  775   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  776 
  777   fail_unless (gst_element_set_state (audiocheblimit,
  778           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  779       "could not set to playing");
  780 
  781   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  782   inbuffer = gst_buffer_new_allocate (NULL, 128 * sizeof (gfloat), NULL);
  783   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  784   in = (gfloat *) map.data;
  785   for (i = 0; i < 128; i += 2) {
  786     in[i] = 1.0;
  787     in[i + 1] = -1.0;
  788   }
  789   gst_buffer_unmap (inbuffer, &map);
  790 
  791   caps = gst_caps_from_string (BUFFER_CAPS_STRING_32);
  792   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  793   gst_caps_unref (caps);
  794   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  795 
  796   /* pushing gives away my reference ... */
  797   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  798   /* ... and puts a new buffer on the global list */
  799   fail_unless_equals_int (g_list_length (buffers), 1);
  800   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  801 
  802   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  803   res = (gfloat *) map.data;
  804 
  805   rms = 0.0;
  806   for (i = 0; i < 128; i++)
  807     rms += res[i] * res[i];
  808   rms = sqrt (rms / 128.0);
  809   fail_unless (rms >= 0.9);
  810 
  811   gst_buffer_unmap (outbuffer, &map);
  812 
  813   /* cleanup */
  814   cleanup_audiocheblimit (audiocheblimit);
  815 }
  816 
  817 GST_END_TEST;
  818 
  819 /* Test if data containing only one frequency component
  820  * at 0 is preserved with lowpass mode and a cutoff
  821  * at rate/4 */
  822 GST_START_TEST (test_type2_64_lp_0hz)
  823 {
  824   GstElement *audiocheblimit;
  825   GstBuffer *inbuffer, *outbuffer;
  826   GstCaps *caps;
  827   gdouble *in, *res, rms;
  828   gint i;
  829   GstMapInfo map;
  830 
  831   audiocheblimit = setup_audiocheblimit ();
  832   /* Set to lowpass */
  833   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  834   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  835   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  836   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  837 
  838   fail_unless (gst_element_set_state (audiocheblimit,
  839           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  840       "could not set to playing");
  841 
  842   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  843   inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
  844   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  845   in = (gdouble *) map.data;
  846   for (i = 0; i < 128; i++)
  847     in[i] = 1.0;
  848   gst_buffer_unmap (inbuffer, &map);
  849 
  850   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  851   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  852   gst_caps_unref (caps);
  853   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  854 
  855   /* pushing gives away my reference ... */
  856   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  857   /* ... and puts a new buffer on the global list */
  858   fail_unless_equals_int (g_list_length (buffers), 1);
  859   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  860 
  861   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  862   res = (gdouble *) map.data;
  863 
  864   rms = 0.0;
  865   for (i = 0; i < 128; i++)
  866     rms += res[i] * res[i];
  867   rms = sqrt (rms / 128.0);
  868   fail_unless (rms >= 0.9);
  869 
  870   gst_buffer_unmap (outbuffer, &map);
  871 
  872   /* cleanup */
  873   cleanup_audiocheblimit (audiocheblimit);
  874 }
  875 
  876 GST_END_TEST;
  877 
  878 /* Test if data containing only one frequency component
  879  * at rate/2 is erased with lowpass mode and a cutoff
  880  * at rate/4 */
  881 GST_START_TEST (test_type2_64_lp_22050hz)
  882 {
  883   GstElement *audiocheblimit;
  884   GstBuffer *inbuffer, *outbuffer;
  885   GstCaps *caps;
  886   gdouble *in, *res, rms;
  887   gint i;
  888   GstMapInfo map;
  889 
  890   audiocheblimit = setup_audiocheblimit ();
  891   /* Set to lowpass */
  892   g_object_set (G_OBJECT (audiocheblimit), "mode", 0, NULL);
  893   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  894   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  895   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  896 
  897   fail_unless (gst_element_set_state (audiocheblimit,
  898           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  899       "could not set to playing");
  900 
  901   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  902   inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
  903   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  904   in = (gdouble *) map.data;
  905   for (i = 0; i < 128; i += 2) {
  906     in[i] = 1.0;
  907     in[i + 1] = -1.0;
  908   }
  909   gst_buffer_unmap (inbuffer, &map);
  910 
  911   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  912   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  913   gst_caps_unref (caps);
  914   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  915 
  916   /* pushing gives away my reference ... */
  917   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  918   /* ... and puts a new buffer on the global list */
  919   fail_unless_equals_int (g_list_length (buffers), 1);
  920   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  921 
  922   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  923   res = (gdouble *) map.data;
  924 
  925   rms = 0.0;
  926   for (i = 0; i < 128; i++)
  927     rms += res[i] * res[i];
  928   rms = sqrt (rms / 128.0);
  929   fail_unless (rms <= 0.1);
  930 
  931   gst_buffer_unmap (outbuffer, &map);
  932 
  933   /* cleanup */
  934   cleanup_audiocheblimit (audiocheblimit);
  935 }
  936 
  937 GST_END_TEST;
  938 
  939 /* Test if data containing only one frequency component
  940  * at 0 is erased with highpass mode and a cutoff
  941  * at rate/4 */
  942 GST_START_TEST (test_type2_64_hp_0hz)
  943 {
  944   GstElement *audiocheblimit;
  945   GstBuffer *inbuffer, *outbuffer;
  946   GstCaps *caps;
  947   gdouble *in, *res, rms;
  948   gint i;
  949   GstMapInfo map;
  950 
  951   audiocheblimit = setup_audiocheblimit ();
  952   /* Set to highpass */
  953   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
  954   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
  955   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
  956   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
  957 
  958   fail_unless (gst_element_set_state (audiocheblimit,
  959           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
  960       "could not set to playing");
  961 
  962   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
  963   inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
  964   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
  965   in = (gdouble *) map.data;
  966   for (i = 0; i < 128; i++)
  967     in[i] = 1.0;
  968   gst_buffer_unmap (inbuffer, &map);
  969 
  970   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
  971   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
  972   gst_caps_unref (caps);
  973   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
  974 
  975   /* pushing gives away my reference ... */
  976   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
  977   /* ... and puts a new buffer on the global list */
  978   fail_unless_equals_int (g_list_length (buffers), 1);
  979   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
  980 
  981   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
  982   res = (gdouble *) map.data;
  983 
  984   rms = 0.0;
  985   for (i = 0; i < 128; i++)
  986     rms += res[i] * res[i];
  987   rms = sqrt (rms / 128.0);
  988   fail_unless (rms <= 0.1);
  989 
  990   gst_buffer_unmap (outbuffer, &map);
  991 
  992   /* cleanup */
  993   cleanup_audiocheblimit (audiocheblimit);
  994 }
  995 
  996 GST_END_TEST;
  997 
  998 /* Test if data containing only one frequency component
  999  * at rate/2 is preserved with highpass mode and a cutoff
 1000  * at rate/4 */
 1001 GST_START_TEST (test_type2_64_hp_22050hz)
 1002 {
 1003   GstElement *audiocheblimit;
 1004   GstBuffer *inbuffer, *outbuffer;
 1005   GstCaps *caps;
 1006   gdouble *in, *res, rms;
 1007   gint i;
 1008   GstMapInfo map;
 1009 
 1010   audiocheblimit = setup_audiocheblimit ();
 1011   /* Set to highpass */
 1012   g_object_set (G_OBJECT (audiocheblimit), "mode", 1, NULL);
 1013   g_object_set (G_OBJECT (audiocheblimit), "poles", 8, NULL);
 1014   g_object_set (G_OBJECT (audiocheblimit), "type", 2, NULL);
 1015   g_object_set (G_OBJECT (audiocheblimit), "ripple", 40.0, NULL);
 1016 
 1017   fail_unless (gst_element_set_state (audiocheblimit,
 1018           GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
 1019       "could not set to playing");
 1020 
 1021   g_object_set (G_OBJECT (audiocheblimit), "cutoff", 44100 / 4.0, NULL);
 1022   inbuffer = gst_buffer_new_and_alloc (128 * sizeof (gdouble));
 1023   gst_buffer_map (inbuffer, &map, GST_MAP_WRITE);
 1024   in = (gdouble *) map.data;
 1025   for (i = 0; i < 128; i += 2) {
 1026     in[i] = 1.0;
 1027     in[i + 1] = -1.0;
 1028   }
 1029   gst_buffer_unmap (inbuffer, &map);
 1030 
 1031   caps = gst_caps_from_string (BUFFER_CAPS_STRING_64);
 1032   gst_check_setup_events (mysrcpad, audiocheblimit, caps, GST_FORMAT_TIME);
 1033   gst_caps_unref (caps);
 1034   ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
 1035 
 1036   /* pushing gives away my reference ... */
 1037   fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
 1038   /* ... and puts a new buffer on the global list */
 1039   fail_unless_equals_int (g_list_length (buffers), 1);
 1040   fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
 1041 
 1042   gst_buffer_map (outbuffer, &map, GST_MAP_READ);
 1043   res = (gdouble *) map.data;
 1044 
 1045   rms = 0.0;
 1046   for (i = 0; i < 128; i++)
 1047     rms += res[i] * res[i];
 1048   rms = sqrt (rms / 128.0);
 1049   fail_unless (rms >= 0.9);
 1050 
 1051   gst_buffer_unmap (outbuffer, &map);
 1052 
 1053   /* cleanup */
 1054   cleanup_audiocheblimit (audiocheblimit);
 1055 }
 1056 
 1057 GST_END_TEST;
 1058 
 1059 
 1060 static Suite *
 1061 audiocheblimit_suite (void)
 1062 {
 1063   Suite *s = suite_create ("audiocheblimit");
 1064   TCase *tc_chain = tcase_create ("general");
 1065 
 1066   suite_add_tcase (s, tc_chain);
 1067   tcase_add_test (tc_chain, test_type1_32_lp_0hz);
 1068   tcase_add_test (tc_chain, test_type1_32_lp_22050hz);
 1069   tcase_add_test (tc_chain, test_type1_32_hp_0hz);
 1070   tcase_add_test (tc_chain, test_type1_32_hp_22050hz);
 1071   tcase_add_test (tc_chain, test_type1_64_lp_0hz);
 1072   tcase_add_test (tc_chain, test_type1_64_lp_22050hz);
 1073   tcase_add_test (tc_chain, test_type1_64_hp_0hz);
 1074   tcase_add_test (tc_chain, test_type1_64_hp_22050hz);
 1075   tcase_add_test (tc_chain, test_type2_32_lp_0hz);
 1076   tcase_add_test (tc_chain, test_type2_32_lp_22050hz);
 1077   tcase_add_test (tc_chain, test_type2_32_hp_0hz);
 1078   tcase_add_test (tc_chain, test_type2_32_hp_22050hz);
 1079   tcase_add_test (tc_chain, test_type2_64_lp_0hz);
 1080   tcase_add_test (tc_chain, test_type2_64_lp_22050hz);
 1081   tcase_add_test (tc_chain, test_type2_64_hp_0hz);
 1082   tcase_add_test (tc_chain, test_type2_64_hp_22050hz);
 1083   return s;
 1084 }
 1085 
 1086 GST_CHECK_MAIN (audiocheblimit);