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 http://www.xiph.org/ *
11 ********************************************************************
13 function: utility functions for vorbis codec test suite.
16 ********************************************************************/
24 #include <vorbis/codec.h>
25 #include <vorbis/vorbisenc.h>
30 gen_windowed_sine (float *data, int len, float maximum)
33 memset (data, 0, len * sizeof (float)) ;
37 for (k = 0 ; k < len ; k++)
38 { data [k] = sin (2.0 * k * M_PI * 1.0 / 32.0 + 0.4) ;
40 /* Apply Hanning Window. */
41 data [k] *= maximum * (0.5 - 0.5 * cos (2.0 * M_PI * k / ((len) - 1))) ;
48 set_data_in (float * data, unsigned len, float value)
51 for (k = 0 ; k < len ; k++)