HaikuMixerPlugin.cxx 1.92 KB
Newer Older
1
/*
Max Kellermann's avatar
Max Kellermann committed
2
 * Copyright 2003-2019 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 23 24
 * Copyright (C) 2010-2011 Philipp 'ph3-der-loewe' Schafft
 * Copyright (C) 2010-2011 Hans-Kristian 'maister' Arntzen
 * Copyright (C) 2014-2015 François 'mmu_man' Revol
 *
 * 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 "mixer/MixerInternal.hxx"
#include "output/plugins/HaikuOutputPlugin.hxx"
25
#include "util/Compiler.h"
26

François Revol's avatar
François Revol committed
27 28
#include "util/RuntimeError.hxx"

29 30 31 32 33 34 35 36 37 38
class HaikuMixer final : public Mixer {
	/** the base mixer class */
	HaikuOutput &self;

public:
	HaikuMixer(HaikuOutput &_output, MixerListener &_listener)
		:Mixer(haiku_mixer_plugin, _listener),
		 self(_output) {}

	/* virtual methods from class Mixer */
François Revol's avatar
François Revol committed
39
	virtual void Open() override {
40 41
	}

42
	void Close() noexcept override {
43 44
	}

François Revol's avatar
François Revol committed
45 46
	virtual int GetVolume() override;
	virtual void SetVolume(unsigned volume) override;
47 48 49
};

static Mixer *
50
haiku_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
51
		MixerListener &listener,
François Revol's avatar
François Revol committed
52
		gcc_unused const ConfigBlock &block)
53 54 55 56 57
{
	return new HaikuMixer((HaikuOutput &)ao, listener);
}

int
François Revol's avatar
François Revol committed
58
HaikuMixer::GetVolume()
59 60 61 62
{
	return haiku_output_get_volume(self);
}

François Revol's avatar
François Revol committed
63 64
void
HaikuMixer::SetVolume(unsigned volume)
65
{
François Revol's avatar
François Revol committed
66
	haiku_output_set_volume(self, volume);
67 68 69 70 71 72
}

const MixerPlugin haiku_mixer_plugin = {
	haiku_mixer_init,
	false,
};