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
|
#ifndef AUDIODISPLAYVOLUME_HPP
#define AUDIODISPLAYVOLUME_HPP
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <qarray.h>
#include <qthread.h>
#include <qvector.h>
#include <qwidget.h>
#include "AudioDevice.h"
#include "LedBar.h"
class CAudioDisplayVolume: public QWidget, public QThread
{
Q_OBJECT
public:
/**
\brief This enum defines the overal display of this widget
*/
enum DisplayMode
{
SkyLine, ///< All bars are next to eachother, going up
Stereo, ///< Horizontal line, with bars progressing from the middle
Stack, ///< Horizontal lines, stacked on top of each other; always left to right
};
private:
QMutex m_Mutex;
DisplayMode m_DisplayMode;
int m_DisplayLength; ///< vertical or horizontal length
CAudioRingBufferReader *m_pReader;
SoundAttributes m_SndAttr;
int m_Samples;
bool m_Done;
QSize m_SizeHint;
int m_Length;
int m_MaxShift;
QVector<CLedBar> m_Bars;
QArray<int> m_OldMax;
QArray<int> m_Max;
void RecalculateSizes();
protected:
virtual void run();
virtual void paintEvent(QPaintEvent *ev);
virtual void resizeEvent(QResizeEvent *ev);
public:
CAudioDisplayVolume(QWidget *parent = 0, const char *name = 0);
CAudioDisplayVolume(CAudioRingBufferReader *reader, DisplayMode mode, QWidget *parent = 0, const char *name = 0);
~CAudioDisplayVolume();
void SetMode(DisplayMode mode);
void SetReader(CAudioRingBufferReader *reader);
void SetLength(int length);
virtual QSize sizeHint();
void Quit(bool Wait = true);
public slots:
void SetSoundAttributes(const SoundAttributes &);
};
#endif
|