2009-12-24 20:16:07 +01:00
|
|
|
// Maintainer: Max Howell <max.howell@methylblue.com>, (C) 2004
|
|
|
|
// Copyright: See COPYING file that comes with this distribution
|
|
|
|
|
|
|
|
#ifndef ANALYZERBASE_H
|
|
|
|
#define ANALYZERBASE_H
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
2010-04-04 19:50:11 +02:00
|
|
|
#include "engines/engine_fwd.h"
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QPixmap> //stack allocated and convenience
|
2010-04-27 23:40:28 +02:00
|
|
|
#include <QBasicTimer> //stack allocated
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QWidget> //baseclass
|
|
|
|
|
|
|
|
class QEvent;
|
|
|
|
class QPaintEvent;
|
|
|
|
class QResizeEvent;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Analyzer {
|
|
|
|
|
2010-08-18 20:21:30 +02:00
|
|
|
typedef QVector<float> Scope;
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
class Base : public QWidget
|
|
|
|
{
|
2010-03-20 23:45:54 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
2010-08-18 18:09:45 +02:00
|
|
|
public slots:
|
2010-08-18 20:21:30 +02:00
|
|
|
void set_engine(Engine::Base* engine);
|
|
|
|
void SpectrumAvailable(const QVector<float>& spectrum);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
protected:
|
2010-08-18 20:21:30 +02:00
|
|
|
Base(QWidget* parent);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
void paintEvent( QPaintEvent* );
|
|
|
|
|
|
|
|
void polishEvent();
|
|
|
|
|
|
|
|
virtual void init() {}
|
2010-08-18 20:21:30 +02:00
|
|
|
virtual void analyze(QPainter& p, const Scope&) = 0;
|
2009-12-24 20:16:07 +01:00
|
|
|
virtual void paused(QPainter& p);
|
|
|
|
virtual void demo(QPainter& p);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
EngineBase* m_engine;
|
|
|
|
Scope m_lastScope;
|
|
|
|
};
|
|
|
|
|
|
|
|
void interpolate( const Scope&, Scope& );
|
|
|
|
void initSin( Scope&, const uint = 6000 );
|
|
|
|
|
|
|
|
} //END namespace Analyzer
|
|
|
|
|
|
|
|
using Analyzer::Scope;
|
|
|
|
|
|
|
|
#endif
|