1 /****************************************************************************************
2  * Copyright (c) 2004 Enrico Ros <eros.kde@email.it>                                    *
3  *                                                                                      *
4  * This program is free software; you can redistribute it and/or modify it under        *
5  * the terms of the GNU General Public License as published by the Free Software        *
6  * Foundation; either version 2 of the License, or (at your option) any later           *
7  * version.                                                                             *
8  *                                                                                      *
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12  *                                                                                      *
13  * You should have received a copy of the GNU General Public License along with         *
14  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15  ****************************************************************************************/
16 
17 #ifndef BALLS_ANALYZER_H
18 #define BALLS_ANALYZER_H
19 
20 #include "AnalyzerBase.h"
21 
22 
23 class QWidget;
24 class Ball;
25 class Paddle;
26 
27 class BallsAnalyzer : public Analyzer::Base
28 {
29 public:
30     explicit BallsAnalyzer( QWidget * );
31     ~BallsAnalyzer();
32     void analyze( const QVector<float> & );
33 
34 protected:
35     void initializeGL();
36     void resizeGL( int w, int h );
37     void paintGL();
38 
39 private:
40     struct ShowProperties
41     {
42         double timeStamp;
43         double dT;
44         float colorK;
45         float gridScrollK;
46         float gridEnergyK;
47         float camRot;
48         float camRoll;
49         float peakEnergy;
50     } m_show;
51 
52     struct FrameProperties
53     {
54         bool silence;
55         float energy;
56         float dEnergy;
57     } m_frame;
58 
59     static const int NUMBER_OF_BALLS = 16;
60 
61     QList<Ball *> m_balls;
62     Paddle * m_leftPaddle, * m_rightPaddle;
63     float m_unitX, m_unitY;
64     GLuint m_ballTexture;
65     GLuint m_gridTexture;
66 
67     void drawDot3s( float x, float y, float z, float size );
68     void drawHFace( float y );
69     void drawScrollGrid( float scroll, float color[4] );
70 };
71 
72 #endif
73