-
Notifications
You must be signed in to change notification settings - Fork 1
/
plotter.h
108 lines (94 loc) · 3.14 KB
/
plotter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Copyright (C) 2020 - 2023 Judd Niemann - All Rights Reserved.
* You may use, distribute and modify this code under the
* terms of the GNU Lesser General Public License, version 2.1
*
* You should have received a copy of GNU Lesser General Public License v2.1
* with this file. If not, please refer to: https://github.com/jniemann66/sndscope.git
*/
#ifndef PLOTTER_H
#define PLOTTER_H
#include "sweepparameters.h"
#include "plotmode.h"
#include <QObject>
#include <QPainter>
#include <QImage>
#ifdef SNDSCOPE_BLEND2D
#include <blimagewrapper.h>
#endif
class Plotter : public QObject
{
Q_OBJECT
public:
explicit Plotter(QObject *parent = nullptr);
void render(const QVector<QVector<float> > &inputBuffers, int64_t framesAvailable, int64_t currentFrame);
void calcScaling();
// getters
SweepParameters getSweepParameters() const;
double getTimeLimit_ms() const;
bool getFreshRender() const;
QPixmap *getPixmap() const;
int getAudioFramesPerMs() const;
QColor getDarkencolor() const;
int getDarkenNthFrame() const;
int64_t getExpectedFrames() const;
qreal getBeamWidth() const;
qreal getBeamIntensity() const;
int getNumInputChannels() const;
QColor getPhosphorColor() const;
QPainter::CompositionMode getCompositionMode() const;
Plotmode getPlotMode() const;
bool getconnectSamples() const;
bool getShowTrigger() const;
// setters
void setSweepParameters(const SweepParameters &newSweepParameters);
void setTimeLimit_ms(double newTimeLimit_ms);
void setFreshRender(bool newFreshRender);
void setPixmap(QPixmap *newPixmap);
void setAudioFramesPerMs(int newAudioFramesPerMs);
void setDarkencolor(const QColor &newDarkencolor);
void setDarkenNthFrame(int newDarkenNthFrame);
void setExpectedFrames(int64_t newExpectedFrames);
void setBeamWidth(qreal newBeamWidth);
void setBeamIntensity(qreal newBeamIntensity);
void setNumInputChannels(int newNumInputChannels);
void setPhosphorColor(const QColor &newPhosphorColor);
void setCompositionMode(QPainter::CompositionMode newCompositionMode);
void setPlotMode(Plotmode newPlotMode);
void setconnectSamples(bool newconnectSamples);
void setShowTrigger(bool newShowTrigger);
void drawTrigger(QPainter *painter);
signals:
void renderedFrame(int64_t frame);
private:
QVector<QPointF> plotBuffer;
SweepParameters sweepParameters;
QPixmap* pixmap{nullptr};
double timeLimit_ms;
int64_t expectedFrames{0ll}; // number of audioframes expected per plotTimer timeout
bool freshRender{false};
int audioFramesPerMs{0};
Plotmode plotMode;
bool connectSamples{false};
qreal cx;
qreal cy;
qreal w;
qreal h;
int darkenCooldownCounter{1};
QPainter::CompositionMode compositionMode{QPainter::CompositionMode_SourceOver};
qreal beamWidth;
qreal beamIntensity;
QColor phosphorColor{0x3e, 0xff, 0x6f, 0xff};
QColor darkencolor{0, 0, 0, 0};
int darkenNthFrame{1};
int numInputChannels;
bool showTrigger{false};
//bl.createFromData(img->width(), img->height(), BL_FORMAT_PRGB32, img->bits(), img->bytesPerLine());
#ifdef SNDSCOPE_BLEND2D
BLImageWrapper *blImageWrapper;
public:
BLImageWrapper *getBlImageWrapper() const;
void setBlImageWrapper(BLImageWrapper *newBlImageWrapper);
#endif
};
#endif // PLOTTER_H