andrew@0: /* andrew@0: Copyright (C) 2003 Paul Brossier andrew@0: andrew@0: This program is free software; you can redistribute it and/or modify andrew@0: it under the terms of the GNU General Public License as published by andrew@0: the Free Software Foundation; either version 2 of the License, or andrew@0: (at your option) any later version. andrew@0: andrew@0: This program is distributed in the hope that it will be useful, andrew@0: but WITHOUT ANY WARRANTY; without even the implied warranty of andrew@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrew@0: GNU General Public License for more details. andrew@0: andrew@0: You should have received a copy of the GNU General Public License andrew@0: along with this program; if not, write to the Free Software andrew@0: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. andrew@0: */ andrew@0: andrew@0: /** \file andrew@0: andrew@0: Vector scaling function andrew@0: andrew@0: This object, inspired from the scale object in FTS, the jMax engine, scales andrew@0: the values of a vector according to an affine function defined as follow: andrew@0: andrew@0: \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ andrew@0: andrew@0: */ andrew@0: #ifndef SCALE_H andrew@0: #define SCALE_H andrew@0: andrew@0: #ifdef __cplusplus andrew@0: extern "C" { andrew@0: #endif andrew@0: andrew@0: /** scale object */ andrew@0: typedef struct _aubio_scale_t aubio_scale_t; andrew@0: andrew@0: /** create a scale object andrew@0: andrew@0: \param flow lower value of output function andrew@0: \param fhig higher value of output function andrew@0: \param ilow lower value of input function andrew@0: \param ihig higher value of output function andrew@0: andrew@0: */ andrew@0: aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, smpl_t ilow, smpl_t ihig ); andrew@0: /** delete a scale object andrew@0: andrew@0: \param s scale object as returned by new_aubio_scale andrew@0: andrew@0: */ andrew@0: void del_aubio_scale(aubio_scale_t *s); andrew@0: /** scale input vector andrew@0: andrew@0: \param s scale object as returned by new_aubio_scale andrew@0: \param input vector to scale andrew@0: andrew@0: */ andrew@0: void aubio_scale_do(aubio_scale_t *s, fvec_t * input); andrew@0: /** modify scale parameters after object creation andrew@0: andrew@0: \param s scale object as returned by new_aubio_scale andrew@0: \param olow lower value of output function andrew@0: \param ohig higher value of output function andrew@0: \param ilow lower value of input function andrew@0: \param ihig higher value of output function andrew@0: andrew@0: */ andrew@0: void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); andrew@0: andrew@0: #ifdef __cplusplus andrew@0: } andrew@0: #endif andrew@0: andrew@0: #endif