1 #ifndef _Intensity_h_ 2 #define _Intensity_h_ 3 /* Intensity.h 4 * 5 * Copyright (C) 1992-2005,2007,2011,2015-2017,2019 Paul Boersma 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. 15 * See the GNU 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 /* 22 class Intensity = Vector; 23 24 x == time (seconds) 25 nx == number of frames 26 dx == distance between frames (seconds) 27 x1 == centre of first frame (seconds) 28 z == intensity (dB relative to 2e-5 N/m2 or 1e-12 W/m2) 29 */ 30 31 #include "Vector.h" 32 33 Thing_define (Intensity, Vector) { 34 void v_info () 35 override; 36 int v_domainQuantity () 37 override { return MelderQuantity_TIME_SECONDS; } 38 double v_convertStandardToSpecialUnit (double value, integer level, int unit) 39 override; 40 double v_convertSpecialToStandardUnit (double value, integer level, int unit) 41 override; 42 }; 43 44 autoIntensity Intensity_create (double tmin, double tmax, integer nt, double dt, double t1); 45 46 void Intensity_init (Intensity me, double tmin, double tmax, integer nt, double dt, double t1); 47 48 autoMatrix Intensity_to_Matrix (Intensity me); 49 50 autoIntensity Matrix_to_Intensity (Matrix me); 51 52 void Intensity_drawInside (Intensity me, Graphics g, double tmin, double tmax, 53 double minimum, double maximum); 54 55 void Intensity_draw (Intensity me, Graphics g, double tmin, double tmax, 56 double minimum, double maximum, bool garnish); 57 58 double Intensity_getQuantile (Intensity me, double tmin, double tmax, double quantile); 59 60 #define Intensity_units_ENERGY 1 61 #define Intensity_units_SONES 2 62 #define Intensity_units_DB 3 63 64 #define Intensity_averaging_MEDIAN 0 65 #define Intensity_averaging_ENERGY 1 66 #define Intensity_averaging_SONES 2 67 #define Intensity_averaging_DB 3 68 double Intensity_getAverage (Intensity me, double tmin, double tmax, int averagingMethod); 69 70 /* End of file Intensity.h */ 71 #endif 72