2006-03-12 16:58:52 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2006 Paul Davis
|
|
|
|
Written by Sampo Savolainen
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_fft_result_h
|
|
|
|
#define __ardour_fft_result_h
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/types.h"
|
2006-03-12 16:58:52 -05:00
|
|
|
#include <fftw3.h>
|
|
|
|
|
|
|
|
#include <gdkmm/color.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class FFTGraph;
|
|
|
|
|
|
|
|
class FFTResult
|
|
|
|
{
|
|
|
|
public:
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
~FFTResult();
|
|
|
|
|
|
|
|
void analyzeWindow(float *window);
|
|
|
|
void finalize();
|
|
|
|
|
2009-02-25 19:58:35 -05:00
|
|
|
int length() const { return _dataSize; }
|
2006-03-12 16:58:52 -05:00
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
float avgAt(int x);
|
|
|
|
float maxAt(int x);
|
|
|
|
float minAt(int x);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-25 19:58:35 -05:00
|
|
|
float minimum() const { return _minimum; }
|
|
|
|
float maximum() const { return _maximum; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-25 19:58:35 -05:00
|
|
|
Gdk::Color get_color() const { return _color; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
private:
|
|
|
|
FFTResult(FFTGraph *graph, Gdk::Color color, std::string trackname);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
int _averages;
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
float* _data_avg;
|
|
|
|
float* _data_max;
|
|
|
|
float* _data_min;
|
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
float* _work;
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
int _windowSize;
|
2006-03-12 16:58:52 -05:00
|
|
|
int _dataSize;
|
|
|
|
|
|
|
|
float _minimum;
|
|
|
|
float _maximum;
|
|
|
|
|
|
|
|
FFTGraph *_graph;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
Gdk::Color _color;
|
|
|
|
std::string _trackname;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2006-03-12 16:58:52 -05:00
|
|
|
friend class FFTGraph;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_fft_result_h */
|