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