Qmmp
Loading...
Searching...
No Matches
volume.h
1/***************************************************************************
2 * Copyright (C) 2012-2022 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
21#ifndef VOLUME_H
22#define VOLUME_H
23
24#include <QObject>
25#include <QFlags>
26#include "qmmp_export.h"
27
32{
33 int left = 0;
34 int right = 0;
36};
37
38inline bool operator==(const VolumeSettings &v1, const VolumeSettings &v2)
39{
40 return v1.left == v2.left && v1.right == v2.right;
41}
42
43inline bool operator!=(const VolumeSettings &v1, const VolumeSettings &v2)
44{
45 return v1.left != v2.left || v1.right != v2.right;
46}
47
51class QMMP_EXPORT Volume : public QObject
52{
53 Q_OBJECT
54public:
59 {
60 IsMuteSupported = 0x1,
61 HasNotifySignal = 0x2,
63 };
64 Q_DECLARE_FLAGS(VolumeFlags, VolumeFlag)
68 virtual ~Volume(){}
74 virtual void setVolume(const VolumeSettings &volume) = 0;
78 virtual VolumeSettings volume() const = 0;
82 virtual bool isMuted() const;
87 virtual void setMuted(bool mute);
91 virtual VolumeFlags flags() const;
92
93signals:
97 void changed();
98
99private:
100 bool m_mutedInternal = false;
101};
102
103Q_DECLARE_OPERATORS_FOR_FLAGS(Volume::VolumeFlags)
104
105#endif // VOLUME_H
The Volume class provides asbtract volume interface.
Definition volume.h:52
virtual bool isMuted() const
virtual void setVolume(const VolumeSettings &volume)=0
void changed()
virtual VolumeSettings volume() const =0
virtual VolumeFlags flags() const
virtual void setMuted(bool mute)
VolumeFlag
Definition volume.h:59
The VolumeSettings structure stores volume levels.
Definition volume.h:32
int right
Definition volume.h:34
int left
Definition volume.h:33