1 | /* |
---|
2 | Copyright (C) 2003 Paul Brossier |
---|
3 | |
---|
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. |
---|
8 | |
---|
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. |
---|
13 | |
---|
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. |
---|
17 | */ |
---|
18 | |
---|
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 | */ |
---|
29 | #ifndef SCALE_H |
---|
30 | #define SCALE_H |
---|
31 | |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" { |
---|
34 | #endif |
---|
35 | |
---|
36 | /** scale object */ |
---|
37 | typedef struct _aubio_scale_t aubio_scale_t; |
---|
38 | |
---|
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 | */ |
---|
47 | aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, |
---|
48 | smpl_t ilow, smpl_t ihig); |
---|
49 | /** delete a scale object |
---|
50 | |
---|
51 | \param s scale object as returned by new_aubio_scale |
---|
52 | |
---|
53 | */ |
---|
54 | void del_aubio_scale(aubio_scale_t *s); |
---|
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 | */ |
---|
71 | void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, |
---|
72 | smpl_t olow, smpl_t ohig); |
---|
73 | |
---|
74 | #ifdef __cplusplus |
---|
75 | } |
---|
76 | #endif |
---|
77 | |
---|
78 | #endif |
---|