Copiste  0.1
 All Classes Functions Variables Enumerations Friends Pages
featuredrawer.h
1 /*
2  * This file is part of Copiste.
3  *
4  * Copiste is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Copiste is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Copiste. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef INCLUDED_FEATUREDRAWERH
20 #define INCLUDED_FEATUREDRAWERH
21 
22 #include <iostream>
23 #include <sstream>
24 
25 #include <QImage>
26 #include <QColor>
27 #include <QPainter>
28 #include <QTime> // delete me \todo
29 
30 #include "core/soundanalyser.h"
31 #include "algo/neuralnetwork.h"
32 
33 const int FEATURE_DRAWER_DEFAULT_WIDTH = 1600;
34 const int FEATURE_DRAWER_DEFAULT_HEIGHT = 600;
35 const char FEATURE_DRAWER_SPECTRUM_NAME[10] = "_spectrum";
36 
37 using namespace std;
38 
41 {
42  public:
44  FeatureDrawer(bool live = false);
45 
47  ~FeatureDrawer();
48 
50  void drawSpectrum(bool draw = true);
51 
53  virtual void setNetwork(NeuralNetwork *net);
54 
56  void setImageSize(int width, int height);
57 
59  void draw(string name = "", bool liveMode = false);
60 
62  void writeToFile(string file);
63 
65  void writeToDevice(QPaintDevice *device);
66 
67  private:
68  QImage mOut;
69  QImage mCaption;
70  bool mDrawn;
71  NeuralNetwork *mNet;
72  bool mDrawSpectrum;
73 
74  double* mMin;
75  double* mMax;
76  unsigned int mMinMaxSize;
77 };
78 
79 #endif
80