1 /* This file is part of Clementine.
2    Copyright 2004, Adam Pigg <adam@piggz.co.uk>
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:  Adam Pigg  <adam@piggz.co.uk>  2004
22  */
23 
24 #ifndef ANALYZERS_GLANALYZER_H_
25 #define ANALYZERS_GLANALYZER_H_
26 
27 #include <config.h>
28 #ifdef HAVE_QGLWIDGET
29 
30 #include "analyzerbase.h"
31 
32 typedef struct {
33   float level;
34   uint delay;
35 } peak_tx;
36 
37 class GLAnalyzer : public Analyzer::Base3D {
38  private:
39   std::vector<float> m_oldy;
40   std::vector<peak_tx> m_peaks;
41 
42   void drawCube();
43   void drawFrame();
44   void drawBar(float xPos, float height);
45   void drawPeak(float xPos, float ypos);
46   void drawFloor();
47 
48   GLfloat x, y;
49 
50  public:
51   explicit GLAnalyzer(QWidget*);
52   ~GLAnalyzer();
53   void analyze(const Scope&);
54 
55  protected:
56   void initializeGL();
57   void resizeGL(int w, int h);
58   void paintGL();
59 };
60 
61 #endif
62 #endif  // ANALYZERS_GLANALYZER_H_
63