mpd/src/mixer/plugins/NullMixerPlugin.cxx

65 lines
1.6 KiB
C++
Raw Normal View History

2014-12-02 18:16:33 +01:00
/*
2022-07-14 17:58:12 +02:00
* Copyright 2003-2022 The Music Player Daemon Project
2014-12-02 18:16:33 +01:00
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
2022-08-18 17:03:37 +02:00
#include "NullMixerPlugin.hxx"
2014-12-02 18:16:33 +01:00
#include "mixer/MixerInternal.hxx"
class NullMixer final : public Mixer {
/**
* The current volume in percent (0..100).
*/
unsigned volume;
public:
2020-02-01 13:59:55 +01:00
explicit NullMixer(MixerListener &_listener)
2014-12-02 18:16:33 +01:00
:Mixer(null_mixer_plugin, _listener),
volume(100)
{
}
/* virtual methods from class Mixer */
2016-09-09 12:52:51 +02:00
void Open() override {
2014-12-02 18:16:33 +01:00
}
2017-06-08 21:42:12 +02:00
void Close() noexcept override {
2014-12-02 18:16:33 +01:00
}
2016-09-09 12:52:51 +02:00
int GetVolume() override {
2014-12-02 18:16:33 +01:00
return volume;
}
2016-09-09 12:52:51 +02:00
void SetVolume(unsigned _volume) override {
2014-12-02 18:16:33 +01:00
volume = _volume;
}
};
static Mixer *
null_mixer_init([[maybe_unused]] EventLoop &event_loop,
[[maybe_unused]] AudioOutput &ao,
2014-12-02 18:16:33 +01:00
MixerListener &listener,
[[maybe_unused]] const ConfigBlock &block)
2014-12-02 18:16:33 +01:00
{
return new NullMixer(listener);
}
const MixerPlugin null_mixer_plugin = {
null_mixer_init,
true,
};