1 /* This file is part of Clementine.
2    Copyright 2004, Enrico Ros <eros.kde@email.it>
3    Copyright 2009, David Sansome <davidsansome@gmail.com>
4    Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
5    Copyright 2014, John Maguire <john.maguire@gmail.com>
6 
7    Clementine 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 3 of the License, or
10    (at your option) any later version.
11 
12    Clementine is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with Clementine.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 /* Original Author:  Enrico Ros  <eros.kde@email.it>  2004
22  */
23 
24 #ifndef ANALYZERS_GLANALYZER2_H_
25 #define ANALYZERS_GLANALYZER2_H_
26 
27 #include <config.h>
28 #ifdef HAVE_QGLWIDGET
29 
30 #include "analyzerbase.h"
31 #include <qstring.h>
32 #include <qptrlist.h>
33 
34 class GLAnalyzer2 : public Analyzer::Base3D {
35  public:
36   explicit GLAnalyzer2(QWidget*);
37   ~GLAnalyzer2();
38   void analyze(const Scope&);
39   void paused();
40 
41  protected:
42   void initializeGL();
43   void resizeGL(int w, int h);
44   void paintGL();
45 
46  private:
47   struct ShowProperties {
48     bool paused;
49     double timeStamp;
50     double dT;
51     double pauseTimer;
52     float rotDegrees;
53   } show;
54 
55   struct FrameProperties {
56     float energy;
57     float dEnergy;
58     float meanBand;
59     float rotDegrees;
60     bool silence;
61   } frame;
62 
63   GLuint dotTexture;
64   GLuint w1Texture;
65   GLuint w2Texture;
66   float unitX, unitY;
67 
68   void drawDot(float x, float y, float size);
69   void drawFullDot(float r, float g, float b, float a);
70   void setTextureMatrix(float rot, float scale);
71 
72   bool loadTexture(QString file, GLuint& textureID);
73   void freeTexture(GLuint& textureID);
74 };
75 
76 #endif
77 #endif  // ANALYZERS_GLANALYZER2_H_
78