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, smpl_t ilow, smpl_t ihig ); |
---|
48 | /** delete a scale object |
---|
49 | |
---|
50 | \param s scale object as returned by new_aubio_scale |
---|
51 | |
---|
52 | */ |
---|
53 | void del_aubio_scale(aubio_scale_t *s); |
---|
54 | /** scale input vector |
---|
55 | |
---|
56 | \param s scale object as returned by new_aubio_scale |
---|
57 | \param input vector to scale |
---|
58 | |
---|
59 | */ |
---|
60 | void aubio_scale_do(aubio_scale_t *s, fvec_t * input); |
---|
61 | /** modify scale parameters after object creation |
---|
62 | |
---|
63 | \param s scale object as returned by new_aubio_scale |
---|
64 | \param olow lower value of output function |
---|
65 | \param ohig higher value of output function |
---|
66 | \param ilow lower value of input function |
---|
67 | \param ihig higher value of output function |
---|
68 | |
---|
69 | */ |
---|
70 | void aubio_scale_set (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); |
---|
71 | |
---|
72 | #ifdef __cplusplus |
---|
73 | } |
---|
74 | #endif |
---|
75 | |
---|
76 | #endif |
---|