MythTV  master
synaesthesia.h
Go to the documentation of this file.
1 #ifndef SYNAETHESIA
2 #define SYNAETHESIA
3 
4 #include <visual.h>
5 #include "polygon.h"
6 #include "mainvisual.h"
7 #include "config.h"
8 
9 class QImage;
10 
11 #define LogSize 10
12 #define Brightness 150
13 #define NumSamples (1<<LogSize)
14 
15 #define Flame 0
16 #define Wave 1
17 #define Stars 2
18 
19 class Synaesthesia : public VisualBase
20 {
21 public:
22  Synaesthesia(void);
23  ~Synaesthesia() override;
24 
25  void resize(const QSize &size) override; // VisualBase
26  bool process(VisualNode *node) override; // VisualBase
27  bool draw(QPainter *p, const QColor &back) override; // VisualBase
28  void handleKeyPress(const QString &action) override // VisualBase
29  {(void) action;}
30 
31 private:
32  void setupPalette(void);
33  void coreInit(void);
34  static int bitReverser(int i);
35  void fft(double *x, double *y);
36  void setStarSize(double lsize);
37 
38  inline void addPixel(int x, int y, int br1, int br2) const;
39  static inline void addPixelFast(unsigned char *p, int br1, int br2);
40  inline unsigned char getPixel(int x, int y, int where) const;
41 
42  inline void fadePixelWave(int x, int y, int where, int step);
43  void fadeWave(void);
44  inline void fadePixelHeat(int x, int y, int where, int step);
45  void fadeHeat(void);
46  void fadeFade(void) const;
47  void fade(void);
48 
49  QSize m_size {0,0};
50 
51  double m_cosTable[NumSamples] {};
54  int m_scaleDown[256] {};
55  int m_maxStarRadius {1};
57  bool m_pointsAreDiamonds {true};
58  double m_brightnessTwiddler {0.3};
59  double m_starSize {0.5};
60 
61  int m_outWidth {0};
62  int m_outHeight {0};
63 
67  QImage *m_outputImage {nullptr};
68 
69  unsigned char m_palette[768] {};
70  double m_fgRedSlider {0.0};
71  double m_fgGreenSlider {0.5};
72  double m_bgRedSlider {0.75};
73  double m_bgGreenSlider {0.4};
74 
75  double m_energyAvg {80.0};
76 };
77 
78 #endif // SYNAETHESIA
Synaesthesia::m_fgRedSlider
double m_fgRedSlider
Definition: synaesthesia.h:70
Synaesthesia::m_outWidth
int m_outWidth
Definition: synaesthesia.h:61
Synaesthesia::bitReverser
static int bitReverser(int i)
Definition: synaesthesia.cpp:155
Synaesthesia::m_cosTable
double m_cosTable[NumSamples]
Definition: synaesthesia.h:51
Synaesthesia::coreInit
void coreInit(void)
Definition: synaesthesia.cpp:211
Synaesthesia::m_lastOutputBmp
Bitmap< unsigned short > m_lastOutputBmp
Definition: synaesthesia.h:65
back
static guint32 * back
Definition: goom_core.cpp:29
VisualNode
Definition: videovisual.h:22
Synaesthesia::setStarSize
void setStarSize(double lsize)
Definition: synaesthesia.cpp:192
Synaesthesia::m_scaleDown
int m_scaleDown[256]
Definition: synaesthesia.h:54
Synaesthesia::resize
void resize(const QSize &size) override
Definition: synaesthesia.cpp:105
Synaesthesia::draw
bool draw(QPainter *p, const QColor &back) override
Definition: synaesthesia.cpp:589
Synaesthesia::m_bitReverse
int m_bitReverse[NumSamples]
Definition: synaesthesia.h:53
VisualBase
Definition: visualize.h:72
Synaesthesia::Synaesthesia
Synaesthesia(void)
Definition: synaesthesia.cpp:32
Synaesthesia::m_starSize
double m_starSize
Definition: synaesthesia.h:59
Synaesthesia::m_pointsAreDiamonds
bool m_pointsAreDiamonds
Definition: synaesthesia.h:57
polygon.h
Bitmap< unsigned short >
Synaesthesia
Definition: synaesthesia.h:19
Stars
#define Stars
Definition: synaesthesia.h:17
Synaesthesia::m_bgGreenSlider
double m_bgGreenSlider
Definition: synaesthesia.h:73
Synaesthesia::fadeFade
void fadeFade(void) const
Definition: synaesthesia.cpp:261
Synaesthesia::~Synaesthesia
~Synaesthesia() override
Definition: synaesthesia.cpp:41
Synaesthesia::m_outHeight
int m_outHeight
Definition: synaesthesia.h:62
Synaesthesia::m_bgRedSlider
double m_bgRedSlider
Definition: synaesthesia.h:72
Synaesthesia::addPixelFast
static void addPixelFast(unsigned char *p, int br1, int br2)
Definition: synaesthesia.cpp:241
Synaesthesia::fade
void fade(void)
Definition: synaesthesia.cpp:431
Synaesthesia::handleKeyPress
void handleKeyPress(const QString &action) override
Definition: synaesthesia.h:28
hardwareprofile.config.p
p
Definition: config.py:33
Synaesthesia::m_outputImage
QImage * m_outputImage
Definition: synaesthesia.h:67
Synaesthesia::m_maxStarRadius
int m_maxStarRadius
Definition: synaesthesia.h:55
Synaesthesia::m_outputBmp
Bitmap< unsigned short > m_outputBmp
Definition: synaesthesia.h:64
Synaesthesia::m_size
QSize m_size
Definition: synaesthesia.h:49
Synaesthesia::setupPalette
void setupPalette(void)
Definition: synaesthesia.cpp:46
Synaesthesia::getPixel
unsigned char getPixel(int x, int y, int where) const
Definition: synaesthesia.cpp:253
NumSamples
#define NumSamples
Definition: synaesthesia.h:13
Synaesthesia::m_negSinTable
double m_negSinTable[NumSamples]
Definition: synaesthesia.h:52
Synaesthesia::addPixel
void addPixel(int x, int y, int br1, int br2) const
Definition: synaesthesia.cpp:225
Synaesthesia::process
bool process(VisualNode *node) override
Definition: synaesthesia.cpp:442
mainvisual.h
Synaesthesia::m_energyAvg
double m_energyAvg
Definition: synaesthesia.h:75
build_compdb.action
action
Definition: build_compdb.py:9
Synaesthesia::fadeWave
void fadeWave(void)
Definition: synaesthesia.cpp:301
Synaesthesia::fadeHeat
void fadeHeat(void)
Definition: synaesthesia.cpp:377
Synaesthesia::m_brightnessTwiddler
double m_brightnessTwiddler
Definition: synaesthesia.h:58
Synaesthesia::fadePixelHeat
void fadePixelHeat(int x, int y, int where, int step)
Definition: synaesthesia.cpp:356
Synaesthesia::fadePixelWave
void fadePixelWave(int x, int y, int where, int step)
Definition: synaesthesia.cpp:279
Synaesthesia::m_fadeMode
int m_fadeMode
Definition: synaesthesia.h:56
Synaesthesia::m_fgGreenSlider
double m_fgGreenSlider
Definition: synaesthesia.h:71
Synaesthesia::m_lastLastOutputBmp
Bitmap< unsigned short > m_lastLastOutputBmp
Definition: synaesthesia.h:66
Synaesthesia::m_palette
unsigned char m_palette[768]
Definition: synaesthesia.h:69
Synaesthesia::fft
void fft(double *x, double *y)
Definition: synaesthesia.cpp:167
visual.h