| 1 |
#ifndef _LineSpectralFrequencies_h_ |
| 2 |
#define _LineSpectralFrequencies_h_ |
| 3 |
/* LineSpectralFrequencies.h |
| 4 |
* |
| 5 |
* Copyright (C) 2016-2020 David Weenink |
| 6 |
* |
| 7 |
* This program 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 program 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 program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include "LPC.h" |
| 23 |
#include "Matrix.h" |
| 24 |
#include "Graphics.h" |
| 25 |
|
| 26 |
#include "LineSpectralFrequencies_def.h" |
| 27 |
|
| 28 |
/* |
| 29 |
From Sampled: |
| 30 |
xmin, xmax : range of time (s) |
| 31 |
x1 : position of first frame (s) |
| 32 |
dx : step size (s) |
| 33 |
nx : number of frames |
| 34 |
*/ |
| 35 |
|
| 36 |
void LineSpectralFrequencies_init (LineSpectralFrequencies me, double tmin, double tmax, integer nt, double dt, double t1, integer numberOfFrequencies, double maximumFrequency); |
| 37 |
|
| 38 |
autoLineSpectralFrequencies LineSpectralFrequencies_create (double tmin, double tmax, integer nt, double dt, double t1, integer numberOfFrequencies, double maximumFrequency); |
| 39 |
|
| 40 |
void LineSpectralFrequencies_drawFrequencies (LineSpectralFrequencies me, Graphics g, double fromTime, double toTime, double fmin, double fmax, bool garnish); |
| 41 |
|
| 42 |
autoMatrix LineSpectralFrequencies_downto_Matrix (LineSpectralFrequencies me); |
| 43 |
|
| 44 |
/******************* Frames ************************************************/ |
| 45 |
|
| 46 |
void LineSpectralFrequencies_Frame_init (LineSpectralFrequencies_Frame me, integer numberOfFrequencies); |
| 47 |
|
| 48 |
static inline autoVEC LineSpectralFrequencies_listFrequenciesInFrame (LineSpectralFrequencies me, integer frameNumber) { |
| 49 |
my checkIndex (frameNumber); |
| 50 |
autoVEC result = zero_VEC (my maximumNumberOfFrequencies); |
| 51 |
result.all() <<= my d_frames [frameNumber]. frequencies.get(); |
| 52 |
return result; |
| 53 |
} |
| 54 |
|
| 55 |
static inline autoMAT LineSpectralFrequencies_listAllFrequencies (LineSpectralFrequencies me) { |
| 56 |
autoMAT result = zero_MAT (my maximumNumberOfFrequencies, my nx); |
| 57 |
for (integer iframe = 1; iframe <= my nx; iframe ++) { |
| 58 |
LineSpectralFrequencies_Frame lsf = & my d_frames [iframe]; |
| 59 |
result.column (iframe).part (1, lsf -> numberOfFrequencies) <<= lsf -> frequencies.get(); |
| 60 |
} |
| 61 |
return result; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
#endif /* _LineSpectralFrequencies_h_ */ |