kwave
18.07.70
|
#include <LevelMeter.h>
Public Slots | |
virtual void | setTracks (unsigned int tracks) |
virtual void | setSampleRate (double rate) |
virtual void | updateTrack (unsigned int track, const Kwave::SampleArray &buffer) |
virtual void | reset () |
virtual void | drawContents () |
Public Member Functions | |
LevelMeter (QWidget *parent) | |
virtual | ~LevelMeter () Q_DECL_OVERRIDE |
virtual void | paintEvent (QPaintEvent *) Q_DECL_OVERRIDE |
virtual void | resizeEvent (QResizeEvent *) Q_DECL_OVERRIDE |
Protected Slots | |
virtual void | timedUpdate () |
Protected Member Functions | |
virtual void | enqueue (unsigned int track, float fast, float peak, unsigned int queue_depth) |
virtual bool | dequeue (unsigned int track, float &fast, float &peak) |
void | drawScale (QPainter &p) |
Private Attributes | |
int | m_tracks |
float | m_sample_rate |
QVector< float > | m_yf |
QVector< float > | m_yp |
QVector< QQueue< float > > | m_fast_queue |
QVector< QQueue< float > > | m_peak_queue |
QVector< float > | m_current_fast |
QVector< float > | m_current_peak |
QTimer * | m_timer |
QColor | m_color_low |
QColor | m_color_normal |
QColor | m_color_high |
Definition at line 39 of file LevelMeter.h.
|
explicit |
Constructor
Definition at line 54 of file LevelMeter.cpp.
References Kwave::connect(), m_timer, and timedUpdate().
|
virtual |
Destructor
Definition at line 71 of file LevelMeter.cpp.
References setTracks().
|
protectedvirtual |
Dequeue a pair of fast and peek value of a track.
track | index of the track [0...m_tracks-1] |
fast | receives the value of the fast level bar [0.0 ... 1.0] |
peak | receives value of the peak level [0.0 ... 1.0] |
Definition at line 226 of file LevelMeter.cpp.
References m_fast_queue, m_peak_queue, m_tracks, and Kwave::toInt().
Referenced by timedUpdate().
|
virtualslot |
Redraws the whole widget
Definition at line 344 of file LevelMeter.cpp.
References background, drawScale(), m_color_high, m_color_low, m_color_normal, m_current_fast, m_current_peak, m_tracks, rect(), and Kwave::toUint().
Referenced by paintEvent().
|
protected |
Draw some scale into the meter, using 3dB steps
p | an already opened QPainter |
Definition at line 272 of file LevelMeter.cpp.
References background, rect(), and Kwave::toInt().
Referenced by drawContents().
|
protectedvirtual |
Enqueue a pair of fast and peak value of a track for later timed update. If the queue already contains the maximum number of elements, the oldest ones will be removed.
track | index of the track [0...m_tracks-1] |
fast | value of the fast level bar [0.0 ... 1.0] |
peak | value of the peak level [0.0 ... 1.0] |
queue_depth | maximum number of elements to queue |
Definition at line 192 of file LevelMeter.cpp.
References m_fast_queue, m_peak_queue, m_timer, m_tracks, Kwave::toInt(), and UPDATES_PER_SECOND.
Referenced by updateTrack().
|
virtual |
Definition at line 77 of file LevelMeter.cpp.
References drawContents().
|
virtualslot |
Resets all meters to zero
Definition at line 174 of file LevelMeter.cpp.
References m_current_fast, m_current_peak, m_fast_queue, m_peak_queue, m_timer, m_tracks, m_yf, and m_yp.
Referenced by setTracks().
|
virtual |
|
virtualslot |
sets the sample rate for interpreting the samples used for updating the display.
Definition at line 97 of file LevelMeter.cpp.
References m_sample_rate.
|
virtualslot |
sets the number of tracks that the display should use
Definition at line 89 of file LevelMeter.cpp.
References m_tracks, reset(), and Kwave::toInt().
Referenced by ~LevelMeter().
|
protectedvirtualslot |
Called via m_timer to update the bar(s)
Definition at line 250 of file LevelMeter.cpp.
References dequeue(), m_current_fast, m_current_peak, and m_tracks.
Referenced by LevelMeter().
|
virtualslot |
Updates a apecific track
track | index of the track |
buffer | array with samples |
Definition at line 104 of file LevelMeter.cpp.
References enqueue(), F_FAST_DECAY, F_FAST_RISE, F_PEAK_DECAY, F_PEAK_RISE, m_sample_rate, m_tracks, m_yf, m_yp, sample2float(), Kwave::SampleArray::size(), Kwave::toInt(), Kwave::toUint(), and UPDATES_PER_SECOND.
|
private |
color high levels, above -1.5dB
Definition at line 159 of file LevelMeter.h.
Referenced by drawContents().
|
private |
color for low levels, below -3dB
Definition at line 153 of file LevelMeter.h.
Referenced by drawContents().
|
private |
color for normal levels, -3dB...-1.5dB
Definition at line 156 of file LevelMeter.h.
Referenced by drawContents().
|
private |
current fast value for each track
Definition at line 144 of file LevelMeter.h.
Referenced by drawContents(), reset(), and timedUpdate().
|
private |
current peak value for each track
Definition at line 147 of file LevelMeter.h.
Referenced by drawContents(), reset(), and timedUpdate().
|
private |
queues with fast update values for each track
Definition at line 138 of file LevelMeter.h.
|
private |
queues with peak values for each track
Definition at line 141 of file LevelMeter.h.
|
private |
sample rate used for interpreting the received buffers
Definition at line 129 of file LevelMeter.h.
Referenced by setSampleRate(), and updateTrack().
|
private |
timer for display updates
Definition at line 150 of file LevelMeter.h.
Referenced by enqueue(), LevelMeter(), and reset().
|
private |
number of tracks
Definition at line 126 of file LevelMeter.h.
Referenced by dequeue(), drawContents(), enqueue(), reset(), setTracks(), timedUpdate(), and updateTrack().
|
private |
last output value of the filter for fast updates
Definition at line 132 of file LevelMeter.h.
Referenced by reset(), and updateTrack().
|
private |
last output value of the filter for peak updates
Definition at line 135 of file LevelMeter.h.
Referenced by reset(), and updateTrack().