1 | /* |
---|
2 | Copyright (C) 2003-2013 Paul Brossier <piem@aubio.org> |
---|
3 | |
---|
4 | This file is part of aubio. |
---|
5 | |
---|
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/>. |
---|
18 | |
---|
19 | */ |
---|
20 | |
---|
21 | /** \file |
---|
22 | |
---|
23 | Vector scaling function |
---|
24 | |
---|
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: |
---|
27 | |
---|
28 | \f$ y = (x - ilow)*(ohig-olow)/(ihig-ilow) + olow \f$ |
---|
29 | |
---|
30 | */ |
---|
31 | #ifndef _AUBIO_SCALE_H |
---|
32 | #define _AUBIO_SCALE_H |
---|
33 | |
---|
34 | #ifdef __cplusplus |
---|
35 | extern "C" { |
---|
36 | #endif |
---|
37 | |
---|
38 | /** scale object */ |
---|
39 | typedef struct _aubio_scale_t aubio_scale_t; |
---|
40 | |
---|
41 | /** create a scale object |
---|
42 | |
---|
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 | */ |
---|
49 | aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, |
---|
50 | smpl_t ilow, smpl_t ihig); |
---|
51 | /** delete a scale object |
---|
52 | |
---|
53 | \param s scale object as returned by new_aubio_scale |
---|
54 | |
---|
55 | */ |
---|
56 | void del_aubio_scale(aubio_scale_t *s); |
---|
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 | */ |
---|
73 | uint_t aubio_scale_set_limits (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, |
---|
74 | smpl_t olow, smpl_t ohig); |
---|
75 | |
---|
76 | #ifdef __cplusplus |
---|
77 | } |
---|
78 | #endif |
---|
79 | |
---|
80 | #endif /* _AUBIO_SCALE_H */ |
---|