On Wed, Jun 22, 2016 at 10:54:37AM +0200, Max Kellermann wrote: > On 2016/06/22 10:51, Dimitris Papastamos <s...@2f30.org> wrote: > > + device = block.GetBlockValue("device", nullptr); > > + if (!device) > > + device = SIO_DEVANY; > > Easier: > > device = block.GetBlockValue("device", SIO_DEVANY);
From 43cb9a089363301636317446765f7ca689d6b8c5 Mon Sep 17 00:00:00 2001 From: sin <s...@2f30.org> Date: Wed, 22 Jun 2016 09:41:54 +0100 Subject: [PATCH] sndio: Add option to select output device --- src/output/plugins/SndioOutputPlugin.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output/plugins/SndioOutputPlugin.cxx b/src/output/plugins/SndioOutputPlugin.cxx index b3b990a..a3d08bf 100644 --- a/src/output/plugins/SndioOutputPlugin.cxx +++ b/src/output/plugins/SndioOutputPlugin.cxx @@ -35,13 +35,14 @@ class SndioOutput { friend struct AudioOutputWrapper<SndioOutput>; AudioOutput base; + const char *device; struct sio_hdl *sio_hdl; Timer *timer; public: SndioOutput() :base(sndio_output_plugin), - sio_hdl(nullptr) {} + device(nullptr), sio_hdl(nullptr) {} ~SndioOutput() {} bool Configure(const ConfigBlock &block, Error &error); @@ -62,6 +63,7 @@ SndioOutput::Configure(const ConfigBlock &block, Error &error) { if (!base.Configure(block, error)) return false; + device = block.GetBlockValue("device", SIO_DEVANY); return true; } @@ -84,7 +86,7 @@ SndioOutput::Open(AudioFormat &audio_format, gcc_unused Error &error) struct sio_par par; unsigned bits, rate, chans; - sio_hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0); + sio_hdl = sio_open(device, SIO_PLAY, 0); if (!sio_hdl) { error.Format(sndio_output_domain, -1, "Failed to open default sndio device"); -- 2.8.4 _______________________________________________ mpd-devel mailing list mpd-devel@musicpd.org http://mailman.blarg.de/listinfo/mpd-devel