MPD  0.20.18
MixerInternal.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_MIXER_INTERNAL_HXX
21 #define MPD_MIXER_INTERNAL_HXX
22 
23 #include "MixerPlugin.hxx"
24 #include "MixerList.hxx"
25 #include "thread/Mutex.hxx"
26 #include "Compiler.h"
27 
28 class MixerListener;
29 
30 class Mixer {
31 public:
33 
35 
41 
45  bool open;
46 
51  bool failed;
52 
53 public:
54  explicit Mixer(const MixerPlugin &_plugin, MixerListener &_listener)
55  :plugin(_plugin), listener(_listener),
56  open(false),
57  failed(false) {}
58 
59  Mixer(const Mixer &) = delete;
60 
61  virtual ~Mixer() {}
62 
63  bool IsPlugin(const MixerPlugin &other) const {
64  return &plugin == &other;
65  }
66 
72  virtual void Open() = 0;
73 
77  virtual void Close() = 0;
78 
87  virtual int GetVolume() = 0;
88 
96  virtual void SetVolume(unsigned volume) = 0;
97 };
98 
99 #endif
Mixer(const MixerPlugin &_plugin, MixerListener &_listener)
virtual void Close()=0
Close mixer device.
virtual void Open()=0
Open mixer device.
This header declares the mixer_plugin class.
Definition: Mutex.hxx:43
bool IsPlugin(const MixerPlugin &other) const
Mutex mutex
This mutex protects all of the mixer struct, including its implementation, so plugins don't have to d...
virtual ~Mixer()
MixerListener & listener
An interface that listens on events from mixer plugins.
Definition: Listener.hxx:29
const MixerPlugin & plugin
virtual void SetVolume(unsigned volume)=0
Sets the volume.
bool failed
Has this mixer failed, and should not be reopened automatically?
bool open
Is the mixer device currently open?
This header provides "extern" declarations for all mixer plugins.
virtual int GetVolume()=0
Reads the current volume.