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