File indexing completed on 2025-01-05 04:25:41

0001 /****************************************************************************************
0002  * Copyright (c) 2004 Enrico Ros <eros.kde@email.it>                                    *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef BALLS_ANALYZER_H
0018 #define BALLS_ANALYZER_H
0019 
0020 #include "AnalyzerBase.h"
0021 
0022 
0023 class QWidget;
0024 class Ball;
0025 class Paddle;
0026 
0027 class BallsAnalyzer : public Analyzer::Base
0028 {
0029 public:
0030     explicit BallsAnalyzer( QWidget * );
0031     ~BallsAnalyzer();
0032     void analyze( const QVector<float> & );
0033 
0034 protected:
0035     void initializeGL();
0036     void resizeGL( int w, int h );
0037     void paintGL();
0038 
0039 private:
0040     struct ShowProperties
0041     {
0042         double timeStamp;
0043         double dT;
0044         float colorK;
0045         float gridScrollK;
0046         float gridEnergyK;
0047         float camRot;
0048         float camRoll;
0049         float peakEnergy;
0050     } m_show;
0051 
0052     struct FrameProperties
0053     {
0054         bool silence;
0055         float energy;
0056         float dEnergy;
0057     } m_frame;
0058 
0059     static const int NUMBER_OF_BALLS = 16;
0060 
0061     QList<Ball *> m_balls;
0062     Paddle * m_leftPaddle, * m_rightPaddle;
0063     float m_unitX, m_unitY;
0064     GLuint m_ballTexture;
0065     GLuint m_gridTexture;
0066 
0067     void drawDot3s( float x, float y, float z, float size );
0068     void drawHFace( float y );
0069     void drawScrollGrid( float scroll, float color[4] );
0070 };
0071 
0072 #endif