Debian Codegraph @

LPC/LPC.h

raw
1 #ifndef _LPC_h_
2 #define _LPC_h_
3 /* LPC.h
4 *
5 * Copyright (C) 1994-2020,2025 David Weenink
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "Matrix.h"
22 #include "Graphics.h"
23 #include "LPC_enums.h"
24
25 #include "LPC_def.h"
26
27 /*
28 From Sampled:
29 xmin, xmax : range of time (s)
30 x1 : position of first frame (s)
31 dx : step size (s)
32 nx : number of frames
33 */
34
35 void LPC_init (LPC me, double tmin, double tmax, integer nt, double dt, double t1, integer predictionOrder, double samplingPeriod);
36
37 autoLPC LPC_create (double tmin, double tmax, integer nt, double dt, double t1, integer predictionOrder, double samplingPeriod);
38 /* Basic structure */
39
40 autoLPC LPC_createCompletelyInitialized (double tmin, double tmax, integer nt, double dt, double t1, integer predictionOrder, double samplingPeriod);
41 /* With all frames initialised */
42
43 void LPC_drawGain (LPC me, Graphics g, double t1, double t2, double gmin, double gmax, bool garnish);
44
45 void LPC_drawPoles (LPC me, Graphics g, double time, bool garnish);
46
47 autoMatrix LPC_downto_Matrix_lpc (LPC me);
48
49 autoMatrix LPC_downto_Matrix_rc (LPC me);
50
51 autoMatrix LPC_downto_Matrix_area (LPC me);
52
53 static inline autoVEC LPC_listAllGains (LPC me) {
54 autoVEC result = raw_VEC (my nx);
55 for (integer iframe = 1; iframe <= my nx; iframe ++)
56 result [iframe] = my d_frames [iframe]. gain;
57 return result;
58 }
59
60 static inline autoVEC LPC_listCoefficientsInFrame (LPC me, integer frameNumber) {
61 my checkIndex (frameNumber);
62 autoVEC result = copy_VEC (my d_frames [frameNumber]. a.get());
63 return result;
64 }
65
66 static inline autoMAT LPC_listAllCoefficients (LPC me) {
67 autoMAT result = zero_MAT (my maxnCoefficients, my nx);
68 for (integer iframe = 1; iframe <= my nx; iframe ++) {
69 LPC_Frame f = & my d_frames [iframe];
70 result.column (iframe).part (1, f -> nCoefficients) <<= f -> a.get();
71 }
72 return result;
73 }
74
75 /******************* Frames ************************************************/
76
77 void LPC_Frame_init (LPC_Frame me, integer nCoefficients);
78
79 #endif /* _LPC_h_ */