aboutsummaryrefslogtreecommitdiffstats
path: root/src/mixer/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/mixer/plugins')
-rw-r--r--src/mixer/plugins/AlsaMixerPlugin.cxx2
-rw-r--r--src/mixer/plugins/NullMixerPlugin.cxx67
-rw-r--r--src/mixer/plugins/OssMixerPlugin.cxx2
-rw-r--r--src/mixer/plugins/PulseMixerPlugin.cxx28
-rw-r--r--src/mixer/plugins/PulseMixerPlugin.hxx2
-rw-r--r--src/mixer/plugins/RoarMixerPlugin.cxx2
-rw-r--r--src/mixer/plugins/SoftwareMixerPlugin.cxx2
-rw-r--r--src/mixer/plugins/SoftwareMixerPlugin.hxx2
-rw-r--r--src/mixer/plugins/WinmmMixerPlugin.cxx2
9 files changed, 86 insertions, 23 deletions
diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx
index cd787182a..7fc43da44 100644
--- a/src/mixer/plugins/AlsaMixerPlugin.cxx
+++ b/src/mixer/plugins/AlsaMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/mixer/plugins/NullMixerPlugin.cxx b/src/mixer/plugins/NullMixerPlugin.cxx
new file mode 100644
index 000000000..a90bd03a5
--- /dev/null
+++ b/src/mixer/plugins/NullMixerPlugin.cxx
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
+ * 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.
+ */
+
+#include "config.h"
+#include "mixer/MixerInternal.hxx"
+
+class NullMixer final : public Mixer {
+ /**
+ * The current volume in percent (0..100).
+ */
+ unsigned volume;
+
+public:
+ NullMixer(MixerListener &_listener)
+ :Mixer(null_mixer_plugin, _listener),
+ volume(100)
+ {
+ }
+
+ /* virtual methods from class Mixer */
+ bool Open(gcc_unused Error &error) override {
+ return true;
+ }
+
+ void Close() override {
+ }
+
+ int GetVolume(gcc_unused Error &error) override {
+ return volume;
+ }
+
+ bool SetVolume(unsigned _volume, gcc_unused Error &error) override {
+ volume = _volume;
+ return true;
+ }
+};
+
+static Mixer *
+null_mixer_init(gcc_unused EventLoop &event_loop,
+ gcc_unused AudioOutput &ao,
+ MixerListener &listener,
+ gcc_unused const config_param &param,
+ gcc_unused Error &error)
+{
+ return new NullMixer(listener);
+}
+
+const MixerPlugin null_mixer_plugin = {
+ null_mixer_init,
+ true,
+};
diff --git a/src/mixer/plugins/OssMixerPlugin.cxx b/src/mixer/plugins/OssMixerPlugin.cxx
index 6615c7022..35f3cbbe0 100644
--- a/src/mixer/plugins/OssMixerPlugin.cxx
+++ b/src/mixer/plugins/OssMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/mixer/plugins/PulseMixerPlugin.cxx b/src/mixer/plugins/PulseMixerPlugin.cxx
index c5f20723b..713bdf69e 100644
--- a/src/mixer/plugins/PulseMixerPlugin.cxx
+++ b/src/mixer/plugins/PulseMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,18 +19,18 @@
#include "config.h"
#include "PulseMixerPlugin.hxx"
+#include "lib/pulse/Domain.hxx"
+#include "lib/pulse/LogError.hxx"
#include "mixer/MixerInternal.hxx"
#include "mixer/Listener.hxx"
#include "output/plugins/PulseOutputPlugin.hxx"
#include "util/Error.hxx"
-#include "util/Domain.hxx"
#include "Log.hxx"
#include <pulse/context.h>
#include <pulse/introspect.h>
#include <pulse/stream.h>
#include <pulse/subscribe.h>
-#include <pulse/error.h>
#include <assert.h>
@@ -55,19 +55,17 @@ public:
int GetVolumeInternal(Error &error);
/* virtual methods from class Mixer */
- virtual bool Open(gcc_unused Error &error) override {
+ bool Open(gcc_unused Error &error) override {
return true;
}
- virtual void Close() override {
+ void Close() override {
}
- virtual int GetVolume(Error &error) override;
- virtual bool SetVolume(unsigned volume, Error &error) override;
+ int GetVolume(Error &error) override;
+ bool SetVolume(unsigned volume, Error &error) override;
};
-static constexpr Domain pulse_mixer_domain("pulse_mixer");
-
void
PulseMixer::Offline()
{
@@ -120,9 +118,8 @@ PulseMixer::Update(pa_context *context, pa_stream *stream)
pa_stream_get_index(stream),
pulse_mixer_volume_cb, this);
if (o == nullptr) {
- FormatError(pulse_mixer_domain,
- "pa_context_get_sink_input_info() failed: %s",
- pa_strerror(pa_context_errno(context)));
+ LogPulseError(context,
+ "pa_context_get_sink_input_info() failed");
Offline();
return;
}
@@ -142,9 +139,8 @@ pulse_mixer_on_connect(gcc_unused PulseMixer &pm,
(pa_subscription_mask_t)PA_SUBSCRIPTION_MASK_SINK_INPUT,
nullptr, nullptr);
if (o == nullptr) {
- FormatError(pulse_mixer_domain,
- "pa_context_subscribe() failed: %s",
- pa_strerror(pa_context_errno(context)));
+ LogPulseError(context,
+ "pa_context_subscribe() failed");
return;
}
@@ -212,7 +208,7 @@ PulseMixer::SetVolume(unsigned new_volume, Error &error)
if (!online) {
pulse_output_unlock(output);
- error.Set(pulse_mixer_domain, "disconnected");
+ error.Set(pulse_domain, "disconnected");
return false;
}
diff --git a/src/mixer/plugins/PulseMixerPlugin.hxx b/src/mixer/plugins/PulseMixerPlugin.hxx
index 9b3a6daf1..64605ea8d 100644
--- a/src/mixer/plugins/PulseMixerPlugin.hxx
+++ b/src/mixer/plugins/PulseMixerPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/mixer/plugins/RoarMixerPlugin.cxx b/src/mixer/plugins/RoarMixerPlugin.cxx
index 8e198478d..8aefa235f 100644
--- a/src/mixer/plugins/RoarMixerPlugin.cxx
+++ b/src/mixer/plugins/RoarMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* Copyright (C) 2010-2011 Philipp 'ph3-der-loewe' Schafft
* Copyright (C) 2010-2011 Hans-Kristian 'maister' Arntzen
*
diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx
index f14766002..c84990888 100644
--- a/src/mixer/plugins/SoftwareMixerPlugin.cxx
+++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/mixer/plugins/SoftwareMixerPlugin.hxx b/src/mixer/plugins/SoftwareMixerPlugin.hxx
index 581d2ac17..f9be1d9d9 100644
--- a/src/mixer/plugins/SoftwareMixerPlugin.hxx
+++ b/src/mixer/plugins/SoftwareMixerPlugin.hxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
diff --git a/src/mixer/plugins/WinmmMixerPlugin.cxx b/src/mixer/plugins/WinmmMixerPlugin.cxx
index e0436011a..a89ac93ce 100644
--- a/src/mixer/plugins/WinmmMixerPlugin.cxx
+++ b/src/mixer/plugins/WinmmMixerPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2014 The Music Player Daemon Project
+ * Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify