MPD: mixer/MixerInternal.hxx Source File

MPD 0.20.15

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:
32 const MixerPlugin &plugin;
33
34 MixerListener &listener;
35
40 Mutex mutex;
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::Mixer
Mixer(const MixerPlugin &_plugin, MixerListener &_listener)
Definition: MixerInternal.hxx:54
Mixer
Definition: MixerInternal.hxx:30
Mixer::Close
virtual void Close()=0
Close mixer device.
Mixer::Open
virtual void Open()=0
Open mixer device.
MixerPlugin.hxx
This header declares the mixer_plugin class.
Mutex
Definition: Mutex.hxx:43
MixerPlugin
Definition: MixerPlugin.hxx:36
Mixer::IsPlugin
bool IsPlugin(const MixerPlugin &other) const
Definition: MixerInternal.hxx:63
Mixer::mutex
Mutex mutex
This mutex protects all of the mixer struct, including its implementation, so plugins don&#39;t have to d...
Definition: MixerInternal.hxx:40
Compiler.h
Mixer::~Mixer
virtual ~Mixer()
Definition: MixerInternal.hxx:61
Mutex.hxx
Mixer::listener
MixerListener & listener
Definition: MixerInternal.hxx:34
MixerListener
An interface that listens on events from mixer plugins.
Definition: Listener.hxx:29
Mixer::plugin
const MixerPlugin & plugin
Definition: MixerInternal.hxx:32
Mixer::SetVolume
virtual void SetVolume(unsigned volume)=0
Sets the volume.
Mixer::failed
bool failed
Has this mixer failed, and should not be reopened automatically?
Definition: MixerInternal.hxx:51
Mixer::open
bool open
Is the mixer device currently open?
Definition: MixerInternal.hxx:45
MixerList.hxx
This header provides "extern" declarations for all mixer plugins.
Mixer::GetVolume
virtual int GetVolume()=0
Reads the current volume.