2 * Copyright (C) 2006, 2016 Paul Davis
3 * Written by Sampo Savolainen & Robin Gareus
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #ifndef __ardour_fft_result_h
21 #define __ardour_fft_result_h
26 #include <gdkmm/color.h>
38 void analyzeWindow (float *window);
41 unsigned int length () const { return _dataSize; }
43 float avgAt (unsigned int x, bool p) const
44 { return p ? _data_prop_avg[x] : _data_flat_avg[x]; }
45 float maxAt (unsigned int x, bool p) const
46 { return p ? _data_prop_max[x] : _data_flat_max[x]; }
47 float minAt (unsigned int x, bool p) const
48 { return p ? _data_prop_min[x] : _data_flat_min[x]; }
50 float minimum (bool p) const
51 { return p ? _min_prop : _min_flat; }
52 float maximum (bool p) const
53 { return p ? _max_prop : _max_flat; }
55 const Gdk::Color& get_color () const { return _color; }
58 FFTResult (FFTGraph *graph, Gdk::Color color, std::string trackname);
59 friend class FFTGraph;
63 float* _data_flat_avg;
64 float* _data_flat_max;
65 float* _data_flat_min;
66 float* _data_prop_avg;
67 float* _data_prop_max;
68 float* _data_prop_min;
70 unsigned int _windowSize;
71 unsigned int _dataSize;
81 std::string _trackname;
83 static float power_to_db (float v) { return v > 1e-20 ? 10.0f * log10f (v) : -200.0f; }
86 #endif /* __ardour_fft_result_h */