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