[96fb8ad] | 1 | /* |
---|
[82f0c4e7] | 2 | Copyright (C) 2003 Paul Brossier |
---|
[96fb8ad] | 3 | |
---|
[82f0c4e7] | 4 | This program is free software; you can redistribute it and/or modify |
---|
| 5 | it under the terms of the GNU General Public License as published by |
---|
| 6 | the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | (at your option) any later version. |
---|
[96fb8ad] | 8 | |
---|
[82f0c4e7] | 9 | This program is distributed in the hope that it will be useful, |
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | GNU General Public License for more details. |
---|
[96fb8ad] | 13 | |
---|
[82f0c4e7] | 14 | You should have received a copy of the GNU General Public License |
---|
| 15 | along with this program; if not, write to the Free Software |
---|
| 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
[680137a] | 17 | */ |
---|
[96fb8ad] | 18 | |
---|
[680137a] | 19 | /** \file |
---|
| 20 | |
---|
| 21 | Vector scaling function |
---|
| 22 | |
---|
| 23 | This object, inspired from the scale object in FTS, the jMax engine, scales |
---|
| 24 | the values of a vector according to an affine function defined as follow: |
---|
| 25 | |
---|
| 26 | \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ |
---|
| 27 | |
---|
| 28 | */ |
---|
[96fb8ad] | 29 | #ifndef SCALE_H |
---|
| 30 | #define SCALE_H |
---|
| 31 | |
---|
| 32 | #ifdef __cplusplus |
---|
| 33 | extern "C" { |
---|
| 34 | #endif |
---|
| 35 | |
---|
[680137a] | 36 | /** scale object */ |
---|
[96fb8ad] | 37 | typedef struct _aubio_scale_t aubio_scale_t; |
---|
| 38 | |
---|
[680137a] | 39 | /** create a scale object |
---|
| 40 | |
---|
| 41 | \param flow lower value of output function |
---|
| 42 | \param fhig higher value of output function |
---|
| 43 | \param ilow lower value of input function |
---|
| 44 | \param ihig higher value of output function |
---|
| 45 | |
---|
| 46 | */ |
---|
[82f0c4e7] | 47 | aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, |
---|
| 48 | smpl_t ilow, smpl_t ihig); |
---|
[680137a] | 49 | /** delete a scale object |
---|
| 50 | |
---|
| 51 | \param s scale object as returned by new_aubio_scale |
---|
| 52 | |
---|
| 53 | */ |
---|
[96fb8ad] | 54 | void del_aubio_scale(aubio_scale_t *s); |
---|
[680137a] | 55 | /** scale input vector |
---|
| 56 | |
---|
| 57 | \param s scale object as returned by new_aubio_scale |
---|
| 58 | \param input vector to scale |
---|
| 59 | |
---|
| 60 | */ |
---|
| 61 | void aubio_scale_do(aubio_scale_t *s, fvec_t * input); |
---|
| 62 | /** modify scale parameters after object creation |
---|
| 63 | |
---|
| 64 | \param s scale object as returned by new_aubio_scale |
---|
| 65 | \param olow lower value of output function |
---|
| 66 | \param ohig higher value of output function |
---|
| 67 | \param ilow lower value of input function |
---|
| 68 | \param ihig higher value of output function |
---|
| 69 | |
---|
| 70 | */ |
---|
[82f0c4e7] | 71 | void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, |
---|
| 72 | smpl_t olow, smpl_t ohig); |
---|
[96fb8ad] | 73 | |
---|
| 74 | #ifdef __cplusplus |
---|
| 75 | } |
---|
| 76 | #endif |
---|
| 77 | |
---|
| 78 | #endif |
---|