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 int left(); 00062 int right(); 00063 00064 signals: 00070 void volumeChanged(int left, int right); 00071 00072 public slots: 00076 void checkVolume(); 00080 void reload(); 00081 00082 private: 00083 int m_left, m_right; 00084 bool m_prev_block; 00085 Volume *m_volume; 00086 QTimer *m_timer; 00087 00088 }; 00093 class SoftwareVolume : public Volume 00094 { 00095 public: 00096 SoftwareVolume(); 00097 ~SoftwareVolume(); 00098 00099 void setVolume(int channel, int value); 00100 int volume(int channel); 00101 void changeVolume(Buffer *b, int chan, Qmmp::AudioFormat format); 00102 00103 static SoftwareVolume *instance(); 00104 00105 private: 00106 int m_left, m_right; 00107 double m_scaleLeft, m_scaleRight; 00108 static SoftwareVolume *m_instance; 00109 }; 00110 00111 #endif