1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
9 * by the Xiph.Org Foundation https://xiph.org/ *
11 ********************************************************************
13 function: utility functions for vorbis codec test suite.
15 ********************************************************************/
23 #include <vorbis/codec.h>
24 #include <vorbis/vorbisenc.h>
29 gen_windowed_sine (float *data, int len, float maximum)
32 memset (data, 0, len * sizeof (float)) ;
36 for (k = 0 ; k < len ; k++)
37 { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ;
39 /* Apply Hanning Window. */
40 data [k] *= maximum * (0.5 - 0.5 * cos (2.0 * M_PI * k / ((len) - 1))) ;
47 set_data_in (float * data, unsigned len, float value)
50 for (k = 0 ; k < len ; k++)