obs-studio/obs/volume-control.hpp
jp9000 ab1543977f UI: Add new volume meter handling
This adds support for the more smooth volume levels that accounts for
both level and magnitude.  Currently, it just averages level and
magnitude, later on a full audio meter control can be made that would
properly utilize level, magnitude, and peak.

Also cleaned up the code a bit and removed some trailing whitespace.
2014-06-03 04:51:27 -07:00

40 lines
827 B
C++

#pragma once
#include <obs.hpp>
#include <QWidget>
#include <QProgressBar>
/* TODO: Make a real volume control that isn't terrible */
class QLabel;
class QSlider;
class VolControl : public QWidget {
Q_OBJECT
private:
OBSSource source;
QLabel *nameLabel;
QLabel *volLabel;
QProgressBar *volMeter;
QSlider *slider;
bool signalChanged;
uint64_t lastMeterTime;
float levelTotal;
float levelCount;
static void OBSVolumeChanged(void *param, calldata_t calldata);
static void OBSVolumeLevel(void *data, calldata_t calldata);
private slots:
void VolumeChanged(int vol);
void VolumeLevel(float level);
void SliderChanged(int vol);
public:
VolControl(OBSSource source);
~VolControl();
inline obs_source_t GetSource() const {return source;}
};