Qmmp
volumecontrol_p.h
1 /***************************************************************************
2  * Copyright (C) 2008-2015 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef VOLUMECONTROL_P_H
21 #define VOLUMECONTROL_P_H
22 
23 #include <QObject>
24 #include "qmmp.h"
25 #include "volume.h"
26 #include "buffer.h"
27 
28 class QTimer;
29 class SoftwareVolume;
30 
35 class VolumeControl : public QObject
36 {
37  Q_OBJECT
38 public:
43  VolumeControl(QObject *parent = 0);
47  ~VolumeControl();
54  void setVolume(int left, int right);
58  void changeVolume(int delta);
63  void setVolume(int volume);
68  void setBalance(int balance);
72  int left() const;
76  int right() const;
80  int volume() const;
84  int balance() const;
85 
86 
87 signals:
93  void volumeChanged(int left, int right);
98  void volumeChanged(int volume);
103  void balanceChanged(int balance);
104 
105 public slots:
109  void checkVolume();
113  void reload();
114 
115 private:
116  int m_left, m_right;
117  bool m_prev_block;
118  Volume *m_volume;
119  QTimer *m_timer;
120 
121 };
126 class SoftwareVolume : public Volume
127 {
128 public:
129  SoftwareVolume();
130  ~SoftwareVolume();
131 
132  void setVolume(const VolumeSettings &v);
133  VolumeSettings volume() const;
134  void changeVolume(Buffer *b, int chan);
135 
136  static SoftwareVolume *instance();
137 
138 private:
139  int m_left, m_right;
140  double m_scaleLeft, m_scaleRight;
141  static SoftwareVolume *m_instance;
142 };
143 
144 #endif
The VolumeSettings structure stores volume levels.
Definition: volume.h:29
The Volume class provides asbtract volume interface.
Definition: volume.h:47
Audio buffer class.
Definition: buffer.h:20