Qmmp
|
00001 /*************************************************************************** 00002 * Copyright (C) 2008-2012 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 00019 ***************************************************************************/ 00020 #ifndef VOLUMECONTROL_P_H 00021 #define VOLUMECONTROL_P_H 00022 00023 #include <QObject> 00024 #include "qmmp.h" 00025 #include "volume.h" 00026 #include "buffer.h" 00027 00028 class QTimer; 00029 class SoftwareVolume; 00030 00035 class VolumeControl : public QObject 00036 { 00037 Q_OBJECT 00038 public: 00043 VolumeControl(QObject *parent = 0); 00047 ~VolumeControl(); 00054 void setVolume(int left, int right); 00058 void changeVolume(int delta); 00063 void setVolume(int volume); 00068 void setBalance(int balance); 00072 int left() const; 00076 int right() const; 00080 int volume() const; 00084 int balance() const; 00085 00086 00087 signals: 00093 void volumeChanged(int left, int right); 00098 void volumeChanged(int volume); 00103 void balanceChanged(int balance); 00104 00105 public slots: 00109 void checkVolume(); 00113 void reload(); 00114 00115 private: 00116 int m_left, m_right; 00117 bool m_prev_block; 00118 Volume *m_volume; 00119 QTimer *m_timer; 00120 00121 }; 00126 class SoftwareVolume : public Volume 00127 { 00128 public: 00129 SoftwareVolume(); 00130 ~SoftwareVolume(); 00131 00132 void setVolume(const VolumeSettings &v); 00133 VolumeSettings volume() const; 00134 void changeVolume(Buffer *b, int chan, Qmmp::AudioFormat format); 00135 00136 static SoftwareVolume *instance(); 00137 00138 private: 00139 int m_left, m_right; 00140 double m_scaleLeft, m_scaleRight; 00141 static SoftwareVolume *m_instance; 00142 }; 00143 00144 #endif