RoarMixerPlugin.cxx 1.81 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright 2003-2017 The Music Player Daemon Project
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 * Copyright (C) 2010-2011 Philipp 'ph3-der-loewe' Schafft
 * Copyright (C) 2010-2011 Hans-Kristian 'maister' Arntzen
 *
 * 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.
 */


#include "config.h"
Max Kellermann's avatar
Max Kellermann committed
23
#include "mixer/MixerInternal.hxx"
24
#include "output/plugins/RoarOutputPlugin.hxx"
25
#include "Compiler.h"
26

27
class RoarMixer final : public Mixer {
28
	/** the base mixer class */
29
	RoarOutput &self;
30

31
public:
32 33 34
	RoarMixer(RoarOutput &_output, MixerListener &_listener)
		:Mixer(roar_mixer_plugin, _listener),
		 self(_output) {}
35 36

	/* virtual methods from class Mixer */
37
	void Open() override {
38 39
	}

40
	void Close() noexcept override {
41 42
	}

43 44
	int GetVolume() override;
	void SetVolume(unsigned volume) override;
45
};
46

47
static Mixer *
48
roar_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
49
		MixerListener &listener,
50
		gcc_unused const ConfigBlock &block)
51
{
52
	return new RoarMixer((RoarOutput &)ao, listener);
53 54
}

55
int
56
RoarMixer::GetVolume()
57
{
58
	return roar_output_get_volume(self);
59 60
}

61 62
void
RoarMixer::SetVolume(unsigned volume)
63
{
64
	roar_output_set_volume(self, volume);
65 66
}

67
const MixerPlugin roar_mixer_plugin = {
68 69
	roar_mixer_init,
	false,
70
};