00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VOLUMECONTROL_H
00021 #define VOLUMECONTROL_H
00022
00023 #include <QObject>
00024 #include "qmmp.h"
00025 #include "buffer.h"
00026
00030 class VolumeControl : public QObject
00031 {
00032 Q_OBJECT
00033 public:
00038 VolumeControl(QObject *parent = 0);
00042 ~VolumeControl();
00049 virtual void setVolume(int left, int right) = 0;
00053 int left();
00057 int right();
00062 static VolumeControl *create(QObject *parent = 0);
00063
00064 signals:
00070 void volumeChanged(int left, int right);
00071
00072 public slots:
00076 void checkVolume();
00077
00078 protected:
00084 virtual void volume(int *left, int *right) = 0;
00085
00086 private:
00087 int m_left, m_right;
00088 bool m_prev_block;
00089
00090 };
00094 class SoftwareVolume : public VolumeControl
00095 {
00096 Q_OBJECT
00097 public:
00102 SoftwareVolume(QObject *parent = 0);
00106 ~SoftwareVolume();
00113 void setVolume(int left, int right);
00120 void changeVolume(Buffer *b, int chan, Qmmp::AudioFormat format);
00124 static SoftwareVolume *instance();
00125
00126 protected:
00132 void volume(int *left, int *right);
00133
00134 private:
00135 int m_left, m_right;
00136 double m_scaleLeft, m_scaleRight;
00137 static SoftwareVolume *m_instance;
00138 };
00139
00140 #endif