aboutsummaryrefslogtreecommitdiffstats
path: root/level.h
blob: 9d15d198f4c8734e01afdc42123d870ef1e0c51f (plain)
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
/*
 * level.h. Part of krecord by Gerd Knorr.
 *
 * Displays the input level.
 *
 * Copyright (C) 1998 Florian Kolbe
 *
 * History see level.cpp
 *
 */

#ifndef LEVEL_H
#define LEVEL_H

#include <qwidget.h>

class LevelWindow : public QWidget
{
    Q_OBJECT;

public:
    LevelWindow(QWidget *parent, char *name);
    ~LevelWindow(void);
    bool PowervsMax;
    bool LogvsLinear;

public slots:
    void new_params(struct SOUNDPARAMS *params);
    void new_data(void *data);
    void resetPeakLeft();
    void resetPeakRight();

protected:
    void paintEvent (QPaintEvent *);
    void resizeEvent(QResizeEvent *);
    
private:
    int           init;
    int           afmt;
    int           samples;
    int           channels;
    signed short* sdata;
    QColor	  orange;
    QPixmap*      buffer;
    QTimer*       timer[2];
    float         peak[2];
    bool          clipLeft;
    bool          clipRight;

    void drawBar(QPainter& painter, int where, float level, int size, bool drawRed);
    
signals:
    void setvalue(char *text);
};

#endif /* LEVEL_H */